From nobody Sun Feb 8 20:00:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564925284; cv=none; d=zoho.com; s=zohoarc; b=gl6lDabbCiS5N+NFKiKhl5QzJhQwNGLop1OK2LE8HRqcd/XRU8ZCmBaKE291dsT5c2AgdoejiPnIuh8jaxQmPUwQkRXsrELtGVGRVzQFlh17Mkf6hvIQnCp3lyZsxzHy6/TwfqwldtFF+fJz7pWBF9C6DDS1eA0bcCn3wOemaTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564925284; 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=8pAjwuB8PWXIyAfnScJOKyHblrN57HpFolG/WWp7yVw=; b=UPjrqzwO5HTZwWMH2Iw+EZEJDbKwJ2ZRgqrURM25wmYb02msvN0ICAJLRMzIz/3xO3jSfuyIwoh1jW0jSZsLukaU7n57beW/GUAJybjOKCjeOqkCz8WjqRAiiKXCvd7aPcpWizP2JO7aZxNpP/PXx60sFNHpZnC/dWl7niLpH6s= 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 1564925284131195.68878033948909; Sun, 4 Aug 2019 06:28:04 -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 842F43008958; Sun, 4 Aug 2019 13:28:02 +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 574475C22D; Sun, 4 Aug 2019 13:28:02 +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 17A2E41F53; Sun, 4 Aug 2019 13:28:02 +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 x74DS09e014486 for ; Sun, 4 Aug 2019 09:28:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 358696012E; Sun, 4 Aug 2019 13:28:00 +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 30170601A6 for ; Sun, 4 Aug 2019 13:27:57 +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 94C473082A49 for ; Sun, 4 Aug 2019 13:27:56 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id p13so7189122wru.10 for ; Sun, 04 Aug 2019 06:27:56 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id 4sm187176532wro.78.2019.08.04.06.27.53 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 06:27:54 -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=R6/Btpzfvdp3NS4ujP1PysmpKxBklVnXBVfuvYsaaJI=; b=HHSoF4cCfvvEj+T2tZSe3/9fO8ZjRqTjPw0D/cM2vEoOs//DMpiRcX2loICj8PMiXQ CopHX7op7YMf3Bladi/Y4Kyg6IHrTf5aSMOtx5LfvcSGZdR/SMPNHXyHNUOaD+ZLGK4o y3cy6V2Pa7PoHNtTdoWZGZH85AiOu5cc1bzXZa7E30x9mo9J14FTuxr6R5jQwVQ9/fUh NcQ1FBf2SOw7NfP+ymZgVYykTskHBb2I1RjyG13UaoAV+vs73x4dWdqX/gu8dx3mAXwN APXCxWm4sja92Ob//JFBdG2l5RWUpdgO9VMaJ3q74sRdWBn/Rei7TAaXak/VhGqY9wKr wkBQ== 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=R6/Btpzfvdp3NS4ujP1PysmpKxBklVnXBVfuvYsaaJI=; b=VuMQ0qTW60H949CrAXs7EEBsfVcdJe308+Faq97sw5JB6tNPAETL4g93qwVnNSRNkV 0Ffzc86Hr+9ZjL/PqdavlXON0uAq4Tlrp6VS4yFfwQ2W44iMI5ADetd286PxfsGPsRvx H28ThTxbb6sNHRveTlS/RyOunt/PVMHQRuJmaguBLeG5xoraRCMDSRqAVP9Lzfxm4kZE rNYYR4rueW2Q/wr9BJRBTq1Ors/omY3x6YM7iU9CnqzQ5/7xgK5fLjiMc0TRJNpZr3Yj Bgt/D2YhoSLERVq4IqpKIwoD+7PV/uBHA6sDhq7lO5FscsxZR8QkKWHIRYerAWo8/vNc rjpg== X-Gm-Message-State: APjAAAWQPtDlp8v62VF9mDt7FnFQLFMvUZ+KfzG7xXjHNEOdGgJcqB1E 4VFEWhAHUDNK8Hoxac/chtaIl5YxT425EA== X-Google-Smtp-Source: APXvYqyzQE6nKYFZ3nFy+WfejC8F6eumZyyepgkb8yaWFHDRqZ+Ph5TAgqSqxS5hDjB24DiD8MiBiw== X-Received: by 2002:a5d:408c:: with SMTP id o12mr58938001wrp.176.1564925274948; Sun, 04 Aug 2019 06:27:54 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Sun, 4 Aug 2019 15:27:16 +0200 Message-Id: <20190804132718.25166-3-stamatis.iliass@gmail.com> In-Reply-To: <20190804132718.25166-1-stamatis.iliass@gmail.com> References: <20190804132718.25166-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]); Sun, 04 Aug 2019 13:27:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sun, 04 Aug 2019 13:27:56 +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.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/4] test_driver: implement virDomainFSFreeze 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]); Sun, 04 Aug 2019 13:28:03 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" On success update the domain-private data. Consider / and /boot to be the only mountpoints avaiable in order to be consistent with the other FS-related calls. Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 88a1d330c1..a8b75b175a 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -390,6 +390,8 @@ typedef struct _testDomainObjPrivate testDomainObjPriva= te; typedef testDomainObjPrivate *testDomainObjPrivatePtr; struct _testDomainObjPrivate { testDriverPtr driver; + + bool frozen[2]; /* used by file system related calls */ }; @@ -402,6 +404,7 @@ testDomainObjPrivateAlloc(void *opaque) return NULL; priv->driver =3D opaque; + priv->frozen[0] =3D priv->frozen[1] =3D false; return priv; } @@ -4046,6 +4049,74 @@ static int testDomainUndefine(virDomainPtr domain) return testDomainUndefineFlags(domain, 0); } + +static int +testDomainFSFreeze(virDomainPtr dom, + const char **mountpoints, + unsigned int nmountpoints, + unsigned int flags) +{ + virDomainObjPtr vm; + testDomainObjPrivatePtr priv; + size_t i; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + priv =3D vm->privateData; + + if (nmountpoints =3D=3D 0) { + ret =3D 0; + if (priv->frozen[0] =3D=3D false) { + priv->frozen[0] =3D true; + ret++; + } + if (priv->frozen[1] =3D=3D false) { + priv->frozen[1] =3D true; + ret++; + } + } else { + int nfreeze =3D 0; + bool freeze[2]; + + memcpy(&freeze, priv->frozen, 2); + + for (i =3D 0; i < nmountpoints; i++) { + if (STREQ(mountpoints[i], "/")) { + if (!freeze[0]) { + freeze[0] =3D true; + nfreeze++; + } + } else if (STREQ(mountpoints[i], "/boot")) { + if (!freeze[1]) { + freeze[1] =3D true; + nfreeze++; + } + } else { + virReportError(VIR_ERR_OPERATION_INVALID, + _("mount point not found: %s"), + mountpoints[i]); + goto cleanup; + } + } + + /* steal the helper copy */ + memcpy(priv->frozen, &freeze, 2); + ret =3D nfreeze; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -8692,6 +8763,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainDefineXMLFlags =3D testDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine =3D testDomainUndefine, /* 0.1.11 */ .domainUndefineFlags =3D testDomainUndefineFlags, /* 0.9.4 */ + .domainFSFreeze =3D testDomainFSFreeze, /* 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