From nobody Mon Feb 9 02:12:26 2026 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=1564664259; cv=none; d=zoho.com; s=zohoarc; b=G2zBsd3tJVOdMcwIeKVhLqnsy9c+rhyB5q648FWQbISDyg+Vm8TVHTwBSf5sfHQ89nuH/JwrFx0Jq292WJMf6y+h/tXKCz5Q62nCrcEahOFdJ1zATLesnRDoYi9I/Qs1r1lMWxQgGfeZUccHk8kv473ZowryBk4T26ghR2fYhig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664259; 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=/Zqp53KcPqwjnA3AKKIJ97LG9Mpd5xs+WTWHqJGxyck=; b=XmdH8s1QI2fFDCQehrIZxc530EzcsVv2GTYafsLZiKAXyzOxndwRLrCahXo1ic99oWiG+5YYB9OF1LqWa8mCMQYQFvpGQCTw2B4hLlUaIMmkDXxgHp4E2QoQ/cn3IuT6wphSM7csguvC7jYU/oEMHGkTutI2sGpKhYUoXA9PEvQ= 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 1564664259348757.1144973887593; Thu, 1 Aug 2019 05:57:39 -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 1C62913A82; Thu, 1 Aug 2019 12:57:38 +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 E51375D704; Thu, 1 Aug 2019 12:57:37 +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 AB7341972F; Thu, 1 Aug 2019 12:57:37 +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 x71CvarK006708 for ; Thu, 1 Aug 2019 08:57:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 235915D9E2; Thu, 1 Aug 2019 12:57:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E80E5D9CD for ; Thu, 1 Aug 2019 12:57:33 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.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 ED3BF8F91B for ; Thu, 1 Aug 2019 12:57:32 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id x1so23586975wrr.9 for ; Thu, 01 Aug 2019 05:57:32 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id h14sm71248878wrs.66.2019.08.01.05.57.30 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:57:30 -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=wqrzljOvoi2MbeObGi90vFiKiUA3FO9ZMu1uTe5wwxM=; b=olF3bBrjUMyh09UQ4zwlT3MPhRjWvZc/jrzV3SPnuQ6EijWfvgtGIq9PsNLYDfJS0p 97DPF64PIUDdCQVL3IiUMJ5gpTJfG0qzGmV7I8EPePYZ2Stx1Evyj9aZDb8Ii+CbYxN6 Sa2t3Ej18AHA04zMDLllFSPJZqg29kNsocsom8r5Mg1wCF07sHTIMP1r5riEk+PjTa6Y c+DE2Pc4KY7pgOKpYvI49ni9CZyThszt29mtDES5hA9i949uqLMTCEV8sWnP54xyoXn9 NATCWCwghBZuuBzvFLIfrYgSsGengtJdTwXOyEzovpNqyzKdOFqtzVl7jsUuIliIyowp X1pg== 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=wqrzljOvoi2MbeObGi90vFiKiUA3FO9ZMu1uTe5wwxM=; b=jA3Iy7kExUcCLPrVMvrHsUdsktrJPWl4LgdAoWe9L48FS1ZRwxdIiHd6NZe7ntD4Y8 ymj7vAg92udihWgQQpWSq6z67R7gh+kCMK/DwWzQ+dR9f66Z8LDr+ddzr4ysHZmBOqfB AMLinSfjaTWOh4JGGEjK2vqNDdrrWdRL5gmmEw+U8Nk+D8vXH3c4A80xHDr00W8emHRQ 79Uhn5uIBPBlS1QvpCFaB4ON/hztqrLvRU0eFLuCWbcIMWMMGZQRCaz9dNCDoodNDfMr AePDOwCa7kUAteqy69FPLrT5st5/tkqeQgR6LC7WWstvQ8Myn3Q1BWj9oDPucOo3Ngc9 MNyw== X-Gm-Message-State: APjAAAWU2ylDMA7jSiJVIdSFhizmMXRaPy52on/e2rjMXJXEkzaKynR7 4/NXQvvGZ19RoU97Ql/lBZh8GsJTkY7K7Q== X-Google-Smtp-Source: APXvYqytcE2LbSEnXtKsUOwxsOdVgthR9WaezaZrCtifu+LkIvfVbcX0kFZ9dk5XWAKECL7X0sXm5w== X-Received: by 2002:adf:fc0c:: with SMTP id i12mr15335419wrr.86.1564664251234; Thu, 01 Aug 2019 05:57:31 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:53 +0200 Message-Id: <20190801125453.27030-7-stamatis.iliass@gmail.com> In-Reply-To: <20190801125453.27030-1-stamatis.iliass@gmail.com> References: <20190801125453.27030-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.26]); Thu, 01 Aug 2019 12:57:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 01 Aug 2019 12:57:33 +0000 (UTC) for IP:'209.85.221.67' DOMAIN:'mail-wr1-f67.google.com' HELO:'mail-wr1-f67.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.1 (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.67 mail-wr1-f67.google.com 209.85.221.67 mail-wr1-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.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.29]); Thu, 01 Aug 2019 12:57:38 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis --- 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 cffd60c75c..228e24b0ae 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4367,6 +4367,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, @@ -4408,6 +4467,8 @@ testDomainDeviceOperation(testDriverPtr driver, goto cleanup; break; case TEST_DEVICE_UPDATE: + if (testDomainUpdateDeviceLiveAndConfig(def, dev) < 0) + goto cleanup; break; } @@ -4506,6 +4567,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) { @@ -9157,6 +9228,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