From nobody Mon Feb 9 13:36:59 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=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