[PATCH v4 01/13] qemuDomainPrepareStorageSourceBlockdev: Add a variant for custom nodename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extract the internals of qemuDomainPrepareStorageSourceBlockdev into
qemuDomainPrepareStorageSourceBlockdevNodename so that we can reuse it
when instantiating the virStorageSource for pflash backing.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 31 +++++++++++++++++++++++--------
 src/qemu/qemu_domain.h |  5 +++++
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 916f85e673..86dbf7cb01 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10855,15 +10855,14 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDef *disk,


 int
-qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDef *disk,
-                                       virStorageSource *src,
-                                       qemuDomainObjPrivate *priv,
-                                       virQEMUDriverConfig *cfg)
+qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk,
+                                               virStorageSource *src,
+                                               const char *nodenameprefix,
+                                               qemuDomainObjPrivate *priv,
+                                               virQEMUDriverConfig *cfg)
 {
-    src->id = qemuDomainStorageIDNew(priv);
-
-    src->nodestorage = g_strdup_printf("libvirt-%u-storage", src->id);
-    src->nodeformat = g_strdup_printf("libvirt-%u-format", src->id);
+    src->nodestorage = g_strdup_printf("%s-storage", nodenameprefix);
+    src->nodeformat = g_strdup_printf("%s-format", nodenameprefix);

     if (qemuBlockStorageSourceNeedsStorageSliceLayer(src))
         src->sliceStorage->nodename = g_strdup_printf("libvirt-%u-slice-sto", src->id);
@@ -10896,6 +10895,22 @@ qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDef *disk,
 }


+int
+qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDef *disk,
+                                       virStorageSource *src,
+                                       qemuDomainObjPrivate *priv,
+                                       virQEMUDriverConfig *cfg)
+{
+    g_autofree char *nodenameprefix = NULL;
+
+    src->id = qemuDomainStorageIDNew(priv);
+
+    nodenameprefix = g_strdup_printf("libvirt-%u", src->id);
+
+    return qemuDomainPrepareStorageSourceBlockdevNodename(disk, src, nodenameprefix, priv, cfg);
+}
+
+
 static int
 qemuDomainPrepareDiskSourceBlockdev(virDomainDiskDef *disk,
                                     qemuDomainObjPrivate *priv,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 547d85b5f9..558037204c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -757,6 +757,11 @@ int qemuDomainStorageSourceAccessAllow(virQEMUDriver *driver,
                                        bool newSource,
                                        bool chainTop);

+int qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk,
+                                                   virStorageSource *src,
+                                                   const char *nodenameprefix,
+                                                   qemuDomainObjPrivate *priv,
+                                                   virQEMUDriverConfig *cfg);
 int qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDef *disk,
                                            virStorageSource *src,
                                            qemuDomainObjPrivate *priv,
-- 
2.35.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux