]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_namespace: Introduce qemuDomainNamespaceSetupPath()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Sep 2022 11:43:58 +0000 (13:43 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Sep 2022 14:33:09 +0000 (16:33 +0200)
Sometimes it may come handy to just bind mount a directory/file
into domain's namespace. Implement a thin wrapper over
qemuNamespaceMknodPaths() which has all the logic we need.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_namespace.c
src/qemu/qemu_namespace.h

index 807ec37c91e720819c7ef5ed762c390a205e9fcd..09e235e120023b219a85139187927198103a634f 100644 (file)
@@ -1424,6 +1424,25 @@ qemuNamespaceUnlinkPaths(virDomainObj *vm,
 }
 
 
+int
+qemuDomainNamespaceSetupPath(virDomainObj *vm,
+                             const char *path,
+                             bool *created)
+{
+    g_autoptr(virGSListString) paths = NULL;
+
+    if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
+        return 0;
+
+    paths = g_slist_prepend(paths, g_strdup(path));
+
+    if (qemuNamespaceMknodPaths(vm, paths, created) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 int
 qemuDomainNamespaceSetupDisk(virDomainObj *vm,
                              virStorageSource *src,
index fbea865c705ed5204ce0ad87ac9fd59d60dff958..85d990f460fc1c2cc1e04a74c8fb77064b3ee50b 100644 (file)
@@ -48,6 +48,10 @@ void qemuDomainDestroyNamespace(virQEMUDriver *driver,
 
 bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);
 
+int qemuDomainNamespaceSetupPath(virDomainObj *vm,
+                                 const char *path,
+                                 bool *created);
+
 int qemuDomainNamespaceSetupDisk(virDomainObj *vm,
                                  virStorageSource *src,
                                  bool *created);