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