[PATCH 11/15] qemu: put data-file path to VM's cgroup and namespace

Nikolai Barybin via Devel posted 15 patches 21 hours ago
[PATCH 11/15] qemu: put data-file path to VM's cgroup and namespace
Posted by Nikolai Barybin via Devel 21 hours ago
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
---
 src/qemu/qemu_cgroup.c    | 13 ++++++++++++-
 src/qemu/qemu_namespace.c |  7 +++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index be4b9a38ff..f3c85d65e8 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -232,7 +232,14 @@ int
 qemuSetupImageCgroup(virDomainObj *vm,
                      virStorageSource *src)
 {
-    return qemuSetupImageCgroupInternal(vm, src, false);
+    if (qemuSetupImageCgroupInternal(vm, src, false) < 0)
+        return -1;
+
+    if (src->dataFileStore &&
+        qemuSetupImageCgroupInternal(vm, src->dataFileStore, false) < 0)
+        return -1;
+
+    return 0;
 }
 
 
@@ -321,6 +328,10 @@ qemuSetupImageChainCgroup(virDomainObj *vm,
         if (qemuSetupImageCgroupInternal(vm, next, forceReadonly) < 0)
             return -1;
 
+        if (next->dataFileStore &&
+            qemuSetupImageCgroupInternal(vm, next->dataFileStore, forceReadonly) < 0)
+            return -1;
+
         /* setup only the top level image for read-write */
         forceReadonly = true;
     }
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 0ebc115524..9fc13ee759 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -272,6 +272,13 @@ qemuDomainSetupDisk(virStorageSource *src,
         } else {
             GSList *targetPaths = NULL;
 
+            if (next->dataFileStore &&
+                !virStorageSourceIsEmpty(next->dataFileStore) &&
+                virStorageSourceIsLocalStorage(next->dataFileStore)) {
+                g_autofree char *dataFilePath = g_strdup(next->dataFileStore->path);
+                *paths = g_slist_prepend(*paths, g_steal_pointer(&dataFilePath));
+            }
+
             if (virStorageSourceIsEmpty(next) ||
                 !virStorageSourceIsLocalStorage(next)) {
                 /* Not creating device. Just continue. */
-- 
2.43.5