And move it to qemu_domain.[ch] because this API is QEMU-only.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- new patch
src/conf/domain_conf.c | 27 ---------------------------
src/conf/domain_conf.h | 3 ---
src/qemu/qemu_domain.c | 28 ++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_driver.c | 4 ++--
src/qemu/qemu_migration.c | 2 +-
6 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d3a9093..3204140 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12322,33 +12322,6 @@ virDomainDiskRemoveByName(virDomainDefPtr def, const char *name)
return virDomainDiskRemove(def, idx);
}
-/**
- * virDomainHasBlockjob:
- * @vm: domain object
- * @copy_only: Reject only block copy job
- *
- * Return true if @vm has at least one disk involved in a current block
- * copy/commit/pull job. If @copy_only is true this returns true only if the
- * disk is involved in a block copy.
- * */
-bool
-virDomainHasBlockjob(virDomainObjPtr vm,
- bool copy_only)
-{
- size_t i;
- for (i = 0; i < vm->def->ndisks; i++) {
- if (!copy_only &&
- vm->def->disks[i]->blockjob)
- return true;
-
- if (vm->def->disks[i]->mirror &&
- vm->def->disks[i]->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
- return true;
- }
-
- return false;
-}
-
int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net)
{
/* hostdev net devices must also exist in the hostdevs array */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f57f3c9..b5e7617 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2697,9 +2697,6 @@ int virDomainDiskSourceParse(xmlNodePtr node,
xmlXPathContextPtr ctxt,
virStorageSourcePtr src);
-bool virDomainHasBlockjob(virDomainObjPtr vm,
- bool copy_only);
-
int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net);
virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *device);
bool virDomainHasNet(virDomainDefPtr def, virDomainNetDefPtr net);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index fa8229f..b69f10f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2828,6 +2828,34 @@ qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk)
}
+/**
+ * qemuDomainHasBlockjob:
+ * @vm: domain object
+ * @copy_only: Reject only block copy job
+ *
+ * Return true if @vm has at least one disk involved in a current block
+ * copy/commit/pull job. If @copy_only is true this returns true only if the
+ * disk is involved in a block copy.
+ * */
+bool
+qemuDomainHasBlockjob(virDomainObjPtr vm,
+ bool copy_only)
+{
+ size_t i;
+ for (i = 0; i < vm->def->ndisks; i++) {
+ if (!copy_only &&
+ vm->def->disks[i]->blockjob)
+ return true;
+
+ if (vm->def->disks[i]->mirror &&
+ vm->def->disks[i]->mirrorJob == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
+ return true;
+ }
+
+ return false;
+}
+
+
int
qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
virDomainObjPtr vm,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 3162f84..7f2e4b5 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -432,6 +432,8 @@ int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern)
ATTRIBUTE_NONNULL(1);
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
+bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
+ ATTRIBUTE_NONNULL(1);
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
void qemuDomainMemoryDeviceAlignSize(virDomainMemoryDefPtr mem);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f7433ee..c54199c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7734,7 +7734,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn,
const char *xml
virObjectRef(vm);
def = NULL;
- if (virDomainHasBlockjob(vm, true)) {
+ if (qemuDomainHasBlockjob(vm, true)) {
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, "%s",
_("domain has active block job"));
virDomainObjAssignDef(vm, NULL, false, NULL);
@@ -15622,7 +15622,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
- if (virDomainHasBlockjob(vm, false)) {
+ if (qemuDomainHasBlockjob(vm, false)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain has active block job"));
goto cleanup;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c1af704..8f2189b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2067,7 +2067,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
}
- if (virDomainHasBlockjob(vm, false)) {
+ if (qemuDomainHasBlockjob(vm, false)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("domain has an active block job"));
return false;
--
2.4.0