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 <stamatis.iliass@xxxxxxxxx> --- src/test/test_driver.c | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index af3503c523..8c25c679a5 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -388,6 +388,8 @@ typedef struct _testDomainObjPrivate testDomainObjPrivate; typedef testDomainObjPrivate *testDomainObjPrivatePtr; struct _testDomainObjPrivate { testDriverPtr driver; + + bool frozen[2]; /* used by file system related calls */ }; @@ -400,6 +402,7 @@ testDomainObjPrivateAlloc(void *opaque) return NULL; priv->driver = opaque; + priv->frozen[0] = priv->frozen[1] = false; return priv; } @@ -3439,6 +3442,60 @@ 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 slash = 0, slash_boot = 0; + int ret = -1; + + virCheckFlags(0, -1); + + if (!(vm = testDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + priv = vm->privateData; + + if (nmountpoints == 0) { + priv->frozen[0] = priv->frozen[1] = true; + ret = 2; + } else { + for (i = 0; i < nmountpoints; i++) { + if (STREQ(mountpoints[i], "/")) { + slash = 1; + } else if (STREQ(mountpoints[i], "/boot")) { + slash_boot = 1; + } else { + virReportError(VIR_ERR_OPERATION_INVALID, + _("mount point not found: %s"), + mountpoints[i]); + goto cleanup; + } + } + + if (slash) + priv->frozen[0] = true; + if (slash_boot) + priv->frozen[1] = true; + + ret = slash + slash_boot; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainGetAutostart(virDomainPtr domain, int *autostart) { @@ -7681,6 +7738,7 @@ static virHypervisorDriver testHypervisorDriver = { .domainDefineXMLFlags = testDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = testDomainUndefine, /* 0.1.11 */ .domainUndefineFlags = testDomainUndefineFlags, /* 0.9.4 */ + .domainFSFreeze = testDomainFSFreeze, /* 5.6.0 */ .domainGetAutostart = testDomainGetAutostart, /* 0.3.2 */ .domainSetAutostart = testDomainSetAutostart, /* 0.3.2 */ .domainGetDiskErrors = testDomainGetDiskErrors, /* 5.4.0 */ -- 2.22.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list