|
|
fbe740 |
From 70cf28f452df43cec98387b3039c3b8c5dda10d4 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <70cf28f452df43cec98387b3039c3b8c5dda10d4@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Tue, 4 Feb 2020 15:08:16 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemu: block: Extract calls of qemuBlockGetNamedNodeData into
|
|
|
fbe740 |
a helper function
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Create a wrapper for qemuBlockGetNamedNodeData named
|
|
|
fbe740 |
qemuBlockGetNamedNodeData. The purpose of the wrapper is to integrate
|
|
|
fbe740 |
the monitor handling functionality and in the future possible
|
|
|
fbe740 |
qemuCaps-based flags.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 5ddfac11698ec230626e12d077206210424c9bb2)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
|
|
|
fbe740 |
Message-Id: <5527853a9417cf84812cadb842b934ff67de1ea4.1580824112.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_backup.c | 5 +----
|
|
|
fbe740 |
src/qemu/qemu_block.c | 20 ++++++++++++++++++++
|
|
|
fbe740 |
src/qemu/qemu_block.h | 4 ++++
|
|
|
fbe740 |
src/qemu/qemu_driver.c | 16 ++++------------
|
|
|
fbe740 |
4 files changed, 29 insertions(+), 16 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
|
|
|
fbe740 |
index 23518a5d40..8b1e9a7e19 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_backup.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_backup.c
|
|
|
fbe740 |
@@ -830,10 +830,7 @@ qemuBackupBegin(virDomainObjPtr vm,
|
|
|
fbe740 |
goto endjob;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
- if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0)
|
|
|
fbe740 |
- goto endjob;
|
|
|
fbe740 |
- blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
|
|
fbe740 |
- if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeData)
|
|
|
fbe740 |
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_BACKUP)))
|
|
|
fbe740 |
goto endjob;
|
|
|
fbe740 |
|
|
|
fbe740 |
if ((ndd = qemuBackupDiskPrepareData(vm, def, incremental, blockNamedNodeData,
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
|
|
fbe740 |
index 22f03da485..13e240fdac 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_block.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_block.c
|
|
|
fbe740 |
@@ -2670,3 +2670,23 @@ qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData,
|
|
|
fbe740 |
|
|
|
fbe740 |
return NULL;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+virHashTablePtr
|
|
|
fbe740 |
+qemuBlockGetNamedNodeData(virDomainObjPtr vm,
|
|
|
fbe740 |
+ qemuDomainAsyncJob asyncJob)
|
|
|
fbe740 |
+{
|
|
|
fbe740 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
fbe740 |
+ virQEMUDriverPtr driver = priv->driver;
|
|
|
fbe740 |
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
|
fbe740 |
+ return NULL;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
|
|
fbe740 |
+ return NULL;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ return g_steal_pointer(&blockNamedNodeData);
|
|
|
fbe740 |
+}
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
|
|
|
fbe740 |
index 1a38e0eccf..68646cbf2e 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_block.h
|
|
|
fbe740 |
+++ b/src/qemu/qemu_block.h
|
|
|
fbe740 |
@@ -208,3 +208,7 @@ qemuBlockNamedNodeDataBitmapPtr
|
|
|
fbe740 |
qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData,
|
|
|
fbe740 |
virStorageSourcePtr src,
|
|
|
fbe740 |
const char *bitmap);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+virHashTablePtr
|
|
|
fbe740 |
+qemuBlockGetNamedNodeData(virDomainObjPtr vm,
|
|
|
fbe740 |
+ qemuDomainAsyncJob asyncJob);
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
fbe740 |
index e19e1da0bb..f7ad2dca28 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_driver.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_driver.c
|
|
|
fbe740 |
@@ -15622,15 +15622,9 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
|
|
fbe740 |
if (!(actions = virJSONValueNewArray()))
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
- if (blockdev) {
|
|
|
fbe740 |
- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
|
fbe740 |
- return -1;
|
|
|
fbe740 |
-
|
|
|
fbe740 |
- blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
|
|
fbe740 |
-
|
|
|
fbe740 |
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
|
|
fbe740 |
- return -1;
|
|
|
fbe740 |
- }
|
|
|
fbe740 |
+ if (blockdev &&
|
|
|
fbe740 |
+ !(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
/* prepare a list of objects to use in the vm definition so that we don't
|
|
|
fbe740 |
* have to roll back later */
|
|
|
fbe740 |
@@ -18334,9 +18328,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
|
|
fbe740 |
priv->qemuCaps)))
|
|
|
fbe740 |
goto endjob;
|
|
|
fbe740 |
} else {
|
|
|
fbe740 |
- qemuDomainObjEnterMonitor(driver, vm);
|
|
|
fbe740 |
- blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon);
|
|
|
fbe740 |
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData)
|
|
|
fbe740 |
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_NONE)))
|
|
|
fbe740 |
goto endjob;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (qemuBlockStorageSourceCreateDetectSize(blockNamedNodeData,
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|