From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801313; cv=none; d=zoho.com; s=zohoarc; b=ZcKeuwrR+lmEmqhvz2akmVAis4JOlNFb0tWa9hy1N5xBH6Y3ZXq1nrnOdvETl6kZN0JQcLp7eDFhoiIg+nbko7yCXEKtIp9Jr6FBvSMHGURuAUtiSbl8prHEmk/S06QJq61QqbAkX83em002GiOrhcf2kedLX7L7ZkEr4GXlZCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801313; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0XtQVGQRIzo03hfUWSIzUj7KuPghsqPYoQzBa5BGFAg=; b=MP0dJ7eGMRTivAufnWBLt4TAeQ5bOHy0uTdOCRGWxQiad1TairhvVdkO4jCNhe9j4BAtBpSSj/elmcgKX6E7jEpsp+PkqdBdCoihVxpx8NvuU2lhL/aEw6VWHhJVt1Wy4U2DU6FqCb+RYfOJ0HcuIjirwuB8xiDQRUhlceAXZUU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801313689815.6716023159729; Wed, 14 Aug 2019 09:48:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 228AB2F366B; Wed, 14 Aug 2019 16:48:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB1C48208B; Wed, 14 Aug 2019 16:48:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 93BB424F2F; Wed, 14 Aug 2019 16:48:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGmUDY028086 for ; Wed, 14 Aug 2019 12:48:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57A0F1048133; Wed, 14 Aug 2019 16:48:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51CD11001B03 for ; Wed, 14 Aug 2019 16:48:27 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F400230872DD for ; Wed, 14 Aug 2019 16:48:25 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id i63so5031803wmg.4 for ; Wed, 14 Aug 2019 09:48:25 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.48.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Gg+Dub6K+1BnStDV0rmE7BDmK4FQEanrAyrc2Y3nHGI=; b=NtO8M9b3/LdQZVrZ1WKjbUQlHnKqta1IVxFcVCVmMrR8Vogo/EpNOKEavBYRIi9ySX 7R6NyI/SlmuGxI1UgW05DHK1OnFSkB0Mvaj8EgdQIkX6QRo7kaDpx2mzHtwEVm9s7+5h oDT2izz2cxRMx7eR+1RbCFEL/f/QCs07fKwrdlAVLew6fwSlI9G9aKPMneIYHWRldwBJ sSeKLxKGy0jljq87j6I3MYSShJiKMLKNKGIIhLqyKpKoLIYf9GHWNNweL9g9l6RfHtsY S2aUqaQQX/9OZK6wsEMrtkTliRcy+AkFiCcEOBzclCIC87oX9sqQ3pTp9lFMsQyThXsA bRpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gg+Dub6K+1BnStDV0rmE7BDmK4FQEanrAyrc2Y3nHGI=; b=uHqFXCVInfZmYg34XVw/6WSaKePKxzsZy4cnNaDcIWiQc8irYnrw4ykCGBwKHKblH/ KXnTs/K7A7L2FviCmXIgg3uJMX5Wg9tJWP0diOuEPzM+4vkr8l8B77tpvCf9NNEg2xYl GzTuFyilFbDGUvPt3Qt3umd90IqgkiNndKPDyNbNjXH1tsLK1cavjMTDdDUxF9TlAcC5 j4xfgRRvjbHc9my5+Mv2lg2n4fwtwxYTRLAYnRfAvTjkISGms/nTmpyJGoDV1xv+Hob6 80Urw4Sq/q4zK1MJRgsgPEqkfZ5e6MfAVlYnEeHusmAsPPTLBYjh0BG6HOY8PjxCXSI0 4Gzg== X-Gm-Message-State: APjAAAXNqm/vOSXnLr6MfSAWaf8GvuwCNMcE7naxXekVII/1Sisaq60B AfKxreTy8Z2fGtwkMvGLg1sGM763tfA= X-Google-Smtp-Source: APXvYqwN4asMTG+qlHQeHOvMkcmW87l96pIEImRQOVjHSLpp0LSE9EtCgEK+BjvRTmO9pYE5RWgCHQ== X-Received: by 2002:a1c:a383:: with SMTP id m125mr60683wme.57.1565801304203; Wed, 14 Aug 2019 09:48:24 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:05 +0300 Message-Id: <20190814164709.5418-2-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 14 Aug 2019 16:48:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 14 Aug 2019 16:48:26 +0000 (UTC) for IP:'209.85.128.66' DOMAIN:'mail-wm1-f66.google.com' HELO:'mail-wm1-f66.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.128.66 mail-wm1-f66.google.com 209.85.128.66 mail-wm1-f66.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/6] test_driver: implement virDomainAttachDeviceFlags X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 14 Aug 2019 16:48:32 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 290 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 290 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c39eef2d4b..5f28e9017f 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4646,6 +4646,295 @@ testDomainFSTrim(virDomainPtr dom, } +static int +testDomainAttachDeviceLiveAndConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev) +{ + virDomainDiskDefPtr disk; + virDomainNetDefPtr net; + virDomainHostdevDefPtr hostdev; + virDomainControllerDefPtr controller; + virDomainHostdevDefPtr found; + virDomainLeaseDefPtr lease; + virDomainFSDefPtr fs; + virDomainRedirdevDefPtr redirdev; + virDomainShmemDefPtr shmem; + char mac[VIR_MAC_STRING_BUFLEN]; + + switch (dev->type) { + case VIR_DOMAIN_DEVICE_DISK: + disk =3D dev->data.disk; + if (virDomainDiskIndexByName(vmdef, disk->dst, true) >=3D 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("target %s already exists."), disk->dst); + return -1; + } + + if (virDomainDiskInsert(vmdef, disk) < 0) + return -1; + + dev->data.disk =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_CONTROLLER: + controller =3D dev->data.controller; + if (controller->idx !=3D -1 && + virDomainControllerFind(vmdef, controller->type, + controller->idx) >=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Target already exists")); + return -1; + } + + if (virDomainControllerInsert(vmdef, controller) < 0) + return -1; + + dev->data.controller =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_NET: + net =3D dev->data.net; + if (virDomainHasNet(vmdef, net)) { + virReportError(VIR_ERR_INVALID_ARG, + _("network device with mac %s already exist= s"), + virMacAddrFormat(&net->mac, mac)); + return -1; + } + + if (virDomainNetInsert(vmdef, net)) + return -1; + + dev->data.net =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_HOSTDEV: + hostdev =3D dev->data.hostdev; + if (virDomainHostdevFind(vmdef, hostdev, &found) >=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("device is already in the domain configur= ation")); + return -1; + } + + if (virDomainHostdevInsert(vmdef, hostdev) < 0) + return -1; + + dev->data.hostdev =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_LEASE: + lease =3D dev->data.lease; + if (virDomainLeaseIndex(vmdef, lease) >=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("Lease %s in lockspace %s already exists"= ), + lease->key, NULLSTR(lease->lockspace)); + return -1; + } + + if (virDomainLeaseInsert(vmdef, lease) < 0) + return -1; + + dev->data.lease =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_FS: + fs =3D dev->data.fs; + if (virDomainFSIndexByName(vmdef, fs->dst) >=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Target already exists")); + return -1; + } + + if (virDomainFSInsert(vmdef, fs) < 0) + return -1; + + dev->data.fs =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_RNG: + if (dev->data.rng->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TY= PE_NONE && + virDomainDefHasDeviceAddress(vmdef, &dev->data.rng->info))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("a device with the same address already e= xists ")); + return -1; + } + + if (VIR_APPEND_ELEMENT(vmdef->rngs, vmdef->nrngs, dev->data.rn= g) < 0) + return -1; + + dev->data.rng =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_MEMORY: + if (vmdef->nmems =3D=3D vmdef->mem.memory_slots) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("no free memory device slot available")); + return -1; + } + + vmdef->mem.cur_balloon +=3D dev->data.memory->size; + if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0) + return -1; + + dev->data.memory =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_REDIRDEV: + redirdev =3D dev->data.redirdev; + + if (VIR_APPEND_ELEMENT(vmdef->redirdevs, vmdef->nredirdevs, re= dirdev) < 0) + return -1; + + dev->data.redirdev =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_SHMEM: + shmem =3D dev->data.shmem; + if (virDomainShmemDefFind(vmdef, shmem) >=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("device is already in the domain configur= ation")); + return -1; + } + + if (virDomainShmemDefInsert(vmdef, shmem) < 0) + return -1; + + dev->data.shmem =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_WATCHDOG: + if (vmdef->watchdog) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain already has a watchdog")); + return -1; + } + VIR_STEAL_PTR(vmdef->watchdog, dev->data.watchdog); + break; + + case VIR_DOMAIN_DEVICE_INPUT: + if (VIR_APPEND_ELEMENT(vmdef->inputs, vmdef->ninputs, dev->dat= a.input) < 0) + return -1; + break; + + case VIR_DOMAIN_DEVICE_VSOCK: + if (vmdef->vsock) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain already has a vsock device")); + return -1; + } + VIR_STEAL_PTR(vmdef->vsock, dev->data.vsock); + break; + + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent attach of device is not supported= ")); + return -1; + } + + return 0; +} + + +typedef enum { + TEST_DEVICE_ATTACH =3D 0, + TEST_DEVICE_DETACH, + TEST_DEVICE_UPDATE, +} virTestDeviceOperation; + + +static int +testDomainDeviceOperation(testDriverPtr driver, + virTestDeviceOperation operation, + const char *xml, + const char *alias, + virDomainDefPtr def) +{ + virDomainDeviceDefPtr dev =3D NULL; + unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE; + int ret =3D -1; + + if (operation =3D=3D TEST_DEVICE_DETACH) + parse_flags |=3D VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; + + if (xml) { + if (!(dev =3D virDomainDeviceDefParse(xml, def, + driver->caps, driver->xmlopt, + NULL, parse_flags))) + goto cleanup; + } else if (alias) { + if (VIR_ALLOC(dev) < 0 || virDomainDefFindDevice(def, alias, dev, = true) < 0) + goto cleanup; + } + + switch (operation) { + case TEST_DEVICE_ATTACH: + if (testDomainAttachDeviceLiveAndConfig(def, dev) < 0) + goto cleanup; + break; + case TEST_DEVICE_DETACH: + break; + case TEST_DEVICE_UPDATE: + break; + } + + ret =3D 0; + cleanup: + if (xml) + virDomainDeviceDefFree(dev); + else + VIR_FREE(dev); + return ret; +} + + +static int +testDomainAttachDetachUpdateDevice(virDomainPtr dom, + virTestDeviceOperation operation, + const char *xml, + const char *alias, + unsigned int flags) +{ + testDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def; + virDomainDefPtr persistentDef; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto cleanup; + + if (persistentDef) { + if (testDomainDeviceOperation(driver, operation, xml, alias, persi= stentDef) < 0) + goto cleanup; + } + + if (def) { + if (testDomainDeviceOperation(driver, operation, xml, alias, def) = < 0) + goto cleanup; + } + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + +static int +testDomainAttachDeviceFlags(virDomainPtr dom, + const char *xml, + unsigned int flags) +{ + return testDomainAttachDetachUpdateDevice(dom, TEST_DEVICE_ATTACH, + xml, NULL, flags); +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -9450,6 +9739,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainFSFreeze =3D testDomainFSFreeze, /* 5.7.0 */ .domainFSThaw =3D testDomainFSThaw, /* 5.7.0 */ .domainFSTrim =3D testDomainFSTrim, /* 5.7.0 */ + .domainAttachDeviceFlags =3D testDomainAttachDeviceFlags, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ .domainGetDiskErrors =3D testDomainGetDiskErrors, /* 5.4.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801327; cv=none; d=zoho.com; s=zohoarc; b=ZIDxmfciJdh2vngNtKBfAqYas0Jnn6/KQGYG/4rD0fHLJCOw7Phnpwxo/LhKPtbrM2LSKBX6rzxoDcsegtA0RXJgwGGFPnL19RdVZyzZILKx3ZqkigfXc8AOLBOr8gfOSSO2s5YdO06VfVbBijgYxVH2p0MHZOQ1s+2jL2P7lrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801327; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/NrzAmDPsKHlpKXXWEWYWF9vuIWmYy2bnMyv5fQr8tg=; b=VABHVJrNUS3BWcY2FP5x/WD6UOXX55MCUsmKMG7osP6+kpuKy6vglbd+wbCUjeB2zpYEEelg9fwTTQoeHRCAGJde2qbY0wDiXAFv+NSGd9+HMgvZiPX+EKJ2Pm+YSQZtDML7SWBdGOL0BgUt834VTV/Cv0cvKhhrC98tnKAyG1Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801327610929.3960576747542; Wed, 14 Aug 2019 09:48:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C3BC309B693; Wed, 14 Aug 2019 16:48:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB9F183090; Wed, 14 Aug 2019 16:48:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A4D6C24F32; Wed, 14 Aug 2019 16:48:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGmiWI028119 for ; Wed, 14 Aug 2019 12:48:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 94966104C45F; Wed, 14 Aug 2019 16:48:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 854D6104B4FA for ; Wed, 14 Aug 2019 16:48:44 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB4685213C for ; Wed, 14 Aug 2019 16:48:43 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id j16so9485846wrr.8 for ; Wed, 14 Aug 2019 09:48:43 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.48.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s1sJ99xYmxbxg1JbqjnwGa1tvuvlqpK+p4XCQaIJrBI=; b=htTN2a+G1JwPvC8UdgylnWidS6gBjGulLPxaqtmAn0sysrbs0ES1iSP4t2/ReGQrLA +BiEnxr4MbbLIGyv107vsTtTER6FfF9jMSbPqLhjbSvA6IhSMjWgDxCSU73lfK1hChZl 8y1k3dcvr23Nz6r4qUzQA9z220A1hUT56dCHHsJLUcqnWxBtDJ5KQJJGfkzKPCKJPaAa Y6G3sZqfyM43Aaf7NNOy4TRkSkRmDZStsa4V7S6arRnmLRD7Kzm497u+a3T6brSZrne4 SYeNTwwXqUxKiEFtCu1DhflO8b2Cc+fifztE+HTi1P7jAHBSppqnb/Zyr6ihkBt+V7mw 4hbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s1sJ99xYmxbxg1JbqjnwGa1tvuvlqpK+p4XCQaIJrBI=; b=pSVPsEzs/9lXszFTNqDSj9TINYcLsLqoZLvPGd3Os2h+GeiTwNLUfc5cgEDJV9xO0A eDyiriIkVe1vLVkgXxy5lmxmIRzoU8LdQC6uQGmm7y7vg2kK2Grkb2Ir+TiZSrtW2HWa h8hIRY6TcrM/RbcaZOrpKIzfKf1sw8k3YHNEGh84B7bxxEcyZqC7sYaCYIEWQ4Lw/Nn0 EtQO1fuv3ey9psOEAzgmvoc7uDgB/yWTb8OnI07B2yNiEa6mI4Ue79bAcvW6GrVfNBSl YZ3kkHwYJLvAjGtOgZqbfuJzPbqC8pWZmarfxiIkdLKcxiyQsVYh9pX8W7nPJI/kDVxI eYOQ== X-Gm-Message-State: APjAAAW+wrQH8XVfwb3ahI5YD6fUwu77J+OHQo3j+i2CzJZefk4x42cR i1Ht6kTkzOeaK/vXplRd6LNp0TSWLmY= X-Google-Smtp-Source: APXvYqxdc2CTvJh7jgBSJe8YCUPin/srR7ArRkJ6W4jUocOQYB9vO9KEBIhdwbNM65iMUUj11Q5FKA== X-Received: by 2002:adf:ce04:: with SMTP id p4mr678471wrn.227.1565801322078; Wed, 14 Aug 2019 09:48:42 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:06 +0300 Message-Id: <20190814164709.5418-3-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Aug 2019 16:48:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Aug 2019 16:48:44 +0000 (UTC) for IP:'209.85.221.66' DOMAIN:'mail-wr1-f66.google.com' HELO:'mail-wr1-f66.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.505 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.221.66 mail-wr1-f66.google.com 209.85.221.66 mail-wr1-f66.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/6] test_driver: implement virDomainAttachDevice X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 14 Aug 2019 16:48:46 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5f28e9017f..abf80b97cf 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4935,6 +4935,14 @@ testDomainAttachDeviceFlags(virDomainPtr dom, } +static int +testDomainAttachDevice(virDomainPtr dom, + const char *xml) +{ + return testDomainAttachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE); +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -9739,6 +9747,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainFSFreeze =3D testDomainFSFreeze, /* 5.7.0 */ .domainFSThaw =3D testDomainFSThaw, /* 5.7.0 */ .domainFSTrim =3D testDomainFSTrim, /* 5.7.0 */ + .domainAttachDevice =3D testDomainAttachDevice, /* 5.7.0 */ .domainAttachDeviceFlags =3D testDomainAttachDeviceFlags, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801343; cv=none; d=zoho.com; s=zohoarc; b=H3zXIya8mmMHFO5zRF4DWYMfACh0o78m9yjiwrgMPWx6IkvIm6wFKy8PtzRzEDw37pFZN0UL64rUq5Li3c/OesPgfdRbQ5uoIB+98kUPJpwcnGYNGEhrOvEZpjBIGkCJU6t2ylj2wh4udMsGB6cUEsoWhpbEgpGHFwmq6tXFy5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801343; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ThVKwRbiN9RXJbvMtlpZDVSv27E0N7Y73S1/zjVHw/4=; b=JcvYQdRqTFLxL7VCmiZGoyRrNuRPtbdESwVICUeSb95ZAM57kumjOu0AIUspFJjajlz5ewhsg8WkLZp+VYETA5gMZWKw9pihwXZ2Wmy9Dbok/OmxW1P0ekAF0Y7xCbhNALwjg1IQCxdQOPR5HaXZyUhwr7TNkOLbK9P83p5LOnM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801343156967.36553229646; Wed, 14 Aug 2019 09:49:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8CB152136; Wed, 14 Aug 2019 16:49:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4E2883090; Wed, 14 Aug 2019 16:49:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7EB3218005A4; Wed, 14 Aug 2019 16:49:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGn0QH028151 for ; Wed, 14 Aug 2019 12:49:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 313D9909EA; Wed, 14 Aug 2019 16:49:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A932909E5 for ; Wed, 14 Aug 2019 16:48:57 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A84030BE7D9 for ; Wed, 14 Aug 2019 16:48:56 +0000 (UTC) Received: by mail-wr1-f47.google.com with SMTP id j16so9486435wrr.8 for ; Wed, 14 Aug 2019 09:48:56 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=x4fDwx2ochry1O9uhe4IXNuYAS/NTUTAYlYuQOziDiA=; b=BXmaqmuejdyZY8UVJkNV/W9Pj25c9mlVCAXUGmnGlPTY0Xf81dzTOyWAGaJyAr4JC1 XuCwNYCY7jBaPz3s8BL16asGNQAigk8ERXyjIdRHenKrgO3cApoqCv/f4UWwaOloPsQM IhMeF3iy/apLzW3X0iRtGyfh9NNLnfXmrwa+r5iNYrZ7E1q/X0MtQBJMDkg26pexjReS Rw/dAUeTioQ9FsyY2I4OX5yudLBGgKyjV2ng874sUDd/OVfg1nKBorrffV8TDV+Y8ZW3 vhHSl3iXy+/PL2bYGGt947GTzVfpczWXMCd0oxCV1MJhLvBKh7S2E26AGDZUgGVMyGUT 7tLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x4fDwx2ochry1O9uhe4IXNuYAS/NTUTAYlYuQOziDiA=; b=pd8yTiRwX5+TRabx5B53d2E2MqMD+dcdhnxYDdR0C2+ybwhF6SX0YM91n275QuMZIV QKhcOZW/PlrPZx2W+agJMUm2UUiP88Sxzq17iJ+ub8dXmTP8kh7332RXtHMq+6VL2vM0 ECZ/Onp7G/kILlZLKGBWgdkHHj2SU1tCXUvJ8kXRQxjyotvfq0MXPh0rte53sW2/pnbP kPXoUjUtkFdE0788k5Wdy6gIAvWyAfwoVNHgtEfX7Q9powJOlT0BLC9L/S0aEuY1uFuL wnlyS4QMnY0ec+n/x4WcxF7pshbybVmFPhmY2FOL2/X6uMXZ3FgEjHyy4G12GL3pOf43 7F8g== X-Gm-Message-State: APjAAAWTO31h/QjWgTRPNrpf8bIbkfkRjACJE2CLZJIgoiDiEHmtp3Zf RwPi+cUGISWntWzlt2f3bRrmSXU8d5o= X-Google-Smtp-Source: APXvYqz1QfewjQUIf1TaGsiXmBWDw5h72DcNaGkZspRu4Q0xwWqruBFoVk1TrDmGBrJHx8+Vri41cw== X-Received: by 2002:adf:e5c4:: with SMTP id a4mr720606wrn.87.1565801334907; Wed, 14 Aug 2019 09:48:54 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:07 +0300 Message-Id: <20190814164709.5418-4-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 14 Aug 2019 16:48:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 14 Aug 2019 16:48:56 +0000 (UTC) for IP:'209.85.221.47' DOMAIN:'mail-wr1-f47.google.com' HELO:'mail-wr1-f47.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.47 mail-wr1-f47.google.com 209.85.221.47 mail-wr1-f47.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/6] test_driver: implement virDomainDetachDeviceFlags X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Aug 2019 16:49:02 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 178 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index abf80b97cf..ff9693ccb7 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4834,6 +4834,171 @@ testDomainAttachDeviceLiveAndConfig(virDomainDefPtr= vmdef, } +static int +testDomainDetachDeviceLiveAndConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev) +{ + virDomainDiskDefPtr disk, detach; + virDomainHostdevDefPtr hostdev, det_hostdev; + virDomainControllerDefPtr cont, det_cont; + virDomainNetDefPtr net; + virDomainLeaseDefPtr lease, det_lease; + virDomainFSDefPtr fs; + virDomainMemoryDefPtr mem; + int idx; + + switch (dev->type) { + case VIR_DOMAIN_DEVICE_DISK: + disk =3D dev->data.disk; + if (!(detach =3D virDomainDiskRemoveByName(vmdef, disk->dst)))= { + virReportError(VIR_ERR_INVALID_ARG, + _("no target device %s"), disk->dst); + return -1; + } + virDomainDiskDefFree(detach); + break; + + case VIR_DOMAIN_DEVICE_CONTROLLER: + cont =3D dev->data.controller; + if ((idx =3D virDomainControllerFind(vmdef, cont->type, + cont->idx)) < 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("device not present in domain configurati= on")); + return -1; + } + det_cont =3D virDomainControllerRemove(vmdef, idx); + virDomainControllerDefFree(det_cont); + break; + + case VIR_DOMAIN_DEVICE_NET: + net =3D dev->data.net; + if ((idx =3D virDomainNetFindIdx(vmdef, net)) < 0) + return -1; + + /* this is guaranteed to succeed */ + virDomainNetDefFree(virDomainNetRemove(vmdef, idx)); + break; + + case VIR_DOMAIN_DEVICE_HOSTDEV: { + hostdev =3D dev->data.hostdev; + if ((idx =3D virDomainHostdevFind(vmdef, hostdev, &det_hostdev= )) < 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("device not present in domain configurati= on")); + return -1; + } + virDomainHostdevRemove(vmdef, idx); + virDomainHostdevDefFree(det_hostdev); + break; + } + + case VIR_DOMAIN_DEVICE_LEASE: + lease =3D dev->data.lease; + if (!(det_lease =3D virDomainLeaseRemove(vmdef, lease))) { + virReportError(VIR_ERR_DEVICE_MISSING, + _("Lease %s in lockspace %s does not exist"= ), + lease->key, NULLSTR(lease->lockspace)); + return -1; + } + virDomainLeaseDefFree(det_lease); + break; + + case VIR_DOMAIN_DEVICE_FS: + fs =3D dev->data.fs; + idx =3D virDomainFSIndexByName(vmdef, fs->dst); + if (idx < 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("no matching filesystem device was found"= )); + return -1; + } + + fs =3D virDomainFSRemove(vmdef, idx); + virDomainFSDefFree(fs); + break; + + case VIR_DOMAIN_DEVICE_RNG: + if ((idx =3D virDomainRNGFind(vmdef, dev->data.rng)) < 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("no matching RNG device was found")); + return -1; + } + + virDomainRNGDefFree(virDomainRNGRemove(vmdef, idx)); + break; + + case VIR_DOMAIN_DEVICE_MEMORY: + if ((idx =3D virDomainMemoryFindInactiveByDef(vmdef, + dev->data.memory))= < 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("matching memory device was not found")); + return -1; + } + mem =3D virDomainMemoryRemove(vmdef, idx); + vmdef->mem.cur_balloon -=3D mem->size; + virDomainMemoryDefFree(mem); + break; + + case VIR_DOMAIN_DEVICE_REDIRDEV: + if ((idx =3D virDomainRedirdevDefFind(vmdef, + dev->data.redirdev)) < 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("no matching redirdev was not found")); + return -1; + } + + virDomainRedirdevDefFree(virDomainRedirdevDefRemove(vmdef, idx= )); + break; + + case VIR_DOMAIN_DEVICE_SHMEM: + if ((idx =3D virDomainShmemDefFind(vmdef, dev->data.shmem)) < = 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("matching shmem device was not found")); + return -1; + } + + virDomainShmemDefFree(virDomainShmemDefRemove(vmdef, idx)); + break; + + + case VIR_DOMAIN_DEVICE_WATCHDOG: + if (!vmdef->watchdog) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("domain has no watchdog")); + return -1; + } + virDomainWatchdogDefFree(vmdef->watchdog); + vmdef->watchdog =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_INPUT: + if ((idx =3D virDomainInputDefFind(vmdef, dev->data.input)) < = 0) { + virReportError(VIR_ERR_DEVICE_MISSING, "%s", + _("matching input device not found")); + return -1; + } + VIR_DELETE_ELEMENT(vmdef->inputs, idx, vmdef->ninputs); + break; + + case VIR_DOMAIN_DEVICE_VSOCK: + if (!vmdef->vsock || + !virDomainVsockDefEquals(dev->data.vsock, vmdef->vsock)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("matching vsock device not found")); + return -1; + } + virDomainVsockDefFree(vmdef->vsock); + vmdef->vsock =3D NULL; + break; + + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent detach of device is not supported= ")); + return -1; + } + + return 0; +} + + typedef enum { TEST_DEVICE_ATTACH =3D 0, TEST_DEVICE_DETACH, @@ -4871,6 +5036,8 @@ testDomainDeviceOperation(testDriverPtr driver, goto cleanup; break; case TEST_DEVICE_DETACH: + if (testDomainDetachDeviceLiveAndConfig(def, dev) < 0) + goto cleanup; break; case TEST_DEVICE_UPDATE: break; @@ -4943,6 +5110,16 @@ testDomainAttachDevice(virDomainPtr dom, } +static int +testDomainDetachDeviceFlags(virDomainPtr dom, + const char *xml, + unsigned int flags) +{ + return testDomainAttachDetachUpdateDevice(dom, TEST_DEVICE_DETACH, + xml, NULL, flags); +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -9749,6 +9926,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainFSTrim =3D testDomainFSTrim, /* 5.7.0 */ .domainAttachDevice =3D testDomainAttachDevice, /* 5.7.0 */ .domainAttachDeviceFlags =3D testDomainAttachDeviceFlags, /* 5.7.0 */ + .domainDetachDeviceFlags =3D testDomainDetachDeviceFlags, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ .domainGetDiskErrors =3D testDomainGetDiskErrors, /* 5.4.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801357; cv=none; d=zoho.com; s=zohoarc; b=feOx+zysFVmpnVN0PS1KcuapfDvL0Qd/I0BrzaRXofJ+siysHGDPlXtEZU3uok5sUZ0u0zbUr1LB3mL+ug6biXyyhDGJTDwSt/2x5OuAFsski8mPiPUZXqhZQ/GXBkQR43Rg0Bsy3dU4q/l3pIyv27MmvrwGFNR4WpFg85aefQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801357; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ld+DVDbbqlmuWN3GTfkL8S+k6F40sKprG42YWFDkewU=; b=TYsJma5oCQtQS5A3Vxd++1SyUV2tQCaAolpP3Q+HEtio1EtvaG7d9OVeV3I//utv3a8dWg28p726Nu/LOe4yvkjTg/nxj6FQSVGtQSpFoKhTKP4fEbg50DR2dgMlz6/i7qiM5tC7BomdEv8Wnr2tJ5D5ZAtfISOkrCBIM/nqXSs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801357564864.1648676078811; Wed, 14 Aug 2019 09:49:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E22F3066FAC; Wed, 14 Aug 2019 16:49:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BEF77B6DC; Wed, 14 Aug 2019 16:49:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0503524F31; Wed, 14 Aug 2019 16:49:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGnELl028197 for ; Wed, 14 Aug 2019 12:49:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9488F80A51; Wed, 14 Aug 2019 16:49:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F64180A4C for ; Wed, 14 Aug 2019 16:49:10 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4C2C302C074 for ; Wed, 14 Aug 2019 16:49:09 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id g67so5059696wme.1 for ; Wed, 14 Aug 2019 09:49:09 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qTJI075MaStRnc6cav9xUAinPbx2AVLEEZ8eQGh9hSs=; b=QNrmtJ/4iwbr8yVVZfrQln0HaCTFJodL268bvE8olbaxTjmPyGTxn+/bzW8BTugH8+ EizBuI03wYUmhyklfWajCd2PcCBqVbmntPsz2HjHUse75Hgmz+aE3pN5TRB0nv70O7Un VHu5B8YcCz856nxJiye7q134Lk94jgCp3MKCI7fJPyRbuySRT3qUhDZQHPVn0IVRYeBS e57B+gA1k2D9Cf8d7acTmqFlpl1764qDaJoU1ac8OmHKvHf4hPeawQEbUMsVPyirGEiJ /+mK1PQOwYhMPxHk+85JVZ89UdrgdARk7jAfKfg+/SmIe06ZRxsS4/Uy0tA2RQgq3M4a w7qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qTJI075MaStRnc6cav9xUAinPbx2AVLEEZ8eQGh9hSs=; b=D2dBXOjH096DcsEQVrsVbtH9+wrJsfpqL3JWjaLN/gc9/EP05Xhvlo3AGLeehYY+k+ 1gnQiqVCRuVZBpJ9YsOGZVqw4FB4UzPXh+p95bCB/4v2Mp0w5B70p+1QQLMDNZmKgeHf weLsbeaONaLUsMV74t6XDI6cbDFDaIIDqwJJtqg81sojW+h5P6sKmnS8f4Al2a9cYB4K oRa+2SLvPFroztWouoDX3CNxPcxPK3mSQw4SZ2VkDrudB0rZjJ4h0yajxtsXblUgT3Jj UHhJSIzNBJoD7Ca0nmRNRspMMYq9jChvHFZQYTts7dE9Pn//C+H3F+eKpAh3aRq3Y0mX YXFg== X-Gm-Message-State: APjAAAUm6I46acPp9yo/ILyIrR+H5WxPJpT+Xt8FWGbseih04P1t0nwi s4pHDNnSwwqFLS6xFNCvoBgfx2OK+kU= X-Google-Smtp-Source: APXvYqxej8dLGvZr3qzDpx3oT7DAdIF1vDDspIBUS/yDf3t9XMAzR74mV1GPueJqk1RbGWl5D8L2PA== X-Received: by 2002:a1c:f914:: with SMTP id x20mr84107wmh.142.1565801347869; Wed, 14 Aug 2019 09:49:07 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:08 +0300 Message-Id: <20190814164709.5418-5-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 14 Aug 2019 16:49:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 14 Aug 2019 16:49:09 +0000 (UTC) for IP:'209.85.128.68' DOMAIN:'mail-wm1-f68.google.com' HELO:'mail-wm1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.505 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.128.68 mail-wm1-f68.google.com 209.85.128.68 mail-wm1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/6] test_driver: implement virDomainDetachDevice X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 14 Aug 2019 16:49:16 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ff9693ccb7..1152ca5bed 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5119,6 +5119,13 @@ testDomainDetachDeviceFlags(virDomainPtr dom, xml, NULL, flags); } +static int +testDomainDetachDevice(virDomainPtr dom, + const char *xml) +{ + return testDomainDetachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE); +} + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) @@ -9926,6 +9933,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainFSTrim =3D testDomainFSTrim, /* 5.7.0 */ .domainAttachDevice =3D testDomainAttachDevice, /* 5.7.0 */ .domainAttachDeviceFlags =3D testDomainAttachDeviceFlags, /* 5.7.0 */ + .domainDetachDevice =3D testDomainDetachDevice, /* 5.7.0 */ .domainDetachDeviceFlags =3D testDomainDetachDeviceFlags, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801385; cv=none; d=zoho.com; s=zohoarc; b=iNmUw3Ptg9wdwxL6vOOO1gUZs23nQJSM5Z9+DxeJ4UoiETSuHGDQ0+Lx91wvlJvB9/B9irrMIpZQ9C4UfqQEVZ41XFl1bnf/QRBJwBVBvZXbKwpoJLYfa07HVBxVIIdpI9BpALWHw1xrFXevJX2W2/bYdG/syu0zhX9WVmYJ9ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801385; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6KfFuRbz9pTXzucs3gL/3ktnkJOAWr4xsZYJb3iODwg=; b=HTH8wpR72reqWkMSz7LD41daM8zlb9NVuY5hzU3wvwr3DpI4n3Ryak/EBWrcrfzE4dVMJWxRG2djLMEJTXD0ba33VjamvxABzwBh1tfrww0P/5WVqt1RoWYD+9guG6fP/C6wtUfKxJBRg0lSWZ5zDf1PAcDvViHhRDDlMWhGMiY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801385697372.0971549827839; Wed, 14 Aug 2019 09:49:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84DC08E5A6; Wed, 14 Aug 2019 16:49:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 621F8900D4; Wed, 14 Aug 2019 16:49:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2D95C24F30; Wed, 14 Aug 2019 16:49:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGngr7028265 for ; Wed, 14 Aug 2019 12:49:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id BFEC28E7BD; Wed, 14 Aug 2019 16:49:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA2F3900BB for ; Wed, 14 Aug 2019 16:49:40 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4058C0546FF for ; Wed, 14 Aug 2019 16:49:39 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id y8so5802940wrn.10 for ; Wed, 14 Aug 2019 09:49:39 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.49.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GDUjrH632jWCwmpaIi8w3wzG7P5N4ahpnXgThAgCWyQ=; b=dUp0hbwQZYLtjrE8jpErPiYUzlM6SB/RUNc1Fa3GzEsyldlJdO/flkf2sVyRaiuzlW kIwW+TSQ1hi8XlvUSMj91ouLCxBx9XOt5F0Xkf1isEOU5PY4H7Wu0gHjynAgriQaZZUH yvykbeh7FkvYuarH57pZ0Qi2gR+KMFoBkT2bhSao+9ACfg6XftYfU8AcpHW9dHfaPptS mME1rV658Iws2KQPK9BOtbgtltT5EPbez2GH4ZG0M7/E983DI4NHvh/W6pvGAfIGGdxi Es+Xh7D3OhsvZWYWDu7aQYNyyb0xA71eZIWGPDuvoSDLcs8sgtfo4VJ7kjXJkSSmmWr3 tViA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GDUjrH632jWCwmpaIi8w3wzG7P5N4ahpnXgThAgCWyQ=; b=sxMA/3gZ25B4Im31E2lOIW1G4FwtzjSOcI2tiE6csqxEpftXIZ9u+9U2EW/N+0PS7A GIVUSkvGUhk04F601m4/lc7iWg/r95cqaJgMn20futqYWKdIiUygZD+JXpTSflgg6BTJ zKCA6I2bsuU/M5LVnJEDtasWRv/VoZUmAKHppHnckCfdCJ/a/LOargA7e+cGDwDHTmkN C9eJaJnN3wrfgEJrLSHYrqSp3oV7HbUaZuMLtQxbHExhLN8owftnk89MY6XvJQgtBBvf er5HJO/oGG7eS3iV8h+MWaetmApnAEIozOHkH4gY8G3zdfOfi5Y3e1iMcu61z1kc8Uvc x4EA== X-Gm-Message-State: APjAAAWaWsQzSTiLFvVV7EXrYY1+4zCpyW1n94+dOhhT5xm2pTQ0VFta qLzwIL89oyiMGW9kYAcSVbuiSngn150= X-Google-Smtp-Source: APXvYqzjuLCDjRFzMCZtumYCM/iaOgMuQT9C2I87pV9rfn7bEaShqhrniUW6rNxPma3e9saKzZ/EWg== X-Received: by 2002:adf:dc0f:: with SMTP id t15mr798044wri.50.1565801378009; Wed, 14 Aug 2019 09:49:38 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:09 +0300 Message-Id: <20190814164709.5418-6-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Aug 2019 16:49:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Aug 2019 16:49:39 +0000 (UTC) for IP:'209.85.221.65' DOMAIN:'mail-wr1-f65.google.com' HELO:'mail-wr1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.65 mail-wr1-f65.google.com 209.85.221.65 mail-wr1-f65.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/6] test_driver: implement virDomainDetachDeviceAlias X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 14 Aug 2019 16:49:45 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 1152ca5bed..e271bc58f8 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5119,6 +5119,17 @@ testDomainDetachDeviceFlags(virDomainPtr dom, xml, NULL, flags); } + +static int +testDomainDetachDeviceAlias(virDomainPtr dom, + const char *alias, + unsigned int flags) +{ + return testDomainAttachDetachUpdateDevice(dom, TEST_DEVICE_DETACH, + NULL, alias, flags); +} + + static int testDomainDetachDevice(virDomainPtr dom, const char *xml) @@ -9935,6 +9946,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainAttachDeviceFlags =3D testDomainAttachDeviceFlags, /* 5.7.0 */ .domainDetachDevice =3D testDomainDetachDevice, /* 5.7.0 */ .domainDetachDeviceFlags =3D testDomainDetachDeviceFlags, /* 5.7.0 */ + .domainDetachDeviceAlias =3D testDomainDetachDeviceAlias, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ .domainGetDiskErrors =3D testDomainGetDiskErrors, /* 5.4.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 04:27:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1565801428; cv=none; d=zoho.com; s=zohoarc; b=mKlepXehU86v+4ixBXJyvMDPOgcx3s0IDRdozxWIr6b6SzMoD44gGsfKpzxuKZX3d6sqqLzY3XfMZHaBujCfSA9efmu828S3NfimI7N3kUv7qrkiAV7kN7nwzLHC1YUBfA5TKPpi3N9P8yYwCUvYizfkFY6BQjmN7RDFyLzXUTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565801428; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6ma0uQQVQLGTy61DmgAEEFUVosb6Vh6EFgBTSIzw15s=; b=gQWbAmwBkpgpbyjIYoGEZIQRmcopdxWqPTKUuVjleRr4s8pXsFJWaK7pG+lqBtpVQw1GJZC5QHQtGiFBj5uCL8zuP4krIezfKstraVOVCFH9c0aQcoDKkyHZaXUZGmVmSuZv13ehiv6DEox9jNDBhdD1QClFOJJHaIKYklAe2iU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565801428605444.6958604537365; Wed, 14 Aug 2019 09:50:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8618D3174641; Wed, 14 Aug 2019 16:50:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6338740EEA; Wed, 14 Aug 2019 16:50:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 274D124F31; Wed, 14 Aug 2019 16:50:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7EGoPRg028313 for ; Wed, 14 Aug 2019 12:50:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 954058BE30; Wed, 14 Aug 2019 16:50:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E0D18BE2F for ; Wed, 14 Aug 2019 16:50:22 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDC0730622E8 for ; Wed, 14 Aug 2019 16:50:21 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id 207so5174680wma.1 for ; Wed, 14 Aug 2019 09:50:21 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id d20sm129372wmb.24.2019.08.14.09.50.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 09:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=sEr62YQlKBepbgLfCt7+FNNAJqioB/zqG7uJuHFb7KQ=; b=TM0jRKC3v4cV7fgc1B4KL9lRj82XnQRHeaQSOu38HVUnyKcc3D7OziDrHznTypCPIx IwcbbxcA//sqlDOL0KNKBAKPO9ip6ZEhnasiCOx7N7clPKE86vMqU0Yr76aawapGyLo3 P7z2HKmkA8yjELk8rq8SH0OBLgJz35b1EsyhnfUpH37D2nppFNgPXg4pcofEdBn1fzkj Ty7VcCSt8mCr/Bb2dPxfWSW5AaNknHET/F9Tmq8gKcYSH7/HVEyQCODV0KuguNg3k6aA D3VJ6medzOE94hX7ywgAaW0EqfmgOfuz/rcqbveG+vSpLntLcRRkKxEMmH/AYIX0gMpi x8PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sEr62YQlKBepbgLfCt7+FNNAJqioB/zqG7uJuHFb7KQ=; b=rd8o50oQTtOK/tnCd3Hf+WRs1WNB1nyp+g+EdPfuJZoOCB3OZZv2acCxjSN41VoKCw msFZY4bNHMEwuTWrAtHdzvDXYhf0hzfSagM51XfmUSXUgZ+OY8+zGrS4zaw40rVwFCsI DlY8C3A/WXdtCm6Knm/n9RtG2FKVgMjQDuOpPkkX/JGNpWuvRVcEFue5uis2apb60F99 0LWLxX6aUrHehbx0R542b+vZr/IZiZ4ZbQaqO1hyXecfCbrf9+xaMAX8Zm4BOSbzVzzp aZf7kLswcMDmzM1GtzN1e5uZr81gvG5rBPg6RzJSe5pK21AFJIYVmUi6DoH5SFZB+jMb NhVg== X-Gm-Message-State: APjAAAUIxi5tjKTEAKp2Aj0UnUA0+zxfoHnCuYpslxmEO2SU3ULrscgs QgXEiGMSc6ftGgzOTo4f5LMHDHLo+KQ= X-Google-Smtp-Source: APXvYqze0VM/jnCV4arnHzKtSeCHilfq02OX+1+EYC+GDzPDbKZF8ClzWCwIWxrO9JVniRFxwrsmug== X-Received: by 2002:a1c:7dc8:: with SMTP id y191mr97205wmc.78.1565801420298; Wed, 14 Aug 2019 09:50:20 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Wed, 14 Aug 2019 19:47:10 +0300 Message-Id: <20190814164709.5418-7-stamatis.iliass@gmail.com> In-Reply-To: <20190814164709.5418-1-stamatis.iliass@gmail.com> References: <20190814164709.5418-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 14 Aug 2019 16:50:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 14 Aug 2019 16:50:22 +0000 (UTC) for IP:'209.85.128.67' DOMAIN:'mail-wm1-f67.google.com' HELO:'mail-wm1-f67.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.505 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.128.67 mail-wm1-f67.google.com 209.85.128.67 mail-wm1-f67.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 6/6] test_driver: implement virDomainUpdateDeviceFlags X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Aug 2019 16:50:28 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index e271bc58f8..9bf3728654 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4999,6 +4999,65 @@ testDomainDetachDeviceLiveAndConfig(virDomainDefPtr = vmdef, } +static int +testDomainUpdateDeviceLiveAndConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev) +{ + virDomainDiskDefPtr newDisk; + virDomainDeviceDef oldDev =3D { .type =3D dev->type }; + virDomainNetDefPtr net; + int idx; + int ret =3D -1; + + switch (dev->type) { + case VIR_DOMAIN_DEVICE_DISK: + newDisk =3D dev->data.disk; + if ((idx =3D virDomainDiskIndexByName(vmdef, newDisk->dst, fal= se)) < 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("target %s doesn't exist."), newDisk->dst= ); + return -1; + } + + oldDev.data.disk =3D vmdef->disks[idx]; + if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev, + VIR_DOMAIN_DEVICE_ACTION_UPDA= TE, + false) < 0) + return -1; + + virDomainDiskDefFree(vmdef->disks[idx]); + vmdef->disks[idx] =3D newDisk; + dev->data.disk =3D NULL; + break; + + case VIR_DOMAIN_DEVICE_NET: + net =3D dev->data.net; + if ((idx =3D virDomainNetFindIdx(vmdef, net)) < 0) + goto cleanup; + + oldDev.data.net =3D vmdef->nets[idx]; + if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev, + VIR_DOMAIN_DEVICE_ACTION_UPDA= TE, + false) < 0) + return -1; + + virDomainNetDefFree(vmdef->nets[idx]); + vmdef->nets[idx] =3D net; + dev->data.net =3D NULL; + ret =3D 0; + break; + + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("neither persistent nor live update of device= is supported")); + goto cleanup; + } + + ret =3D 0; + cleanup: + return ret; +} + + typedef enum { TEST_DEVICE_ATTACH =3D 0, TEST_DEVICE_DETACH, @@ -5040,6 +5099,8 @@ testDomainDeviceOperation(testDriverPtr driver, goto cleanup; break; case TEST_DEVICE_UPDATE: + if (testDomainUpdateDeviceLiveAndConfig(def, dev) < 0) + goto cleanup; break; } @@ -5138,6 +5199,16 @@ testDomainDetachDevice(virDomainPtr dom, } +static int +testDomainUpdateDeviceFlags(virDomainPtr dom, + const char *xml, + unsigned int flags) +{ + return testDomainAttachDetachUpdateDevice(dom, TEST_DEVICE_UPDATE, + xml, NULL, flags); +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -9947,6 +10018,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainDetachDevice =3D testDomainDetachDevice, /* 5.7.0 */ .domainDetachDeviceFlags =3D testDomainDetachDeviceFlags, /* 5.7.0 */ .domainDetachDeviceAlias =3D testDomainDetachDeviceAlias, /* 5.7.0 */ + .domainUpdateDeviceFlags =3D testDomainUpdateDeviceFlags, /* 5.7.0 */ .domainGetAutostart =3D testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart =3D testDomainSetAutostart, /* 0.3.2 */ .domainGetDiskErrors =3D testDomainGetDiskErrors, /* 5.4.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list