From nobody Thu May 2 22:05:35 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15153806202941023.394649966629; Sun, 7 Jan 2018 19:03:40 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12A6B369BD; Mon, 8 Jan 2018 03:03:39 +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 E0DAC5DA60; Mon, 8 Jan 2018 03:03:38 +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 A75A84ED34; Mon, 8 Jan 2018 03:03:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0833Geo007628 for ; Sun, 7 Jan 2018 22:03:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 272DB5EDE2; Mon, 8 Jan 2018 03:03:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 210A15D755 for ; Mon, 8 Jan 2018 03:03:14 +0000 (UTC) Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) (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 2C3416146F for ; Mon, 8 Jan 2018 03:03:13 +0000 (UTC) Received: by mail-qt0-f194.google.com with SMTP id u10so12096969qtg.2 for ; Sun, 07 Jan 2018 19:03:13 -0800 (PST) Received: from localhost.localdomain ([187.107.180.10]) by smtp.googlemail.com with ESMTPSA id y16sm7034281qta.48.2018.01.07.19.03.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Jan 2018 19:03:11 -0800 (PST) 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; bh=vRLeAw/RoVfLNvGFnaAtepR/rin8TWFU2BoIVmH4ESs=; b=lVKVC1K7oh1EJ2HVJuPfrvMnduNyAZkcC5X3ET5xWidwm9/8Q0FX9NoOqtVgZfQm+Z 9zj/E81wYnFGwMho96IquKq7MscndD5Sbyf2kd7kUEOe0Ij997Aq00UCayA18tAZP9Cw FRJsfG5P79+FePs5RNjG4reWI1pMLb1N/y0AkKQZwDPtXxVGCpoPdIAHxBOmAyJ9rG5+ EA8l1qZOv/p++DzAtO67fL+t2bPbhmz7vMuQB39e9LrPchYrwBAF9WHrkoyoJvyOhvx+ v5yQ0PdljMftf+uULZWB9ZDFpXMSckXlpKrDHizWqIQf/4PjW+PUqzSZo4t2AIyJn6QR AMGg== 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; bh=vRLeAw/RoVfLNvGFnaAtepR/rin8TWFU2BoIVmH4ESs=; b=Ob2mT3zuZ8uCtoQfEteqSD1KvJN1Ny8fS6aFTs6UnG0fiP071du9Nm5VxurrY/nYXv GteE+HYsMQqQOc/rYVB0fuAk/2UWMk/nfFUe+w5KLuPxaZYDvsfE/4cbz0t6ZEyojmqK E/NMM4lodXbIjlrHvgT5WoFp1Paf1gfQjWxSTOT7bMAXyOVckgzqavbvtT7VsLl3+7P/ 7zAIpmfG9teNHI7As5TM8n3UkljBkJpl0c63X6LAsrBRz9hyj3CI6fL4p1+6xlFg39tt qZBy623S4IH5ISljjWau4C/oh640ouTtOGzmfK/T0j5JmHOZ1QHQaK82rTiAKfO87Gug JTBA== X-Gm-Message-State: AKwxytcFkgGQjmRVcpnLwb436QgeSSZbHQ+9xhukX5Mdigrs/VTILfyk m0nOi9AVA3ZD7XtVvbkrofNPpw== X-Google-Smtp-Source: ACJfBotD0IP/3Y2EKm//+fOqKAuMIgteyU12yOodlhd0gXirxdxO2UNnsqiBeVjYvTU5/4gjR5oZYw== X-Received: by 10.200.11.67 with SMTP id m3mr13760939qti.186.1515380592140; Sun, 07 Jan 2018 19:03:12 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Mon, 8 Jan 2018 01:02:59 -0200 Message-Id: <1515380580-14220-2-git-send-email-jcfaracco@gmail.com> In-Reply-To: <1515380580-14220-1-git-send-email-jcfaracco@gmail.com> References: <1515380580-14220-1-git-send-email-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 08 Jan 2018 03:03:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 08 Jan 2018 03:03:13 +0000 (UTC) for IP:'209.85.216.194' DOMAIN:'mail-qt0-f194.google.com' HELO:'mail-qt0-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.194 mail-qt0-f194.google.com 209.85.216.194 mail-qt0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/2] test: Implementing testDomainRename(). 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 08 Jan 2018 03:03:39 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There is no method to rename inactive domains for test driver. After this patch, we can rename the domains using 'domrename'. virsh# domrename test anothertest Domain successfully renamed Signed-off-by: Julio Faracco --- 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 dc743b4..26bc8a2 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2618,6 +2618,77 @@ testDomainGetVcpuPinInfo(virDomainPtr dom, return ret; } =20 +static int +testDomainRenameCallback(virDomainObjPtr privdom, + const char *new_name, + unsigned int flags, + void *opaque) +{ + testDriverPtr driver =3D opaque; + virObjectEventPtr event_new =3D NULL; + virObjectEventPtr event_old =3D NULL; + int ret =3D -1; + char *new_dom_name =3D NULL; + char *old_dom_name =3D NULL; + + virCheckFlags(0, ret); + + if (VIR_STRDUP(new_dom_name, new_name) < 0) + goto cleanup; + + event_old =3D virDomainEventLifecycleNewFromObj(privdom, + VIR_DOMAIN_EVENT_UNDEFINED, + VIR_DOMAIN_EVENT_UNDEFINED_REN= AMED); + + /* Switch name in domain definition. */ + old_dom_name =3D privdom->def->name; + privdom->def->name =3D new_dom_name; + new_dom_name =3D NULL; + + event_new =3D virDomainEventLifecycleNewFromObj(privdom, + VIR_DOMAIN_EVENT_DEFINED, + VIR_DOMAIN_EVENT_DEFINED_REN= AMED); + ret =3D 0; + + cleanup: + VIR_FREE(old_dom_name); + VIR_FREE(new_dom_name); + testObjectEventQueue(driver, event_old); + testObjectEventQueue(driver, event_new); + return ret; +} + +static int testDomainRename(virDomainPtr dom, + const char *new_name, + unsigned int flags) +{ + testDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr privdom =3D NULL; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(privdom =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (!privdom->persistent) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot rename a transient domain")); + goto cleanup; + } + + if (virDomainObjListRename(driver->domains, privdom, new_name, flags, + testDomainRenameCallback, driver) < 0) + goto cleanup; + + /* Success, domain has been renamed. */ + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&privdom); + return ret; +} + static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) { testDriverPtr privconn =3D domain->conn->privateData; @@ -6822,6 +6893,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectDomainEventDeregisterAny =3D testConnectDomainEventDeregisterA= ny, /* 0.8.0 */ .connectIsAlive =3D testConnectIsAlive, /* 0.9.8 */ .nodeGetCPUMap =3D testNodeGetCPUMap, /* 1.0.0 */ + .domainRename =3D testDomainRename, /* 4.0.0 */ .domainScreenshot =3D testDomainScreenshot, /* 1.0.5 */ .domainGetMetadata =3D testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata =3D testDomainSetMetadata, /* 1.1.3 */ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 22:05:35 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515380602119504.15538597829436; Sun, 7 Jan 2018 19:03:22 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16925356CA; Mon, 8 Jan 2018 03:03:20 +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 B2D915D721; Mon, 8 Jan 2018 03:03:19 +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 0FA1F18033DA; Mon, 8 Jan 2018 03:03:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0833GMC007633 for ; Sun, 7 Jan 2018 22:03:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3ED145D755; Mon, 8 Jan 2018 03:03:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3908C5EDE2 for ; Mon, 8 Jan 2018 03:03:16 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (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 5B7804901C for ; Mon, 8 Jan 2018 03:03:15 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id a16so12093122qtj.3 for ; Sun, 07 Jan 2018 19:03:15 -0800 (PST) Received: from localhost.localdomain ([187.107.180.10]) by smtp.googlemail.com with ESMTPSA id y16sm7034281qta.48.2018.01.07.19.03.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Jan 2018 19:03:13 -0800 (PST) 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; bh=IKwXhQDAy2he5yKPFOtFLDZAqc9rL8ksUkUaYhcc1js=; b=n9s/HHOdS3iTV1q8edx+hGtmnSq7TTGB/w8r+sihQQmdIAbUYZjTmebLXWK1CCrTn0 tdyhR3185Y90/dyArsmmLYtA2BFTYmB+pfr8pyGQuITjmQx4gZSvHQHoLi3Tn6yn+4zJ qyrdpjo/s8JHZ6ekvKzBzFjJ8z0qYbZ0WZQKdNRQGchadWP8T4/Q02vmbpisnkh+olbx bn9Mh8ffEZF89VfzS8uucAnu67z7kE5mWP3E5orQgmXpQw5GKISmWvwQKivVFt88fxWI UJPekvmDSvnHfGpZmZAYzRTMSYWYpAC2gexi8V8Vtxbcn2gweUOhvtmRns39eB+PO25k uUwg== 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; bh=IKwXhQDAy2he5yKPFOtFLDZAqc9rL8ksUkUaYhcc1js=; b=ZDil+2BOQZwL3KiCpitGUYYxSMXry9nyl7xu9SVF+enUJ2of16OuIEkgn+SaK4h9mV gqul7n0rrbVWlykkbshDa06xQjpZRiKTMCMMOD4jjCrYj2EGLxedBHW14n5kMqwDz0gj B4Np0ZvZV8ao442JXfAOlH8drKVQdYM9EvUP/o+29oHOn/eEGxzmKgX2rhS4SseiLVEU 2GYg0COZBGpdQeR6rs7lvE0vTZ9cc9J63LkZAuvSN6yo6AnrEv745IMGWW0B/wRwUZsU zW2FZxFpJHXhH+qhyrAoTnTomqjbo8TILMELx5OFfBpZrB52C37U1WDxucotiZxg2RFr YKRQ== X-Gm-Message-State: AKwxytecyvGFu6iyaCMtzTR3IwBr2F6BxeslnTRcF85Ozz4xy/2qHxKN VQze9DBfaft9vPNMmjWmureTWQ== X-Google-Smtp-Source: ACJfBosK/XjQq12Xb+u100fFogsUPWarzt5DWZCCf/M+ZzTC1eehYfUFU+5XFZObcLGjHjIWd/nCnQ== X-Received: by 10.200.51.101 with SMTP id u34mr14570705qta.152.1515380594373; Sun, 07 Jan 2018 19:03:14 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Date: Mon, 8 Jan 2018 01:03:00 -0200 Message-Id: <1515380580-14220-3-git-send-email-jcfaracco@gmail.com> In-Reply-To: <1515380580-14220-1-git-send-email-jcfaracco@gmail.com> References: <1515380580-14220-1-git-send-email-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 08 Jan 2018 03:03:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 08 Jan 2018 03:03:15 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/2] tests: Adding test case for 'domrename' command inside virshtest. 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 08 Jan 2018 03:03:20 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds a domrename test case inside the 'virshtest' test for test driver. Signed-off-by: Julio Faracco --- tests/virshtest.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/virshtest.c b/tests/virshtest.c index 67453bd..f1cd5df 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -40,6 +40,7 @@ static const char *domuuid_fc4 =3D DOM_UUID "\n\n"; static const char *domid_fc4 =3D "2\n\n"; static const char *domname_fc4 =3D "fc4\n\n"; static const char *domstate_fc4 =3D "running\n\n"; +static const char *domrename_fc4 =3D "Domain successfully renamed\n\n"; =20 static int testFilterLine(char *buffer, const char *toRemove) @@ -237,6 +238,14 @@ static int testCompareDomstateByName(const void *data = ATTRIBUTE_UNUSED) return testCompareOutputLit(exp, NULL, argv); } =20 +static int testCompareDomrenameByName(const void *data ATTRIBUTE_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "domrename", "fc4", + "fc4new", NULL }; + const char *exp =3D domrename_fc4; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -322,6 +331,10 @@ mymain(void) testCompareDomstateByName, NULL) !=3D 0) ret =3D -1; =20 + if (virTestRun("virsh domrename (by name)", + testCompareDomrenameByName, NULL) !=3D 0) + ret =3D -1; + /* It's a bit awkward listing result before argument, but that's a * limitation of C99 vararg macros. */ # define DO_TEST(i, result, ...) \ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list