Re: [PATCH v2 2/4] test_driver: implement virDomainFSFreeze

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 04, 2019 at 03:27:16PM +0200, Ilias Stamatis wrote:
> On success update the domain-private data. Consider / and /boot to be
> the only mountpoints avaiable in order to be consistent with the other

s/avaiable/available

> FS-related calls.
>
> Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx>
> ---
>  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 testDomainObjPrivate;
>  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 = opaque;
> +    priv->frozen[0] = priv->frozen[1] = 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 = -1;
> +
> +    virCheckFlags(0, -1);
> +
> +    if (!(vm = testDomObjFromDomain(dom)))
> +        goto cleanup;
> +
> +    if (virDomainObjCheckActive(vm) < 0)
> +        goto cleanup;
> +
> +    priv = vm->privateData;
> +
> +    if (nmountpoints == 0) {
> +        ret = 0;
> +        if (priv->frozen[0] == false) {
> +            priv->frozen[0] = true;
> +            ret++;
> +        }
> +        if (priv->frozen[1] == false) {
> +            priv->frozen[1] = true;
> +            ret++;
> +        }

we can simplify ^this hunk a bit by applying what patch 3/4 does, so I'll
squash the following in:

--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4096,15 +4096,8 @@ testDomainFSFreeze(virDomainPtr dom,
     priv = vm->privateData;

     if (nmountpoints == 0) {
-        ret = 0;
-        if (priv->frozen[0] == false) {
-            priv->frozen[0] = true;
-            ret++;
-        }
-        if (priv->frozen[1] == false) {
-            priv->frozen[1] = true;
-            ret++;
-        }
+        ret = 2 - (priv->frozen[0] + priv->frozen[1]);
+        priv->frozen[0] = priv->frozen[1] = true;
     } else {
         int nfreeze = 0;
         bool freeze[2];


Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux