|
|
e9d682 |
From c8379fdd0f13af84f4b2ed449f8de77117fd8bc7 Mon Sep 17 00:00:00 2001
|
|
|
e9d682 |
Message-Id: <c8379fdd0f13af84f4b2ed449f8de77117fd8bc7@dist-git>
|
|
|
e9d682 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
e9d682 |
Date: Tue, 6 Sep 2022 13:43:58 +0200
|
|
|
e9d682 |
Subject: [PATCH] qemu_namespace: Introduce qemuDomainNamespaceSetupPath()
|
|
|
e9d682 |
|
|
|
e9d682 |
Sometimes it may come handy to just bind mount a directory/file
|
|
|
e9d682 |
into domain's namespace. Implement a thin wrapper over
|
|
|
e9d682 |
qemuNamespaceMknodPaths() which has all the logic we need.
|
|
|
e9d682 |
|
|
|
e9d682 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
e9d682 |
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
e9d682 |
(cherry picked from commit 5853d707189005a4ea5b2215e80853867b822fd9)
|
|
|
e9d682 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2152083
|
|
|
e9d682 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
e9d682 |
---
|
|
|
e9d682 |
src/qemu/qemu_namespace.c | 19 +++++++++++++++++++
|
|
|
e9d682 |
src/qemu/qemu_namespace.h | 4 ++++
|
|
|
e9d682 |
2 files changed, 23 insertions(+)
|
|
|
e9d682 |
|
|
|
e9d682 |
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
|
|
|
e9d682 |
index 807ec37c91..09e235e120 100644
|
|
|
e9d682 |
--- a/src/qemu/qemu_namespace.c
|
|
|
e9d682 |
+++ b/src/qemu/qemu_namespace.c
|
|
|
e9d682 |
@@ -1424,6 +1424,25 @@ qemuNamespaceUnlinkPaths(virDomainObj *vm,
|
|
|
e9d682 |
}
|
|
|
e9d682 |
|
|
|
e9d682 |
|
|
|
e9d682 |
+int
|
|
|
e9d682 |
+qemuDomainNamespaceSetupPath(virDomainObj *vm,
|
|
|
e9d682 |
+ const char *path,
|
|
|
e9d682 |
+ bool *created)
|
|
|
e9d682 |
+{
|
|
|
e9d682 |
+ g_autoptr(virGSListString) paths = NULL;
|
|
|
e9d682 |
+
|
|
|
e9d682 |
+ if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
|
|
e9d682 |
+ return 0;
|
|
|
e9d682 |
+
|
|
|
e9d682 |
+ paths = g_slist_prepend(paths, g_strdup(path));
|
|
|
e9d682 |
+
|
|
|
e9d682 |
+ if (qemuNamespaceMknodPaths(vm, paths, created) < 0)
|
|
|
e9d682 |
+ return -1;
|
|
|
e9d682 |
+
|
|
|
e9d682 |
+ return 0;
|
|
|
e9d682 |
+}
|
|
|
e9d682 |
+
|
|
|
e9d682 |
+
|
|
|
e9d682 |
int
|
|
|
e9d682 |
qemuDomainNamespaceSetupDisk(virDomainObj *vm,
|
|
|
e9d682 |
virStorageSource *src,
|
|
|
e9d682 |
diff --git a/src/qemu/qemu_namespace.h b/src/qemu/qemu_namespace.h
|
|
|
e9d682 |
index fbea865c70..85d990f460 100644
|
|
|
e9d682 |
--- a/src/qemu/qemu_namespace.h
|
|
|
e9d682 |
+++ b/src/qemu/qemu_namespace.h
|
|
|
e9d682 |
@@ -48,6 +48,10 @@ void qemuDomainDestroyNamespace(virQEMUDriver *driver,
|
|
|
e9d682 |
|
|
|
e9d682 |
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);
|
|
|
e9d682 |
|
|
|
e9d682 |
+int qemuDomainNamespaceSetupPath(virDomainObj *vm,
|
|
|
e9d682 |
+ const char *path,
|
|
|
e9d682 |
+ bool *created);
|
|
|
e9d682 |
+
|
|
|
e9d682 |
int qemuDomainNamespaceSetupDisk(virDomainObj *vm,
|
|
|
e9d682 |
virStorageSource *src,
|
|
|
e9d682 |
bool *created);
|
|
|
e9d682 |
--
|
|
|
e9d682 |
2.39.0
|
|
|
e9d682 |
|