From nobody Mon May 20 00:56:23 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=1564664203; cv=none; d=zoho.com; s=zohoarc; b=HY1QZSAghqwJOA3kqGvU3afkdW+9f7AQ09PWRXqPGEOL5SKwRmdDF+tHC8rMM2gbgZvXu64H7ARCdpVAboIlFOWRD/BohTtNB8b/k1Ow9ieiCcS7Mo87YTx29th6zO7OB350fny0WqCUYTTcddkJmnFNGj9fhq/FaCIFnStakM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664203; 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=nrRvo0Xlxo9Om2dxh3B687tW9+Teob+XQ39pEIVUnf8=; b=NYmgRkE9fwWzWHMPjkF0JIw+u/qnXsKsF2YjvrXogloKmZIG/013ah+oZo4QK7IFHTBeOaYUN+yNejttrQ1ZwUPfwBxRb09YEBG800NnLvtGFA8FVgLRcCRwRQC10IG7Xdgm4xPkxLhHPSmpQkuDMsrq7q1XWdxtaGY2gynh1g0= 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 1564664203817517.7672883288404; Thu, 1 Aug 2019 05:56:43 -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 735FDC01FBD9; Thu, 1 Aug 2019 12:56:42 +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 22E545D6B2; Thu, 1 Aug 2019 12:56:42 +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 DD265180B536; Thu, 1 Aug 2019 12:56:41 +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 x71CufEa005922 for ; Thu, 1 Aug 2019 08:56:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 546F25D9CD; Thu, 1 Aug 2019 12:56:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E2C85D9CA for ; Thu, 1 Aug 2019 12:56:39 +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 97F0530C1321 for ; Thu, 1 Aug 2019 12:56:37 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id c2so70264712wrm.8 for ; Thu, 01 Aug 2019 05:56:37 -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.56.34 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:56:34 -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=4Ox6ZdQ/Mu7zatKJT9BHM7d32mVFGUUrxHEVNdSwmAU=; b=B93lxmVDvwObs7ADD0SV8fG48VGdBETAvk8OVsGdAGXKj3hcwWgyCfyf+sODbYDdt6 0ScjKUFM6A0hs43XCxGywJtYRhOzEKdvby1OAY4FmpXAfdfnpwobqIOrhC0ra21LhEtC 7YtR+j972U043CnMoj1cFGgYW8rBxXboPFdUx1vggU/AFbyBNl/oIY0hSr1P+G3b93MJ Jgb5KcKjeal6Z/t5xKqpWY3hFzgbKjb14FJVtuAg2sPMxpcrKuYSGq8zfh/Ph0cqdLSa aIVp811YC1Y2sy50i5VLqDqVnkBcA2+OcKmKy44C/LLFqAavOly8chTwwg/mJ/rIjCTQ 3cJA== 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=4Ox6ZdQ/Mu7zatKJT9BHM7d32mVFGUUrxHEVNdSwmAU=; b=QGkeGG5VN1a59Qvka+yvqeQz0GDmmvZwUspU4OXIt0k7hWyM1ojwq/5V0P+noiIqa1 prbcPB0Twct9U4MHcYvR7LWTe/7WZsTbQRGBoMVurM9rPGMSmMVy7CuWfvrAoHye49jT /qe0Hf2vFfynUZoYEG0ahZ+UGuljvdZ1VL5wXOBJ1lH07eHHlA7UMZwQuKuLRvf4rN9B PzBGBbGbXc+uMAtX4wbbVbeuTnbaRm7nvjMM75IE7yh6VVkdd+XCWpTILrAgRawdNO1T K6nZB48aka+tEfAaoKhQ7h7LYUNLeHXWLpiO6DhmiSgOv2teJZJ9Z09zJNofDSCkJLl4 2atg== X-Gm-Message-State: APjAAAW5D1WiaFotF0ml1r1TvkFFgtyTZVna3cJ6n0xVHlErajn9rxj9 PVkBld9Xm3dAUSfw5sGrN58It0N3g4gCHw== X-Google-Smtp-Source: APXvYqzSikdEZhX0XLQzvjLYV+yYukUeTTXTZ3TwOh0dDAoy7zYVSlx9HExehLpm1NIl7OfMo5KCbQ== X-Received: by 2002:a5d:4206:: with SMTP id n6mr73709330wrq.110.1564664195767; Thu, 01 Aug 2019 05:56:35 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:48 +0200 Message-Id: <20190801125453.27030-2-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.45]); Thu, 01 Aug 2019 12:56:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 01 Aug 2019 12:56:38 +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.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 01 Aug 2019 12:56:43 +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 | 290 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 290 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index aae9875194..c8aad6a0bb 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4013,6 +4013,295 @@ static int testDomainUndefine(virDomainPtr domain) return testDomainUndefineFlags(domain, 0); } + +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, + 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) { @@ -8659,6 +8948,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainDefineXMLFlags =3D testDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine =3D testDomainUndefine, /* 0.1.11 */ .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ + .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 Mon May 20 00:56:23 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=1564664217; cv=none; d=zoho.com; s=zohoarc; b=XjM5ZN1y+UV4IJT1y/aEdeLXnFRE0zrG6j2Urx8YzFI8DDuSPSFlJn5egdPb/u9uNgyRELPlUYJRm2KSPhJcN3n/a0y7a+og9BxFDbGkOyX9ZWzChSziU4FesdxBjAs2EcSAZRXr+/xVpezAoe/wJ05uBihTZmLPxPNM4I6SEp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664217; 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=sWqyH/tRWXFlt9sOZDxVeN1abcb2ikX+HMNrnHu3rhs=; b=hddteBOW+eYfhC4kngsNKMioZmAThuoxP3suiTXhIOV9iaTn8fKpMKqy75FXjijWNlweWqn2LRxOo7f04XP6HWEJOK3JPIP+fUv5CgFvqfv5zJxaO89sl3qgdDEUIP9VvlmBRoD4d19sx8s9JK75In9C2oo92cIUgbRXJtl+WR4= 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 1564664217110595.878881122653; Thu, 1 Aug 2019 05:56:57 -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 A69E0307D989; Thu, 1 Aug 2019 12:56:55 +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 728CE19C70; Thu, 1 Aug 2019 12:56:55 +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 2D76D264C9; Thu, 1 Aug 2019 12:56:55 +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 x71CurX1006271 for ; Thu, 1 Aug 2019 08:56:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id E7EDE60BE0; Thu, 1 Aug 2019 12:56:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1EBB60BEC for ; Thu, 1 Aug 2019 12:56:51 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.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 9C07F3082A6C for ; Thu, 1 Aug 2019 12:56:50 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id r1so73460369wrl.7 for ; Thu, 01 Aug 2019 05:56:50 -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.56.47 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:56:48 -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=dRPhwDY+VnZxGFGOdh4sOHKmgzLb8cIf3/al26oGUV8=; b=IV9vevR9glAYVIlvSHOnYbN1CvGDRb224V7nwwd8vlhbaZVt1RNaaPcAK8Wk75kxX0 tBblsEx+DgTXug7+fwMqjoNHxrfymeC9bOJRm4bBIsMHwZ9jpet48b1pn7rAyerbycWk lbSMNzHP8a8eW1oRM/WNd319tLXNQ0ti7Kogtb9sk5jm476Mh+J81SihS+/AvsHsipJd ndeOWj9YAn915+A+4CMrQuYOe29X+Xu/tGdqFCIDJKLrsdcxqkBhMn+8s330+syGQu6O /y40ldsEyoEzpJUfNkSTYnHwK0l1auDaxt7m/1TTxQv5HlM9gziGpa8sho9dhtikGhIg xmCQ== 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=dRPhwDY+VnZxGFGOdh4sOHKmgzLb8cIf3/al26oGUV8=; b=brJc6orsFir7rdCuNRJtd/Drvczwwb8pajkGBcsUpGDAApX/CyXKSsEtaS80TDu3Ni qmMoACLnAiM+/8FIBzLkNcD0JRyhr1m7CYRlfgHqYxlU5oFu0VnqbEh0p7hK/g0jloVL OF2kAOuNNbfpu6YaC2sJqj4sRQ5UOqKiFIJ/awdQ0zJTbndiHSzLnsfuuS7OcmhptWRU s55tl94bcIRU+a531J9d+ZCiLrT3++GmQ6oJK+Xrdzu8dYyjqMg26uNhRBun7bNzYrDz Rr/QG6qEuGHNs2Sk1F8w+gvhCPFYVDzMdXtKVzQjIeBJ53Iq38tXxNV6SfM4qFIMIgAV OpxQ== X-Gm-Message-State: APjAAAVWm3RrGnuHbi9NVqTlbHs7YocYiAaqOPg/OhILvrHqqmkfdIX/ HWizF9q2sdrJFaRGVO+tZEj+KxPvAIPtFA== X-Google-Smtp-Source: APXvYqwhoAMz+p2Oz+KRaMYENRoWgD0XU1f5xi8lA3e5jLWQ/kux4zduTmGcmR1VBH6uQWftM3allg== X-Received: by 2002:adf:fe4f:: with SMTP id m15mr65467147wrs.36.1564664208925; Thu, 01 Aug 2019 05:56:48 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:49 +0200 Message-Id: <20190801125453.27030-3-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.45]); Thu, 01 Aug 2019 12:56:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 01 Aug 2019 12:56:50 +0000 (UTC) for IP:'209.85.221.68' DOMAIN:'mail-wr1-f68.google.com' HELO:'mail-wr1-f68.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.68 mail-wr1-f68.google.com 209.85.221.68 mail-wr1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.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.48]); Thu, 01 Aug 2019 12:56:56 +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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c8aad6a0bb..784622985c 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4302,6 +4302,15 @@ testDomainAttachDeviceFlags(virDomainPtr dom, xml, NULL, flags); } + +static int +testDomainAttachDevice(virDomainPtr dom, + const char *xml) +{ + return testDomainAttachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE); +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -8948,6 +8957,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainDefineXMLFlags =3D testDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine =3D testDomainUndefine, /* 0.1.11 */ .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ + .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 Mon May 20 00:56:23 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=1564664228; cv=none; d=zoho.com; s=zohoarc; b=neGz4/LH38UmyCk0vK0hywoilnP05zoqGJiVLMNT9cxCfvACUaNvb492u8g7ght1C25DWX+kFyTPmjGnyYOU5Og3tSfQNT1xJQKkKerlBJ57h47QZlsdI2YOPjGdbumw/NCTVNiBE2y5zVb2YR6upBEdOR5M+IOIGzSH7QvsZHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664228; 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=XoxrhD++H9ySaplMOCHxmxpN6nl4qlpeVNykoXZEzPc=; b=eQTnAQjtLDqOPRSlBqTPF1EIpdU5ZFN/Dgswcg87UQEMgCx8usZgNaOwSLnCdpSyxvpYKlqZbQo5jM2FivG04oWGzvSyV38757KnUS+FDMPwz8ha8ZwGrOnzYO8LItVt9RJNk0XDpvSPE3vFIH8Cf8dy2jEY9ZdCldHJzkt3lUA= 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 1564664228892817.6138652802563; Thu, 1 Aug 2019 05:57:08 -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 AA744C04959E; Thu, 1 Aug 2019 12:57:07 +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 84EF760BF4; Thu, 1 Aug 2019 12:57:07 +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 4C590180B7B0; Thu, 1 Aug 2019 12:57:07 +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 x71Cv5J3006286 for ; Thu, 1 Aug 2019 08:57:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id B73926012C; Thu, 1 Aug 2019 12:57:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0B6B600F8 for ; Thu, 1 Aug 2019 12:57:03 +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 E5C872CE905 for ; Thu, 1 Aug 2019 12:57:01 +0000 (UTC) Received: by mail-wr1-f47.google.com with SMTP id p17so73466783wrf.11 for ; Thu, 01 Aug 2019 05:57:01 -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.56.59 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:56:59 -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=mdF06v1cAfkWOB6ahEJPwAKKuAI/2MCdtOlwB/vvp88=; b=LkrzAuNg/Qia4VWbE0ZkE84HncxHqqJL61rTTDOI5Dp43ea9247VSMlInAgpJ1ylej 256Y+MaJooLFvWddl2WZUjMEgrL1dK3l2oxftZsw+/CNnowQJmgMSEo6ge20FXi+Q24E NHS6XaWhD8tIVc+QG1HCugoKuXexbLpfDUl3WR7WjiNeKJVbLwKeldQu+EctaVFOq8YF dY9dNzDs6lirc9EU9dlViuN5/g5Fxt24cJU3zjDQnPmRgNQslI/fdYMapz9RZR7vvlGM pYps7uT774GITWScllddDrWvrn6b0l+Xai/lTO3Eys1H0DRtrVW2tep+KMX5ONhk4txy /pcw== 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=mdF06v1cAfkWOB6ahEJPwAKKuAI/2MCdtOlwB/vvp88=; b=Jb7x/RVD9fGnC8dqU1DfEiKkWjGFVV8HJnO6UvjkE0BLjHbu7tY7K2lxeGPiaiXtqZ RC+OxuQ3txhi0QhD8rSTRy5ZK1gmrqUOaRz8ufhlhKW2JlsVJBM7TgEi/14T/roEE56P p7Tw3hk1NRJzvnz4A+YQXUc3DeoO0W8sjYwsOaryn+yQ8ylgv0h/j22UazoSQg8W5QPJ 035wRoupRr0Xx/CAhUSrnwo9S1+X+I6siUwpfUU7tck7dK/DhJjeYglZZKdML9d1EDCo AC0z2zsCEZEVal1XzWRIjaVTlGdpJfVgl0Vqlr86wD7CdmaZgyR4ztIjkd9kF8+3vFLq 8qRQ== X-Gm-Message-State: APjAAAWXPpsXCDDB22GpNDd3+RUaWJdLgHRtWR0/9yW5QJ6iXQ3ObhRO B3AgBw2UDbPNFAc8ytX/LSvld4J0m67Ziw== X-Google-Smtp-Source: APXvYqz/Zrx76BXfxO2alVaI5VXqLxXhTdGq9ngKLpT70spkPpJdBr3k4mBKKBb7VBryiHBHtDKZ6w== X-Received: by 2002:adf:e552:: with SMTP id z18mr144459693wrm.45.1564664220176; Thu, 01 Aug 2019 05:57:00 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:50 +0200 Message-Id: <20190801125453.27030-4-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.29]); Thu, 01 Aug 2019 12:57:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 01 Aug 2019 12:57:02 +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.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 01 Aug 2019 12:57:08 +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 | 178 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 784622985c..1d371a5832 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4202,6 +4202,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, @@ -4239,6 +4404,8 @@ testDomainDeviceOperation(testDriverPtr driver, goto cleanup; break; case TEST_DEVICE_DETACH: + if (testDomainDetachDeviceLiveAndConfig(def, dev) < 0) + goto cleanup; break; case TEST_DEVICE_UPDATE: break; @@ -4311,6 +4478,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) { @@ -8959,6 +9136,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ .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 Mon May 20 00:56:23 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=1564664236; cv=none; d=zoho.com; s=zohoarc; b=Q2Q3A1MDpChFCmuM4UwdygJZdz+6ad+dEo4FzLM4UXNmTu9QZTN9Tndc83yItxEFmgj+tSSK5mY4Ygy/nKMA8872vgiqlH1jJd7ALR+bYMazka4Gnfyveed9QXV1DaqP4L5AGd9y87whi2PHdEMAp/SQONNZp3nzTY3imMHlAjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664236; 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=qiLxr5L1JQf3tSebrmZMAefli4IepFf1Z40QGwx3Rro=; b=KPDYKXUUwwvScfnOP0Dcuh4PGRU6dDF6b4igm7Upah8m//432pbZ4JRn5fU91s05nNrq1OasIPj3CWWjDXUJ22EdiQ32/yYx6Tp5f5/Ypvh0fXnwiP7hhBgeW34KPV6jtxguyXrVyLQO/mhC8a/ZuUpTXfaOhVQSBh4VRmGGpFM= 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 1564664236507552.1384537517916; Thu, 1 Aug 2019 05:57:16 -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 6E3A4307D847; Thu, 1 Aug 2019 12:57:15 +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 4502B5C205; Thu, 1 Aug 2019 12:57:15 +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 084B6180BA9B; Thu, 1 Aug 2019 12:57:15 +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 x71CvDNO006476 for ; Thu, 1 Aug 2019 08:57:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D8C7600F8; Thu, 1 Aug 2019 12:57:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87AD2600C4 for ; Thu, 1 Aug 2019 12:57:13 +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 D1E4E307D965 for ; Thu, 1 Aug 2019 12:57:12 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id h19so3612918wme.0 for ; Thu, 01 Aug 2019 05:57:12 -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.10 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:57:10 -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=CBO1jztugy5YKYhIpR57DbHJrJAt7KOpSFJPuFEOEK8=; b=Im6ifYhIckVehN9Tt0/LzZzv0vXRwMyHD4o4O4BRQL0GAhxoKkR7zML70nBQyhNoWV UkurKdHOULc/77r+/oJK4sBD4zTf/O73qQGNoGrUrsgX0cpon+Wcat8MkhHnGuad2ybE iaHnoyonUtWY19OLGwWd4FHghBmLHz9ZURXrzPiB/9M3vD2u4KmmOIgLyZtn/H+4DN9M cmqUmmuMYBqpxQUMZL8QoMcPUu0Kac6HroKD7yjrxnPgGxn+2w3J63KO1MF6QFRtlOyM CX9L4NEd5Wx9TH/kOCLIsGJbpyc379sya15bcJWTwJe/lDxyONqk1jFFNUDNyBrt3Xfx f5pA== 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=CBO1jztugy5YKYhIpR57DbHJrJAt7KOpSFJPuFEOEK8=; b=CfPL4eSkpTv7RYd0/J4SBvxpP+Gv8tcWA8HgAQ6ddJyQwkNZwm+vyHObUyefWYwMP0 xAsUdssaZxtQyGlNYhjHkOsbRC+fz+96E6EEeLAFu340e+u5DXlHs+Kvfkvkt6rZySBJ 70nJwzSJXozVmi3dES++Vp7XaC1l735dXjqrFmXv0Lo4pxtsmHdepJmUmtICs5d9CKvT aLtevbbcnzv/1cA4NHRKA+MgZymgDFoOsL8260KmeKUgv3T2nY+MDwgqmVIG9Mcp+cq8 tax2UFf+DioLMbpPUAGA0I/3NwTOLmDdzPCjGGZO9C/dUc/2j/QR4c+Af0GRxFxRaTBq 47wA== X-Gm-Message-State: APjAAAW5x6TdOWTi5lDtajTX/ogN4uLmH39hgoWkJKIBK+bqjL1dcgxX CWFUVSZvY7jFgRK6zk+apj26UylZXiLgUg== X-Google-Smtp-Source: APXvYqwMz8GNNbTdO68zMoxgDypRJpIJo0t54gg4+6RA/ID3DjtrR02Fiu8UX218aeFHDXSN8I9v6g== X-Received: by 2002:a1c:f409:: with SMTP id z9mr46162042wma.176.1564664231094; Thu, 01 Aug 2019 05:57:11 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:51 +0200 Message-Id: <20190801125453.27030-5-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.48]); Thu, 01 Aug 2019 12:57:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 01 Aug 2019 12:57:13 +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.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.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.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.48]); Thu, 01 Aug 2019 12:57:15 +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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 1d371a5832..de449d89fb 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4487,6 +4487,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) @@ -9136,6 +9143,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ .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 Mon May 20 00:56:23 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=1564664246; cv=none; d=zoho.com; s=zohoarc; b=gAAKy5Uy/qrD3/XmoptnwY0dabpnudUWygIRHCRHcni3LsfFC7qco2bugCpFYtMRDKDzsuZoIEqaMspdqTsW4cTigDBxtXC/UWAPGYOu6tHvMy4XOendTn1Ky5p3Zl0MHpZ1bHT19PSoQDi1GZEqTZSjNjeAcbwBhDFoicWodEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564664246; 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=quPLlurw3rcezgtMXKCR021Qjb2JxAm5gGs12Z/ZUOk=; b=gtsnzvI8p63dh/scAcEAyYM8nGileqHYuIsaxOX8kLwiIxX9mtS/8tLfEPGz4niqNBaZ8+lxKyT5GOCxwwYMY9sK+bYRl0yjjBmiGn2CJZWpSsPBSXUdzPSL5f7+tdpKROSBYX1/LT19SKKMtrCWUgPsLCDr0U5jX8xAHB0FIm0= 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 156466424685255.07663157975924; Thu, 1 Aug 2019 05:57:26 -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 CCB753082E10; Thu, 1 Aug 2019 12:57:25 +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 992BF19C65; Thu, 1 Aug 2019 12:57:25 +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 587E61972D; Thu, 1 Aug 2019 12:57:25 +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 x71CvOLp006655 for ; Thu, 1 Aug 2019 08:57:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 309111001938; Thu, 1 Aug 2019 12:57:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A1F510016EA for ; Thu, 1 Aug 2019 12:57:21 +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 2CA3560CC for ; Thu, 1 Aug 2019 12:57:21 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id f17so63076356wme.2 for ; Thu, 01 Aug 2019 05:57:21 -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.18 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 05:57:18 -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=m/BMf89k/KIkj3aZ7FvvqKPBAA4vTdn/Wi27p53rHBI=; b=jnJuuHbhnN8iJMRPbjyU+cVymOvTRZE9+9QrsA81nfXVWtlXFPRVP49DBa6JfzItQF X9uujxVEjxhSUqCZmAwL3+HlsimgndD7sx9cszppfOzJ0SW1tiBkDmJ3NQIrm6GMcDL6 o+ozru0jyDweph70B8fVWYszt5y/dZWyh0n4z1Z/KFbcuFvHzKbbBc8kXpPh2KncFSjy G60hu01bOd9jMAQ39puupnnwjZ4pWETNr8kKGQqYstXkIX7mEkVmD+atNvYdPHLUM5Sw zwhX0fY58PVXUhu3L3yUiONxpSZ12gcyyTjV5rwPPBi8gq4U6GK7FKGJuv8Lg2M1Otc8 OjSA== 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=m/BMf89k/KIkj3aZ7FvvqKPBAA4vTdn/Wi27p53rHBI=; b=cYxjFzW6BpG9rwLSMWWkXyhhTfZwk+y5MKtru+V/iV2dQI6iwLUV8mox0vriQREwB1 81kfTUDeUoDEddrEAhSOrdcitV2nezQQiz3exJwUw95h/NU1kSdp/v4jY2L2zvIQ2UAL TNDju9gsesLYGuF2rH2AOTKdhwEbceBelsOtmnfTmf3ksE5q33vWnStqdUzZYwarWnhv RY7Kbw/jbYsHkWvjXLLiJwfnT+ntKlMG8G8gbaw9Bw80ctk2WmH+fon1MB1hbdk4KuwL BK5WyzDJkoGpsoftZPLwcQw6IGJic2fVErIB8RzgOeoIufwAbGX158q6/v/5atw5sKko x0Gg== X-Gm-Message-State: APjAAAVmk5zKPowfmJ6bnqppJR/otl5mCbFGqcOp7NkVfL+zuGx1BUeQ KUuKLzdIYyLcZ0yhKZ1kPvtO0eoCKscP6Q== X-Google-Smtp-Source: APXvYqxaetqv/AwbbrFbXKsO0iqV9Q4LebaUHESUoG6n2z7MaUBfrePGsmbvELFW292MtSS9SiP86w== X-Received: by 2002:a1c:a6c8:: with SMTP id p191mr12945687wme.99.1564664239497; Thu, 01 Aug 2019 05:57:19 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 1 Aug 2019 14:54:52 +0200 Message-Id: <20190801125453.27030-6-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.30]); Thu, 01 Aug 2019 12:57:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 01 Aug 2019 12:57:21 +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.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.128.67 mail-wm1-f67.google.com 209.85.128.67 mail-wm1-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.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.46]); Thu, 01 Aug 2019 12:57:26 +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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index de449d89fb..cffd60c75c 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4487,6 +4487,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) @@ -9145,6 +9156,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 Mon May 20 00:56:23 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=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