From nobody Thu Mar 28 14:38:13 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=1565370670; cv=none; d=zoho.com; s=zohoarc; b=GXfdBf8Bn2qi293Wm0udMsjs0V6pcioA6e8hp8tMbeX9KPT8sGTeSRUhkT42Bmk4eqCJlU28PXRFyfeDIq1ohTouMZOz1thLIxOmEabgzyAcaKlJ9p8x84hKqCkjYsJr7e41ERyLK0VOn0pfIG9y0NJzi6vf+fmwsxDupmNTto8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565370670; 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=bCrhEFs4xpsh+2fewOlQADOUwaQrxRIIvV8CMbNqWpk=; b=AvDRGPahN8q0DxM3vjDaWwTB7Y6KJcrxLy5mnhaelpRjCnYm/5h1wBr2v6mWw8A9J8ElRO+Y4i049kcvDrTEX5/VmqIX9mxZ6r2jsTgHePmBXNO5t7e8fPbl+rgRN8uV2R5u3HSSqaUrv5s314c9I0C5wVT6cVOcsBYFItVd1aY= 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 1565370670666504.6050952576343; Fri, 9 Aug 2019 10:11:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06D9C3174646; Fri, 9 Aug 2019 17:11:09 +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 BFD4260872; Fri, 9 Aug 2019 17:11:08 +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 7C1D4180B536; Fri, 9 Aug 2019 17:11:08 +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 x79HB7TC018484 for ; Fri, 9 Aug 2019 13:11:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3A44A5D6A9; Fri, 9 Aug 2019 17:11:07 +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 350C15D6A5 for ; Fri, 9 Aug 2019 17:11:04 +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 4C0D273049 for ; Fri, 9 Aug 2019 17:11:03 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id q12so8641839wrj.12 for ; Fri, 09 Aug 2019 10:11:03 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id q20sm28537048wrc.79.2019.08.09.10.11.00 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 10:11:00 -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=noenViXFldx5uYYldQ0Hlmlmhj4Dq5K9CRo9Y5bE7TU=; b=TWzX3cqjyCxOmYKEHc2tnonLMHI1EskNJR5z4uvrhnvbqYIlK9OpG1nTczopoy3+GY Sn0Zsp5CQjdxr168cUja8pkGLDfPlxG3ZF56ZRuTlhsgsQ1UBzNmd2LtU1780Sq7VuM2 LO9DnqxTrt48cQLbSRTosGMOb8ETrKrVpLWY43JCCrrSJYyNnz2bbHpf/rM1YpKVMDtx rWffFfz3WXweFA24IXNL2qwOEbaG/NlkOmNBFs4vX++ZMbOGp10NUEMVRyynqmDKKzun D0gh05DAM68rny1GNDOOglLy2VKff7kjrtJK40bX23nvn/BLzORxCnbX7SsoEcAhw/UC v24w== 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=noenViXFldx5uYYldQ0Hlmlmhj4Dq5K9CRo9Y5bE7TU=; b=f21Dsvrvg/a/S7uolYuwpo0RoZfvc+9WHeIKAyj5R6XDsASyCsYeubNK/y5X40GYVw byT8w1/7NfUcSgB419M23G2HA04BB/6pIgSDCIeLmfBucSvBVZtf0X0M+tz+ymok68Mc ppbItMqEP7er1q3WWwQJJtO3kdi03/bSvW/S5J/d6c4gnrm+vkgKYDB1hgcPJwas3/O+ jAOul3sGcW7+DrRj/FAbRsqsdmR1uOjtWDnQnaJfwrHMVbXb4ATKAWkQIsWjX1NrgdfM 6eV20uXQ3Vo/Pr6DM+NAGTMAOxenOTfBZ4bnqQYUvQL+/6aH5hW3YOW3jzCWpB/vhwxg /ucQ== X-Gm-Message-State: APjAAAWY6lfK1h6BD496A8xkyhI5KH6E7xnt9hwQBE0vNza16kDOQwve P1ms9C1+hsK2/qWfh2muD2hcJj25Ioc= X-Google-Smtp-Source: APXvYqzC2zBFL3SRN8Xv5gHK6yU/4WUS8iPt4qrcQVFimue3mukmGSghsIv7ZNRaWW++TGlde12npw== X-Received: by 2002:adf:ce88:: with SMTP id r8mr26713908wrn.42.1565370661452; Fri, 09 Aug 2019 10:11:01 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 20:10:30 +0300 Message-Id: <20190809171032.8069-2-stamatis.iliass@gmail.com> In-Reply-To: <20190809171032.8069-1-stamatis.iliass@gmail.com> References: <20190809171032.8069-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.39]); Fri, 09 Aug 2019 17:11:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 09 Aug 2019 17:11:03 +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.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/3] test_driver: use domain-private data to store managed image X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 09 Aug 2019 17:11:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The managedSave APIs according to the documentation are supposed to operate on a disk file. However, this might not be appropriate in the case of the test driver since: * It's better if the test driver keeps all its state in memory only and doesn't affect the host in any way. * The test driver, apart from "emulating" the domains, it additionally "emulates" a fake physical host. Every time we start a new test connection that sort of means that a new physical host is created as well. And this fake host isn't necessarily the same. What we can do instead is operating on the already existing domain definitions. So along as a connection remains open, a domain can preserve the managed state between different shutdown / create calls. When the test connection closes this means that the fake host is destroyed as well, hence no other state is preserved after that. This way we also make sure that we don't touch the real host's filesystem. Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2b5376ec28..8bd5a5296b 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -396,6 +396,9 @@ struct _testDomainObjPrivate { /* used by get/set time APIs */ long long seconds; unsigned int nseconds; + + /* used by managed save APIs */ + virDomainDefPtr managedDef; }; @@ -413,6 +416,8 @@ testDomainObjPrivateAlloc(void *opaque) priv->seconds =3D 627319920; priv->nseconds =3D 0; + priv->managedDef =3D NULL; + return priv; } @@ -624,6 +629,7 @@ static const unsigned long long defaultPoolAlloc; static int testStoragePoolObjSetDefaults(virStoragePoolObjPtr obj); static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); static virNetworkObjPtr testNetworkObjFindByName(testDriverPtr privconn, c= onst char *name); +static int testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flag= s); static virDomainObjPtr testDomObjFromDomain(virDomainPtr domain) @@ -706,6 +712,7 @@ testDomainStartState(testDriverPtr privconn, virDomainObjPtr dom, virDomainRunningReason reason) { + testDomainObjPrivatePtr priv =3D dom->privateData; int ret =3D -1; virDomainObjSetState(dom, VIR_DOMAIN_RUNNING, reason); @@ -717,7 +724,9 @@ testDomainStartState(testDriverPtr privconn, goto cleanup; } + virDomainDefFree(priv->managedDef); dom->hasManagedSave =3D false; + ret =3D 0; cleanup: if (ret < 0) @@ -4114,7 +4123,8 @@ static int testDomainUndefineFlags(virDomainPtr domai= n, event =3D virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); - privdom->hasManagedSave =3D false; + + testDomainManagedSaveRemove(domain, 0); if (virDomainObjIsActive(privdom)) privdom->persistent =3D 0; @@ -7572,6 +7582,7 @@ static int testDomainManagedSave(virDomainPtr dom, unsigned int flags) { testDriverPtr privconn =3D dom->conn->privateData; + testDomainObjPrivatePtr privdom; virDomainObjPtr vm =3D NULL; virObjectEventPtr event =3D NULL; int ret =3D -1; @@ -7596,6 +7607,12 @@ testDomainManagedSave(virDomainPtr dom, unsigned int= flags) event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); + + privdom =3D vm->privateData; + virDomainDefFree(privdom->managedDef); + privdom->managedDef =3D virDomainDefCopy(vm->def, privconn->caps, + privconn->xmlopt, NULL, false); + vm->hasManagedSave =3D true; ret =3D 0; @@ -7628,12 +7645,16 @@ static int testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags) { virDomainObjPtr vm; + testDomainObjPrivatePtr priv; virCheckFlags(0, -1); if (!(vm =3D testDomObjFromDomain(dom))) return -1; + priv =3D vm->privateData; + virDomainDefFree(priv->managedDef); + vm->hasManagedSave =3D false; virDomainObjEndAPI(&vm); -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 14:38:13 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=1565370693; cv=none; d=zoho.com; s=zohoarc; b=mzUGHyfZF3Nl+OGApLa3sEIVOCzydT2Gf7ahXhjKxKduo6p++FjvkbCwuGJl2Y4zNDylEGL/WVKhJncmpF0YEFLLifH2bKP1NOSQq9G2OgBH7nj135W7qZ0rCAlPTS3BOntbewPApsI+YNDZ1a14NL956AN3+mi7SeoUYthXu0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565370693; 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=SOF9Cn6Hk3ljtk5I08WTYIhDTxAaFnXiCTU9rPzqSMU=; b=LVXHtZl0s8yZdawzOcWmISujpZ1JXw6CFNhy3M5awentMV+FOYkwrLFTIHUTkMICmMB6ogis8l1vtiMuJpPAS2vYotVzHTnI3/mWNnqQzgt/forPxBlxcAM9tcdwqDlxzW4/+M/L7aUsufpdlqv4IS+xLfyh8RJFpmunYZX+/js= 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 1565370693288918.5810847958513; Fri, 9 Aug 2019 10:11:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E80917EBD3; Fri, 9 Aug 2019 17:11:31 +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 C135710013A1; Fri, 9 Aug 2019 17:11:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 82B51180BA96; Fri, 9 Aug 2019 17:11:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x79HBUHQ018522 for ; Fri, 9 Aug 2019 13:11:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4A60960610; Fri, 9 Aug 2019 17:11:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 450F760605 for ; Fri, 9 Aug 2019 17:11:27 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F4F9C00A170 for ; Fri, 9 Aug 2019 17:11:26 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id t16so8781508wra.6 for ; Fri, 09 Aug 2019 10:11:26 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id q20sm28537048wrc.79.2019.08.09.10.11.22 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 10:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Wvw9vukRVGCdvipKDDS++pyNXb1kfBtIa4UJA/ozcfY=; b=fEtRR9+++/ov6Ss/FlyXnqHbENmvHUcF9j/pIG3I323bdavN4da2DYq1HBkTKJVCLP Gt2KVhGPitmWLM336h0xuXj8D4vhdpAGJ7cm7eeh9j/Gq7zkZ6Asq2Q99R+PgB+DyDB0 JJc90kH+lSCP9MgIRI9MP7QGMhTIUIeNsb54jjlSep79/KJ9RJ6knj8u+f8WQe0LCFti r0ohGHQOxsLtuVoTo73T6hx+hvapEgmImhQnUIuzE03g5LaXgx21CG8VwL3jqnsVK7A6 uMl9AyKtmrH4WL0zUdzIgHUbx+mEocqoaKk1yDzSvUgoz9dk9pYrCEhCPUFnBhh1Qrc2 BDhg== 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=Wvw9vukRVGCdvipKDDS++pyNXb1kfBtIa4UJA/ozcfY=; b=CXMfJp3cqvu+Yx38zgKYSeoyYAd8VKAtepgmV0k9aEATd+7idyASFEEI9YyYul71qn SP1JceM1Wd/MGtHVP0qq1YPuxadZoG0OjeXYpBohB2/7uY4KK+kFYsk/1IEWUK8uVGc1 zSsDiglt5K07jZa3crNHGc5MmzlpXZZTMXpoe+pWJVH73oOtEd8sxWJ4i93iCGzi/X4w 8++iOFvjZAwK6xcqVLpdI/NF+cLJ+canOdbidZuTsgtaFR5tJUWTI4zEj2NMpX0TyF+u aWfDS+oYVHXOo0zruL8G9TXXauhpqI0w3H44jWo1TYpnI6L/ufW3MrT+Wpzte4cqa3zu 1wow== X-Gm-Message-State: APjAAAX0YL39PG6nBETb6J36VoXjdTyVPd4BS4RafMRZXZXUhz6wtnLu x4SSVfbd9aSGXNyBd637h3afvKVE68Y= X-Google-Smtp-Source: APXvYqwdK/X6xgWRz5cmsvwFo1T00yfafy2jyPvxbs72J4WDhewLU7osahcpOAgLoYZ0rXt/AH/6vA== X-Received: by 2002:adf:e9cb:: with SMTP id l11mr9702371wrn.35.1565370683918; Fri, 09 Aug 2019 10:11:23 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 20:10:31 +0300 Message-Id: <20190809171032.8069-3-stamatis.iliass@gmail.com> In-Reply-To: <20190809171032.8069-1-stamatis.iliass@gmail.com> References: <20190809171032.8069-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 09 Aug 2019 17:11:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 09 Aug 2019 17:11:26 +0000 (UTC) for IP:'209.85.221.66' DOMAIN:'mail-wr1-f66.google.com' HELO:'mail-wr1-f66.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.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.66 mail-wr1-f66.google.com 209.85.221.66 mail-wr1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/3] test_driver: implement virDomainManagedSaveGetXMLDesc 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 09 Aug 2019 17:11:32 +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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 8bd5a5296b..211c0d737a 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7624,6 +7624,35 @@ testDomainManagedSave(virDomainPtr dom, unsigned int= flags) } +static char * +testDomainManagedSaveGetXMLDesc(virDomainPtr dom, + unsigned int flags) +{ + virDomainObjPtr vm; + testDriverPtr privconn =3D dom->conn->privateData; + testDomainObjPrivatePtr privdom; + char *ret =3D NULL; + + virCheckFlags(VIR_DOMAIN_SAVE_IMAGE_XML_SECURE, NULL); + + if (!(vm =3D testDomObjFromDomain(dom))) + return NULL; + + if (vm->hasManagedSave =3D=3D false) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain does not have managed save image")); + goto cleanup; + } + + privdom =3D vm->privateData; + ret =3D virDomainDefFormat(privdom->managedDef, privconn->caps, VIR_DO= MAIN_DEF_FORMAT_SECURE); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) { @@ -9088,6 +9117,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSendProcessSignal =3D testDomainSendProcessSignal, /* 5.5.0 */ .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ .domainManagedSave =3D testDomainManagedSave, /* 1.1.4 */ + .domainManagedSaveGetXMLDesc =3D testDomainManagedSaveGetXMLDesc, /* 5= .7.0 */ .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ .domainManagedSaveRemove =3D testDomainManagedSaveRemove, /* 1.1.4 */ .domainMemoryStats =3D testDomainMemoryStats, /* 5.7.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 14:38:13 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=1565370709; cv=none; d=zoho.com; s=zohoarc; b=ICosL3AuKJe+Gd1s3Akt5fmA7amh4pLS1Ih9cH7GaOAWVe+zMs/lc7IA0k1bX9vCgN+Jsyj3Xl9TKn+EjSILsyZ1LoADWymaNn69InQZG8rS6vSieN9vuIEwrTsxQNepXunCr8UAZjJnImsDfqrESAAKECT+ENkTya3MleHfous= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565370709; 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=0Ot/gJGk+HVE2jApMeBq2JbYRvBsRGIIeUUlc9buzmo=; b=nexYADOl4lLMrBzMV7TYDm0231xm29VsNrI+S3OIUHQkO9P42re7bi1MrZ+hvfDpVRNtenREQiRXnuL1vUjXVTL83cDerUrwCFRq8yWi8LatVwE6Bh5wUwjI4iwHoDmaUNdRJVppg48NZ0g9MmUdUTeOZBqcQ8i6p2dOVszhW5I= 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 15653707093173.9114427711493818; Fri, 9 Aug 2019 10:11:49 -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 1B9F1C08EC23; Fri, 9 Aug 2019 17:11:48 +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 E1A8660BF3; Fri, 9 Aug 2019 17:11:47 +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 A570B2551C; Fri, 9 Aug 2019 17:11:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x79HBk5T018544 for ; Fri, 9 Aug 2019 13:11:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7028A17176; Fri, 9 Aug 2019 17:11:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A3F217172 for ; Fri, 9 Aug 2019 17:11:43 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B9C930BCB94 for ; Fri, 9 Aug 2019 17:11:41 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id t16so8782140wra.6 for ; Fri, 09 Aug 2019 10:11:41 -0700 (PDT) Received: from archlap.localdomain ([185.32.231.210]) by smtp.gmail.com with ESMTPSA id q20sm28537048wrc.79.2019.08.09.10.11.38 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 10:11:38 -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=Ia573JlSG9TvYuZh29Ofh1aslWolkN2lhFCNJ9a3R90=; b=CuZMKhEuXD4//Lsn4s/fytu9EFKKfkJ3JUyBbuuakP947EzLUs0EFHH3JxEGi0zl/G 51EjlZpXJhNSwPNwm2sKoilQ+vLOwV3Z0Frsadb8Qi/7rQOGazkC4kjy3yI1EdryhHxr SpxTebNIKZIrmukfj9UPtK1OSwejQRGpa/vCxq3ihODBo7k938Z5N3E/eqGIjgZU54Nl 8OCYoh6oqdHKH33xkfbdacJtCEvqSk24c1IboNV0EwGkXHRno6i3/s4DMlAmidyYgQTl UN6YY0auP2b+ykC0eL0+IWrn9yOqr9qkIotsHP79z2BQHcCqou/GY43pMVDcQ2mZqanA iGzQ== 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=Ia573JlSG9TvYuZh29Ofh1aslWolkN2lhFCNJ9a3R90=; b=bTqJ6JObbRt/EzvrgQIXg+e23b7YOEKJl+T3iSKRMX6o5VkOAziu6f0hv1M70zz8Tp 0goCZkNodbf1xxBSe/Szozy/N9I3+EaiTXyKWG2xKFu/uqS5Q/TVK8YEqpX5CAzuPiW+ UwvDiwzl5as0SQOnXrBQu9T3Ts+o9XTvrhBIQx5mVx6J7tK0LHPze5iv6BZ/4+UVH+7L yHpIlA0CxNS0hZ9KSVbmaL5cWpdEiOw8OvbvwnZvSllzlzWEiIl3DEblQcIpHWvma05X z9hdRUDsrOs4CyJ+qdBt+IC2HBJMmcRg7myn7m5CHfnnR9s9vMQpgwNWXaIntyC/X74d 1tzw== X-Gm-Message-State: APjAAAU+qynlcRjgKPNoZY8PvNSSc3i/XbI/g4ASehelztoKtmC5DDS1 g98Ea35ab37QkNoCgLM/ALGRJg+Lzvc= X-Google-Smtp-Source: APXvYqw1A2KkUVV3XPUlgUXdzkRrLQEFAgc+MDcTIOawo6nsRK2zFJBB309MzdV4wPIVpacl/SXoCg== X-Received: by 2002:a5d:460a:: with SMTP id t10mr24187817wrq.83.1565370699360; Fri, 09 Aug 2019 10:11:39 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 20:10:32 +0300 Message-Id: <20190809171032.8069-4-stamatis.iliass@gmail.com> In-Reply-To: <20190809171032.8069-1-stamatis.iliass@gmail.com> References: <20190809171032.8069-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.49]); Fri, 09 Aug 2019 17:11:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 09 Aug 2019 17:11:41 +0000 (UTC) for IP:'209.85.221.65' DOMAIN:'mail-wr1-f65.google.com' HELO:'mail-wr1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.65 mail-wr1-f65.google.com 209.85.221.65 mail-wr1-f65.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/3] test_driver: implement virDomainManagedSaveDefineXML 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]); Fri, 09 Aug 2019 17:11:48 +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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 211c0d737a..a127dc69c1 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7653,6 +7653,45 @@ testDomainManagedSaveGetXMLDesc(virDomainPtr dom, } +static int +testDomainManagedSaveDefineXML(virDomainPtr dom, + const char *dxml, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + virDomainDefPtr newdef =3D NULL; + testDriverPtr privconn =3D dom->conn->privateData; + testDomainObjPrivatePtr privdom; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE | + VIR_DOMAIN_SAVE_RUNNING | + VIR_DOMAIN_SAVE_PAUSED, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (vm->hasManagedSave =3D=3D false) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain does not have managed save image")); + goto cleanup; + } + + if ((newdef =3D virDomainDefParseString(dxml, privconn->caps, privconn= ->xmlopt, NULL, + VIR_DOMAIN_DEF_PARSE_INACTIVE)) = =3D=3D NULL) + goto cleanup; + + privdom =3D vm->privateData; + virDomainDefFree(privdom->managedDef); + privdom->managedDef =3D newdef; + + ret =3D 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) { @@ -9118,6 +9157,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ .domainManagedSave =3D testDomainManagedSave, /* 1.1.4 */ .domainManagedSaveGetXMLDesc =3D testDomainManagedSaveGetXMLDesc, /* 5= .7.0 */ + .domainManagedSaveDefineXML =3D testDomainManagedSaveDefineXML, /* 5.7= .0 */ .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ .domainManagedSaveRemove =3D testDomainManagedSaveRemove, /* 1.1.4 */ .domainMemoryStats =3D testDomainMemoryStats, /* 5.7.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list