Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_block.c    | 33 +++++++++++++--------------------
 src/qemu/qemu_block.h    |  3 +--
 src/qemu/qemu_blockjob.c |  4 ++--
 src/qemu/qemu_hotplug.c  |  2 +-
 4 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index a5d9f47ec4..afdcca2813 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1555,36 +1555,29 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon,
 /**
  * qemuBlockStorageSourceDetachPrepare:
  * @src: disk source structure
- * @driveAlias: Alias of the -drive backend, the pointer is always consumed
  *
  * Prepare qemuBlockStorageSourceAttachData *for detaching a single source
- * from a VM. If @driveAlias is NULL -blockdev is assumed.
+ * from a VM.
  */
 qemuBlockStorageSourceAttachData *
-qemuBlockStorageSourceDetachPrepare(virStorageSource *src,
-                                    char *driveAlias)
+qemuBlockStorageSourceDetachPrepare(virStorageSource *src)
 {
     qemuDomainStorageSourcePrivate *srcpriv = 
QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
     g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;

     data = g_new0(qemuBlockStorageSourceAttachData, 1);

-    if (driveAlias) {
-        data->driveAlias = g_steal_pointer(&driveAlias);
-        data->driveAdded = true;
-    } else {
-        data->formatNodeName = src->nodeformat;
-        data->formatAttached = true;
-        data->storageNodeName = src->nodestorage;
-        data->storageAttached = true;
+    data->formatNodeName = src->nodeformat;
+    data->formatAttached = true;
+    data->storageNodeName = src->nodestorage;
+    data->storageAttached = true;

-        /* 'raw' format doesn't need the extra 'raw' layer when slicing, thus
-         * the nodename is NULL */
-        if (src->sliceStorage &&
-            src->sliceStorage->nodename) {
-            data->storageSliceNodeName = src->sliceStorage->nodename;
-            data->storageSliceAttached = true;
-        }
+    /* 'raw' format doesn't need the extra 'raw' layer when slicing, thus
+     * the nodename is NULL */
+    if (src->sliceStorage &&
+        src->sliceStorage->nodename) {
+        data->storageSliceNodeName = src->sliceStorage->nodename;
+        data->storageSliceAttached = true;
     }

     if (src->pr &&
@@ -1647,7 +1640,7 @@ 
qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSource *src)
     data = g_new0(qemuBlockStorageSourceChainData, 1);

     for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (!(backend = qemuBlockStorageSourceDetachPrepare(n, NULL)))
+        if (!(backend = qemuBlockStorageSourceDetachPrepare(n)))
             return NULL;

         VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend);
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index a20a5e8a61..d29d444a5a 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -116,8 +116,7 @@ 
qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src,
                                             bool autoreadonly);

 qemuBlockStorageSourceAttachData *
-qemuBlockStorageSourceDetachPrepare(virStorageSource *src,
-                                    char *driveAlias);
+qemuBlockStorageSourceDetachPrepare(virStorageSource *src);

 int
 qemuBlockStorageSourceAttachApply(qemuMonitor *mon,
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 03c46923b3..62ed71f5a8 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1328,7 +1328,7 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriver 
*driver,
     if (!job->data.create.src)
         return;

-    if (!(backend = qemuBlockStorageSourceDetachPrepare(job->data.create.src, 
NULL)))
+    if (!(backend = qemuBlockStorageSourceDetachPrepare(job->data.create.src)))
         return;

     /* the format node part was not attached yet, so we don't need to detach 
it */
@@ -1365,7 +1365,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver 
*driver,
                                 progressCurrent, progressTotal, asyncJob);

     if (job->data.backup.store &&
-        !(backend = 
qemuBlockStorageSourceDetachPrepare(job->data.backup.store, NULL)))
+        !(backend = 
qemuBlockStorageSourceDetachPrepare(job->data.backup.store)))
         return;

     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d7f10d8277..a752702fc4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -706,7 +706,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
             goto rollback;

         QEMU_DOMAIN_DISK_PRIVATE(disk)->transientOverlayCreated = true;
-        backend = qemuBlockStorageSourceDetachPrepare(disk->src, NULL);
+        backend = qemuBlockStorageSourceDetachPrepare(disk->src);
         ignore_value(VIR_INSERT_ELEMENT(data->srcdata, 0, data->nsrcdata, 
backend));
     }

-- 
2.36.1

Reply via email to