The function `qemuDomainObjSaveStatus` required an access to `virQEMUDriverPtr`. To make jobs hypervisor-agnostic we remove this funciton and replace it with a callback function from `qemuDomainJob` Removal of `virQEMUDriverPtr` as parameter resulted in removal of the same from function, where it was pass. All of such references were removed as the variable was no longer required. Signed-off-by: Prathamesh Chavan <pc44800@xxxxxxxxx> --- src/qemu/qemu_backup.c | 41 +- src/qemu/qemu_backup.h | 3 +- src/qemu/qemu_block.c | 45 +- src/qemu/qemu_block.h | 6 +- src/qemu/qemu_blockjob.c | 45 +- src/qemu/qemu_blockjob.h | 3 +- src/qemu/qemu_checkpoint.c | 29 +- src/qemu/qemu_domain.c | 78 ++- src/qemu/qemu_domain.h | 24 +- src/qemu/qemu_domainjob.c | 63 ++- src/qemu/qemu_domainjob.h | 31 +- src/qemu/qemu_driver.c | 848 ++++++++++++++----------------- src/qemu/qemu_hotplug.c | 319 ++++++------ src/qemu/qemu_hotplug.h | 30 +- src/qemu/qemu_migration.c | 315 +++++------- src/qemu/qemu_migration.h | 12 +- src/qemu/qemu_migration_cookie.c | 7 +- src/qemu/qemu_migration_params.c | 48 +- src/qemu/qemu_migration_params.h | 15 +- src/qemu/qemu_process.c | 258 +++++----- src/qemu/qemu_process.h | 15 +- tests/qemuhotplugtest.c | 2 +- 22 files changed, 999 insertions(+), 1238 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 1822c6f267..7e5926250a 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -127,9 +127,9 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm, if (!dd->started) { if (dd->added) { - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]); - ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } if (dd->created) { @@ -439,12 +439,12 @@ qemuBackupDiskPrepareOneStorage(virDomainObjPtr vm, QEMU_ASYNC_JOB_BACKUP) < 0) return -1; } else { - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_BACKUP) < 0) return -1; rc = qemuBlockStorageSourceAttachApply(priv->mon, dd->crdata->srcdata[0]); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; } @@ -572,7 +572,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm, virDomainBackupDefFree(priv->backup); priv->backup = NULL; - qemuDomainObjEndAsyncJob(priv->driver, vm); + qemuDomainObjEndAsyncJob(vm); } @@ -625,12 +625,12 @@ qemuBackupJobCancelBlockjobs(virDomainObjPtr vm, if (backupdisk->state != VIR_DOMAIN_BACKUP_DISK_STATE_RUNNING) continue; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; rc = qemuMonitorJobCancel(priv->mon, job->name, false); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; if (rc == 0) { @@ -740,7 +740,7 @@ qemuBackupBegin(virDomainObjPtr vm, * infrastructure for async jobs. We'll allow standard modify-type jobs * as the interlocking of conflicting operations is handled on the block * job level */ - if (qemuDomainObjBeginAsyncJob(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_BACKUP, VIR_DOMAIN_JOB_OPERATION_BACKUP, flags) < 0) return -1; @@ -804,7 +804,7 @@ qemuBackupBegin(virDomainObjPtr vm, priv->backup = g_steal_pointer(&def); - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_BACKUP) < 0) goto endjob; /* TODO: TLS is a must-have for the modern age */ @@ -824,7 +824,7 @@ qemuBackupBegin(virDomainObjPtr vm, if (rc == 0) rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; job_started = true; @@ -837,12 +837,12 @@ qemuBackupBegin(virDomainObjPtr vm, } if (pull) { - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_BACKUP) < 0) goto endjob; /* note that if the export fails we've already created the checkpoint * and we will not delete it */ rc = qemuBackupBeginPullExportDisks(vm, dd, ndd); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (rc < 0) { @@ -863,14 +863,14 @@ qemuBackupBegin(virDomainObjPtr vm, qemuCheckpointRollbackMetadata(vm, chk); if (!job_started && (nbd_running || tlsAlias || tlsSecretAlias) && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) == 0) { + qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_BACKUP) == 0) { if (nbd_running) ignore_value(qemuMonitorNBDServerStop(priv->mon)); if (tlsAlias) ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias, false)); if (tlsSecretAlias) ignore_value(qemuMonitorDelObject(priv->mon, tlsSecretAlias, false)); - ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } if (ret < 0 && !job_started && priv->backup) @@ -879,7 +879,7 @@ qemuBackupBegin(virDomainObjPtr vm, if (ret == 0) qemuDomainObjReleaseAsyncJob(vm); else - qemuDomainObjEndAsyncJob(priv->driver, vm); + qemuDomainObjEndAsyncJob(vm); return ret; } @@ -929,14 +929,14 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm, return; if (backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL) { - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; ignore_value(qemuMonitorNBDServerStop(priv->mon)); if (backup->tlsAlias) ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsAlias, false)); if (backup->tlsSecretAlias) ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsSecretAlias, false)); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; /* update the final statistics with the current job's data */ @@ -1067,8 +1067,7 @@ qemuBackupGetJobInfoStatsUpdateOne(virDomainObjPtr vm, int -qemuBackupGetJobInfoStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBackupGetJobInfoStats(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo) { qemuDomainBackupStats *stats = &jobInfo->stats.backup; @@ -1090,11 +1089,11 @@ qemuBackupGetJobInfoStats(virQEMUDriverPtr driver, jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetJobInfo(priv->mon, &blockjobs, &nblockjobs); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; /* count in completed jobs */ diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index 075fde709b..9925fddbf9 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -48,8 +48,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm, qemuDomainJobStatus jobstatus); int -qemuBackupGetJobInfoStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBackupGetJobInfoStats(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo); /* exported for testing */ diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 26c1b42428..23b60e73ec 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -320,8 +320,7 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, int -qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBlockNodeNamesDetect(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -334,13 +333,13 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_NAMED_BLOCK_NODES)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm)); blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm)); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats) + if (qemuDomainObjExitMonitor(vm) < 0 || !data || !blockstats) return -1; if (!(disktable = qemuBlockNodeNameGetBackingChain(data, blockstats))) @@ -1976,7 +1975,6 @@ qemuBlockStorageSourceChainDetach(qemuMonitorPtr mon, /** * qemuBlockStorageSourceDetachOneBlockdev: - * @driver: qemu driver object * @vm: domain object * @asyncJob: currently running async job * @src: storage source to detach @@ -1986,14 +1984,13 @@ qemuBlockStorageSourceChainDetach(qemuMonitorPtr mon, * monitor internally. */ int -qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBlockStorageSourceDetachOneBlockdev(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virStorageSourcePtr src) { int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodeformat); @@ -2001,7 +1998,7 @@ qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver, if (ret == 0) ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodestorage); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return ret; @@ -2561,13 +2558,13 @@ qemuBlockStorageSourceCreateGeneric(virDomainObjPtr vm, qemuBlockJobSyncBegin(job); - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorBlockdevCreate(priv->mon, job->name, props); props = NULL; - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; qemuBlockJobStarted(job, vm); @@ -2708,18 +2705,18 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, false, true) < 0) return -1; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuBlockStorageSourceAttachApplyStorageDeps(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; if (qemuBlockStorageSourceCreateStorage(vm, src, chain, asyncJob) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuBlockStorageSourceAttachApplyStorage(priv->mon, data); @@ -2727,7 +2724,7 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, if (rc == 0) rc = qemuBlockStorageSourceAttachApplyFormatDeps(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; if (qemuBlockStorageSourceCreateFormat(vm, src, backingStore, chain, @@ -2740,12 +2737,12 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, false, true) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuBlockStorageSourceAttachApplyFormat(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; ret = 0; @@ -2753,10 +2750,10 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, cleanup: if (ret < 0 && virDomainObjIsActive(vm) && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) == 0) { + qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuBlockStorageSourceAttachRollback(priv->mon, data); - ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } return ret; @@ -2861,17 +2858,16 @@ qemuBlockGetNamedNodeData(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; - virQEMUDriverPtr driver = priv->driver; g_autoptr(virHashTable) blockNamedNodeData = NULL; bool supports_flat = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return NULL; blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon, supports_flat); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData) + if (qemuDomainObjExitMonitor(vm) < 0 || !blockNamedNodeData) return NULL; return g_steal_pointer(&blockNamedNodeData); @@ -3185,7 +3181,6 @@ qemuBlockReopenFormat(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; - virQEMUDriverPtr driver = priv->driver; g_autoptr(virJSONValue) reopenprops = NULL; int rc; @@ -3200,12 +3195,12 @@ qemuBlockReopenFormat(virDomainObjPtr vm, if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; return 0; diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 9aab620947..35148ea2ba 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -46,8 +46,7 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodesdata, virJSONValuePtr blockstats); int -qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBlockNodeNamesDetect(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); virHashTablePtr @@ -140,8 +139,7 @@ qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon, qemuBlockStorageSourceAttachDataPtr data); int -qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuBlockStorageSourceDetachOneBlockdev(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virStorageSourcePtr src); diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index c49c98e547..265f449b7a 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -491,8 +491,7 @@ qemuBlockJobRefreshJobsFindInactive(const void *payload, int -qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuBlockJobRefreshJobs(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuMonitorJobInfoPtr *jobinfo = NULL; @@ -503,11 +502,11 @@ qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, int ret = -1; int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetJobInfo(priv->mon, &jobinfo, &njobinfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; for (i = 0; i < njobinfo; i++) { @@ -524,13 +523,13 @@ qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, qemuBlockJobMarkBroken(job); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorJobCancel(priv->mon, job->name, true); if (rc == -1 && jobinfo[i]->status == QEMU_MONITOR_JOB_STATUS_CONCLUDED) VIR_WARN("can't cancel job '%s' with invalid data", job->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (rc < 0) @@ -757,7 +756,7 @@ qemuBlockJobEventProcessLegacyCompleted(virQEMUDriverPtr driver, disk->src->id = 0; virStorageSourceBackingStoreClear(disk->src); ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk, NULL, true)); - ignore_value(qemuBlockNodeNamesDetect(driver, vm, asyncJob)); + ignore_value(qemuBlockNodeNamesDetect(vm, asyncJob)); qemuBlockJobUnregister(job, vm); qemuDomainSaveConfig(vm); } @@ -843,11 +842,11 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriverPtr driver, if (!(data = qemuBlockStorageSourceChainDetachPrepareBlockdev(chain))) return; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuBlockStorageSourceChainDetach(qemuDomainGetMonitor(vm), data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain); @@ -959,12 +958,12 @@ qemuBlockJobProcessEventCompletedPullBitmaps(virDomainObjPtr vm, if (!actions) return 0; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return 0; @@ -1123,12 +1122,12 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm, return -1; } - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (!active) { @@ -1346,12 +1345,12 @@ qemuBlockJobProcessEventCompletedCopyBitmaps(virDomainObjPtr vm, if (!actions) return 0; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return 0; @@ -1431,12 +1430,12 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver, ignore_value(qemuMonitorTransactionBitmapRemove(actions, disk->mirror->nodeformat, "libvirt-tmp-activewrite")); - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; /* Ideally, we would make the backing chain read only again (yes, SELinux @@ -1480,12 +1479,12 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver, VIR_FREE(backend->encryptsecretAlias); } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), backend); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; qemuDomainStorageSourceAccessRevoke(driver, vm, job->data.create.src); @@ -1520,7 +1519,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriverPtr driver, return; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; if (backend) @@ -1529,7 +1528,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriverPtr driver, if (actions) qemuMonitorTransaction(qemuDomainGetMonitor(vm), &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return; if (job->data.backup.store) @@ -1610,7 +1609,7 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job, unsigned long long progressCurrent = 0; unsigned long long progressTotal = 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; /* we need to fetch the error state as the event does not propagate it */ @@ -1643,7 +1642,7 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job, /* dismiss job in qemu */ ignore_value(qemuMonitorJobDismiss(qemuDomainGetMonitor(vm), job->name)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if ((job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED || diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 9f73a3547c..bdf4787eb0 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -226,8 +226,7 @@ qemuBlockJobStartupFinalize(virDomainObjPtr vm, qemuBlockJobDataPtr job); int -qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, - virDomainObjPtr vm); +qemuBlockJobRefreshJobs(virDomainObjPtr vm); void qemuBlockJobUpdate(virDomainObjPtr vm, diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index f45ab29d4c..b90410aa20 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -198,9 +198,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, relabelimages = g_slist_prepend(relabelimages, src); } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; relabel: @@ -457,9 +457,9 @@ qemuCheckpointCreate(virQEMUDriverPtr driver, if (qemuCheckpointCreateCommon(driver, vm, def, &actions, &chk) < 0) return NULL; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(qemuDomainGetMonitor(vm), &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) { + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) { qemuCheckpointRollbackMetadata(vm, chk); return NULL; } @@ -539,7 +539,7 @@ qemuCheckpointCreateXML(virDomainPtr domain, /* Unlike snapshots, the RNG schema already ensured a sane filename. */ /* We are going to modify the domain below. */ - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return NULL; if (redefine) { @@ -561,7 +561,7 @@ qemuCheckpointCreateXML(virDomainPtr domain, checkpoint = virGetDomainCheckpoint(domain, chk->def->name); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return checkpoint; } @@ -578,7 +578,6 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, virDomainCheckpointDefPtr chkdef) { qemuDomainObjPrivatePtr priv = vm->privateData; - virQEMUDriverPtr driver = priv->driver; g_autoptr(virHashTable) blockNamedNodeData = NULL; g_autofree struct qemuCheckpointDiskMap *diskmap = NULL; g_autoptr(virJSONValue) recoveractions = NULL; @@ -589,7 +588,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -659,7 +658,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (rc == 0 && recoveractions) rc = qemuMonitorTransaction(priv->mon, &recoveractions); @@ -667,7 +666,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, if (rc == 0) rc = qemuMonitorTransaction(priv->mon, &mergeactions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; /* now do a final refresh */ @@ -675,11 +674,11 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_NONE))) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(priv->mon, &cleanupactions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; /* update disks */ @@ -698,7 +697,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObjPtr vm, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -782,7 +781,7 @@ qemuCheckpointDelete(virDomainObjPtr vm, VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY | VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, -1); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (!metadata_only) { @@ -850,6 +849,6 @@ qemuCheckpointDelete(virDomainObjPtr vm, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 87c72575d0..fd42751625 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -820,6 +820,7 @@ static qemuDomainJobPrivateJobCallbacks qemuJobPrivateJobCallbacks = { }; static qemuDomainJobPrivateCallbacks qemuJobPrivateCallbacks = { + .saveStatus = qemuDomainSaveStatus, .jobcb = &qemuJobPrivateJobCallbacks, }; @@ -6087,20 +6088,19 @@ qemuDomainSaveConfig(virDomainObjPtr obj) * To be followed with qemuDomainObjExitMonitor() once complete */ static int -qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjEnterMonitorInternal(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = obj->privateData; if (asyncJob != QEMU_ASYNC_JOB_NONE) { int ret; - if ((ret = qemuDomainObjBeginNestedJob(driver, obj, asyncJob)) < 0) + if ((ret = qemuDomainObjBeginNestedJob(obj, asyncJob)) < 0) return ret; if (!virDomainObjIsActive(obj)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain is no longer running")); - qemuDomainObjEndJob(driver, obj); + qemuDomainObjEndJob(obj); return -1; } } else if (priv->job.asyncOwner == virThreadSelfID()) { @@ -6124,8 +6124,7 @@ qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver, } static void ATTRIBUTE_NONNULL(1) -qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver, - virDomainObjPtr obj) +qemuDomainObjExitMonitorInternal(virDomainObjPtr obj) { qemuDomainObjPrivatePtr priv = obj->privateData; bool hasRefs; @@ -6146,14 +6145,12 @@ qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver, priv->mon = NULL; if (priv->job.active == QEMU_JOB_ASYNC_NESTED) - qemuDomainObjEndJob(driver, obj); + qemuDomainObjEndJob(obj); } -void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver, - virDomainObjPtr obj) +void qemuDomainObjEnterMonitor(virDomainObjPtr obj) { - ignore_value(qemuDomainObjEnterMonitorInternal(driver, obj, - QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuDomainObjEnterMonitorInternal(obj, QEMU_ASYNC_JOB_NONE)); } /* obj must NOT be locked before calling @@ -6166,10 +6163,9 @@ void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver, * and replaced by the persistent definition, so pointers stolen * from the live definition could no longer be valid. */ -int qemuDomainObjExitMonitor(virQEMUDriverPtr driver, - virDomainObjPtr obj) +int qemuDomainObjExitMonitor(virDomainObjPtr obj) { - qemuDomainObjExitMonitorInternal(driver, obj); + qemuDomainObjExitMonitorInternal(obj); if (!virDomainObjIsActive(obj)) { if (virGetLastErrorCode() == VIR_ERR_OK) virReportError(VIR_ERR_OPERATION_FAILED, "%s", @@ -6194,11 +6190,10 @@ int qemuDomainObjExitMonitor(virQEMUDriverPtr driver, * in the meantime). */ int -qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjEnterMonitorAsync(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob) { - return qemuDomainObjEnterMonitorInternal(driver, obj, asyncJob); + return qemuDomainObjEnterMonitorInternal(obj, asyncJob); } @@ -7130,10 +7125,10 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver, return -1; } else { priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); /* we continue on even in the face of error */ qemuMonitorDeleteSnapshot(priv->mon, snap->def->name); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } } @@ -7293,12 +7288,12 @@ qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver, { bool haveJob; - haveJob = qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) >= 0; + haveJob = qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) >= 0; qemuDomainRemoveInactive(driver, vm); if (haveJob) - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } @@ -7314,12 +7309,12 @@ qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver, { bool haveJob; - haveJob = qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) >= 0; + haveJob = qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) >= 0; qemuDomainRemoveInactiveLocked(driver, vm); if (haveJob) - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } @@ -8334,18 +8329,17 @@ qemuDomainHasBlockjob(virDomainObjPtr vm, int -qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainUpdateDeviceList(virDomainObjPtr vm, int asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; char **aliases; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetDeviceAliases(priv->mon, &aliases); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (rc < 0) return -1; @@ -8357,8 +8351,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, int -qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainUpdateMemoryDeviceInfo(virDomainObjPtr vm, int asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -8369,12 +8362,12 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, if (vm->def->nmems == 0) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMemoryDeviceInfo(priv->mon, &meminfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { virHashFree(meminfo); return -1; } @@ -9640,7 +9633,6 @@ qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm) /** * qemuDomainRefreshVcpuInfo: - * @driver: qemu driver data * @vm: domain object * @asyncJob: current asynchronous job type * @state: refresh vcpu state @@ -9653,8 +9645,7 @@ qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm) * Returns 0 on success and -1 on fatal error. */ int -qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRefreshVcpuInfo(virDomainObjPtr vm, int asyncJob, bool state) { @@ -9675,13 +9666,13 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, VIR_DEBUG("Maxvcpus %zu hotplug %d fast query %d", maxvcpus, hotplug, fast); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, hotplug, fast); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (rc < 0) @@ -9793,7 +9784,6 @@ qemuDomainGetVcpuHalted(virDomainObjPtr vm, /** * qemuDomainRefreshVcpuHalted: - * @driver: qemu driver data * @vm: domain object * @asyncJob: current asynchronous job type * @@ -9802,8 +9792,7 @@ qemuDomainGetVcpuHalted(virDomainObjPtr vm, * Returns 0 on success and -1 on error */ int -qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRefreshVcpuHalted(virDomainObjPtr vm, int asyncJob) { virDomainVcpuDefPtr vcpu; @@ -9828,14 +9817,14 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, QEMU_CAPS_QUERY_CPUS_FAST)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; fast = virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps, QEMU_CAPS_QUERY_CPUS_FAST); haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus, fast); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap) + if (qemuDomainObjExitMonitor(vm) < 0 || !haltedmap) goto cleanup; for (i = 0; i < maxvcpus; i++) { @@ -10259,19 +10248,18 @@ qemuDomainVcpuPersistOrder(virDomainDefPtr def) int -qemuDomainCheckMonitor(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainCheckMonitor(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorCheck(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return ret; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 1e180bf684..ec2c93105f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -578,15 +578,12 @@ void qemuDomainEventFlush(int timer, void *opaque); qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm) ATTRIBUTE_NONNULL(1); -void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver, - virDomainObjPtr obj) +void qemuDomainObjEnterMonitor(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int qemuDomainObjExitMonitor(virQEMUDriverPtr driver, - virDomainObjPtr obj) +int qemuDomainObjExitMonitor(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjEnterMonitorAsync(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; @@ -802,11 +799,9 @@ extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; extern virDomainABIStability virQEMUDriverDomainABIStability; extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie; -int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm, int asyncJob); +int qemuDomainUpdateDeviceList(virDomainObjPtr vm, int asyncJob); -int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainUpdateMemoryDeviceInfo(virDomainObjPtr vm, int asyncJob); bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, @@ -870,13 +865,11 @@ bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm); bool qemuDomainHasVcpuPids(virDomainObjPtr vm); pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid); int qemuDomainValidateVcpuInfo(virDomainObjPtr vm); -int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainRefreshVcpuInfo(virDomainObjPtr vm, int asyncJob, bool state); bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu); -int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainRefreshVcpuHalted(virDomainObjPtr vm, int asyncJob); bool qemuDomainSupportsNicdev(virDomainDefPtr def, @@ -971,8 +964,7 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def) void qemuDomainVcpuPersistOrder(virDomainDefPtr def) ATTRIBUTE_NONNULL(1); -int qemuDomainCheckMonitor(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainCheckMonitor(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video, diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index 3480be88c3..745c7fedda 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -217,8 +217,7 @@ qemuDomainTrackJob(qemuDomainJob job) void -qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjSetJobPhase(virDomainObjPtr obj, int phase) { qemuDomainObjPrivatePtr priv = obj->privateData; @@ -239,7 +238,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, priv->job.phase = phase; priv->job.asyncOwner = me; - qemuDomainObjSaveStatus(driver, obj); + priv->job.cb->saveStatus(obj); } void @@ -255,14 +254,13 @@ qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj, } void -qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) +qemuDomainObjDiscardAsyncJob(virDomainObjPtr obj) { qemuDomainObjPrivatePtr priv = obj->privateData; - if (priv->job.active == QEMU_JOB_ASYNC_NESTED) qemuDomainObjResetJob(&priv->job); qemuDomainObjResetAsyncJob(&priv->job); - qemuDomainObjSaveStatus(driver, obj); + priv->job.cb->saveStatus(obj); } void @@ -311,7 +309,6 @@ qemuDomainObjCanSetJob(qemuDomainJobObjPtr job, /** * qemuDomainObjBeginJobInternal: - * @driver: qemu driver * @obj: domain object * @job: qemuDomainJob to start * @asyncJob: qemuDomainAsyncJob to start @@ -332,8 +329,8 @@ qemuDomainObjCanSetJob(qemuDomainJobObjPtr job, * -1 otherwise. */ static int ATTRIBUTE_NONNULL(1) -qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjBeginJobInternal(virDomainObjPtr obj, + qemuDomainJobObjPtr jobObj, qemuDomainJob job, qemuDomainAgentJob agentJob, qemuDomainAsyncJob asyncJob, @@ -439,7 +436,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, } if (qemuDomainTrackJob(job)) - qemuDomainObjSaveStatus(driver, obj); + jobObj->cb->saveStatus(obj); return 0; @@ -543,11 +540,13 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, * * Successful calls must be followed by EndJob eventually */ -int qemuDomainObjBeginJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginJob(virDomainObjPtr obj, qemuDomainJob job) { - if (qemuDomainObjBeginJobInternal(driver, obj, job, + qemuDomainObjPrivatePtr priv = obj->privateData; + qemuDomainJobObjPtr jobObj = &priv->job; + + if (qemuDomainObjBeginJobInternal(obj, jobObj, job, QEMU_AGENT_JOB_NONE, QEMU_ASYNC_JOB_NONE, false) < 0) return -1; @@ -563,37 +562,36 @@ int qemuDomainObjBeginJob(virQEMUDriverPtr driver, * To end job call qemuDomainObjEndAgentJob. */ int -qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjBeginAgentJob(virDomainObjPtr obj, qemuDomainAgentJob agentJob) { - return qemuDomainObjBeginJobInternal(driver, obj, QEMU_JOB_NONE, + qemuDomainObjPrivatePtr priv = obj->privateData; + qemuDomainJobObjPtr jobObj = &priv->job; + + return qemuDomainObjBeginJobInternal(obj, jobObj, QEMU_JOB_NONE, agentJob, QEMU_ASYNC_JOB_NONE, false); } -int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginAsyncJob(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob, virDomainJobOperation operation, unsigned long apiFlags) { - qemuDomainObjPrivatePtr priv; + qemuDomainObjPrivatePtr priv = obj->privateData; - if (qemuDomainObjBeginJobInternal(driver, obj, QEMU_JOB_ASYNC, + if (qemuDomainObjBeginJobInternal(obj, &priv->job, QEMU_JOB_ASYNC, QEMU_AGENT_JOB_NONE, asyncJob, false) < 0) return -1; - priv = obj->privateData; priv->job.cb->jobcb->setJobInfoOperation(&priv->job, operation); priv->job.apiFlags = apiFlags; return 0; } int -qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjBeginNestedJob(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = obj->privateData; @@ -610,7 +608,7 @@ qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver, priv->job.asyncOwner); } - return qemuDomainObjBeginJobInternal(driver, obj, + return qemuDomainObjBeginJobInternal(obj, &priv->job, QEMU_JOB_ASYNC_NESTED, QEMU_AGENT_JOB_NONE, QEMU_ASYNC_JOB_NONE, @@ -620,7 +618,6 @@ qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver, /** * qemuDomainObjBeginJobNowait: * - * @driver: qemu driver * @obj: domain object * @job: qemuDomainJob to start * @@ -631,11 +628,13 @@ qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver, * Returns: see qemuDomainObjBeginJobInternal */ int -qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver, - virDomainObjPtr obj, +qemuDomainObjBeginJobNowait(virDomainObjPtr obj, qemuDomainJob job) { - return qemuDomainObjBeginJobInternal(driver, obj, job, + qemuDomainObjPrivatePtr priv = obj->privateData; + qemuDomainJobObjPtr jobObj = &priv->job; + + return qemuDomainObjBeginJobInternal(obj, jobObj, job, QEMU_AGENT_JOB_NONE, QEMU_ASYNC_JOB_NONE, true); } @@ -647,7 +646,7 @@ qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver, * earlier qemuDomainBeginJob() call */ void -qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj) +qemuDomainObjEndJob(virDomainObjPtr obj) { qemuDomainObjPrivatePtr priv = obj->privateData; qemuDomainJob job = priv->job.active; @@ -661,7 +660,7 @@ qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj) qemuDomainObjResetJob(&priv->job); if (qemuDomainTrackJob(job)) - qemuDomainObjSaveStatus(driver, obj); + priv->job.cb->saveStatus(obj); /* We indeed need to wake up ALL threads waiting because * grabbing a job requires checking more variables. */ virCondBroadcast(&priv->job.cond); @@ -687,7 +686,7 @@ qemuDomainObjEndAgentJob(virDomainObjPtr obj) } void -qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) +qemuDomainObjEndAsyncJob(virDomainObjPtr obj) { qemuDomainObjPrivatePtr priv = obj->privateData; @@ -698,7 +697,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) obj, obj->def->name); qemuDomainObjResetAsyncJob(&priv->job); - qemuDomainObjSaveStatus(driver, obj); + priv->job.cb->saveStatus(obj); virCondBroadcast(&priv->job.asyncCond); } diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 211503b439..32ff01009d 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -104,6 +104,7 @@ typedef qemuDomainJobObj *qemuDomainJobObjPtr; typedef void *(*qemuDomainObjPrivateJobAlloc)(void); typedef void (*qemuDomainObjPrivateJobFree)(void *); typedef void (*qemuDomainObjPrivateJobReset)(void *); +typedef void (*qemuDomainObjPrivateSaveStatus)(virDomainObjPtr); typedef int (*qemuDomainObjPrivateJobFormat)(virBufferPtr, qemuDomainJobObjPtr, virDomainObjPtr); @@ -137,6 +138,9 @@ struct _qemuDomainJobPrivateJobCallbacks { typedef struct _qemuDomainJobPrivateCallbacks qemuDomainJobPrivateCallbacks; typedef qemuDomainJobPrivateCallbacks *qemuDomainJobPrivateCallbacksPtr; struct _qemuDomainJobPrivateCallbacks { + /* generic callbacks that we can't really categorize */ + qemuDomainObjPrivateSaveStatus saveStatus; + /* Job related callbacks */ qemuDomainJobPrivateJobCallbacksPtr jobcb; }; @@ -177,44 +181,35 @@ const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job, const char *phase); -int qemuDomainObjBeginJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginJob(virDomainObjPtr obj, qemuDomainJob job) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginAgentJob(virDomainObjPtr obj, qemuDomainAgentJob agentJob) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginAsyncJob(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob, virDomainJobOperation operation, unsigned long apiFlags) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginNestedJob(virDomainObjPtr obj, qemuDomainAsyncJob asyncJob) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver, - virDomainObjPtr obj, +int qemuDomainObjBeginJobNowait(virDomainObjPtr obj, qemuDomainJob job) G_GNUC_WARN_UNUSED_RESULT; -void qemuDomainObjEndJob(virQEMUDriverPtr driver, - virDomainObjPtr obj); +void qemuDomainObjEndJob(virDomainObjPtr obj); void qemuDomainObjEndAgentJob(virDomainObjPtr obj); -void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, - virDomainObjPtr obj); +void qemuDomainObjEndAsyncJob(virDomainObjPtr obj); void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj); -void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, - virDomainObjPtr obj, +void qemuDomainObjSetJobPhase(virDomainObjPtr obj, int phase); void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj, unsigned long long allowedJobs); int qemuDomainObjRestoreJob(virDomainObjPtr obj, qemuDomainJobObjPtr job); -void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver, - virDomainObjPtr obj); +void qemuDomainObjDiscardAsyncJob(virDomainObjPtr obj); void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj); bool qemuDomainTrackJob(qemuDomainJob job); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 77d9a841ed..76f1c12f09 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -207,8 +207,7 @@ qemuAutostartDomain(virDomainObjPtr vm, virResetLastError(); if (vm->autostart && !virDomainObjIsActive(vm)) { - if (qemuProcessBeginJob(driver, vm, - VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) { + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to start job on VM '%s': %s"), vm->def->name, virGetLastErrorMessage()); @@ -222,7 +221,7 @@ qemuAutostartDomain(virDomainObjPtr vm, vm->def->name, virGetLastErrorMessage()); } - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); } ret = 0; @@ -1764,7 +1763,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, goto cleanup; def = NULL; - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_START, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) { qemuDomainRemoveInactiveJob(driver, vm); goto cleanup; @@ -1776,7 +1775,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, start_flags) < 0) { virDomainAuditStart(vm, "booted", false); qemuDomainRemoveInactive(driver, vm); - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); goto cleanup; } @@ -1797,7 +1796,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); cleanup: virDomainDefFree(def); @@ -1828,7 +1827,7 @@ static int qemuDomainSuspend(virDomainPtr dom) cfg = virQEMUDriverGetConfig(driver); priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_SUSPEND) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_SUSPEND) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1855,7 +1854,7 @@ static int qemuDomainSuspend(virDomainPtr dom) ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -1881,7 +1880,7 @@ static int qemuDomainResume(virDomainPtr dom) if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1913,7 +1912,7 @@ static int qemuDomainResume(virDomainPtr dom) ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -1932,8 +1931,7 @@ qemuDomainShutdownFlagsAgent(virQEMUDriverPtr driver, int agentFlag = isReboot ? QEMU_AGENT_SHUTDOWN_REBOOT : QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(driver, vm, - QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { @@ -1966,7 +1964,7 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriverPtr driver, priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { @@ -1976,13 +1974,13 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriverPtr driver, } qemuDomainSetFakeReboot(driver, vm, isReboot); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemPowerdown(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -2065,8 +2063,7 @@ qemuDomainRebootAgent(virQEMUDriverPtr driver, if (!isReboot) agentFlag = QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(driver, vm, - QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) return -1; if (!qemuDomainAgentAvailable(vm, agentForced)) @@ -2094,21 +2091,20 @@ qemuDomainRebootMonitor(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, - QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) goto endjob; qemuDomainSetFakeReboot(driver, vm, isReboot); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemPowerdown(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -2171,7 +2167,6 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) static int qemuDomainReset(virDomainPtr dom, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; qemuDomainObjPrivatePtr priv; @@ -2185,16 +2180,16 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) if (virDomainResetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; priv->fakeReboot = false; @@ -2204,7 +2199,7 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_CRASHED); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -2258,7 +2253,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, reason == VIR_DOMAIN_PAUSED_STARTING_UP && !priv->beingDestroyed); - if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, + if (qemuProcessBeginStopJob(vm, QEMU_JOB_DESTROY, !(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < 0) goto cleanup; @@ -2289,7 +2284,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, endjob: if (ret == 0) qemuDomainRemoveInactive(driver, vm); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -2363,7 +2358,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (virDomainSetMemoryFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2426,9 +2421,9 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (def) { priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); r = qemuMonitorSetBalloon(priv->mon, newmem); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || r < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || r < 0) goto endjob; /* Lack of balloon support is a fatal error */ @@ -2450,7 +2445,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -2489,7 +2484,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, if (virDomainSetMemoryStatsPeriodEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2506,9 +2501,9 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); r = qemuMonitorSetMemoryStatsPeriod(priv->mon, def->memballoon, period); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (r < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -2535,7 +2530,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -2544,7 +2539,6 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) { - virQEMUDriverPtr driver = domain->conn->privateData; virDomainObjPtr vm = NULL; int ret = -1; qemuDomainObjPrivatePtr priv; @@ -2559,19 +2553,19 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorInjectNMI(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -2585,7 +2579,6 @@ static int qemuDomainSendKey(virDomainPtr domain, int nkeycodes, unsigned int flags) { - virQEMUDriverPtr driver = domain->conn->privateData; virDomainObjPtr vm = NULL; int ret = -1; qemuDomainObjPrivatePtr priv; @@ -2619,19 +2612,19 @@ static int qemuDomainSendKey(virDomainPtr domain, if (virDomainSendKeyEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -3323,7 +3316,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) goto cleanup; - if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_SAVE, VIR_DOMAIN_JOB_OPERATION_SAVE, flags) < 0) goto cleanup; @@ -3417,7 +3410,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virErrorRestore(&save_err); } } - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); if (ret == 0) qemuDomainRemoveInactiveJob(driver, vm); @@ -3763,7 +3756,7 @@ qemuDumpToFd(virQEMUDriverPtr driver, else g_clear_pointer(&jobPriv->current, qemuDomainJobInfoFree); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (dumpformat) { @@ -3774,14 +3767,14 @@ qemuDumpToFd(virQEMUDriverPtr driver, _("unsupported dumpformat '%s' " "for this QEMU binary"), dumpformat); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); return -1; } } ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, detach); - if ((qemuDomainObjExitMonitor(driver, vm) < 0) || ret < 0) + if ((qemuDomainObjExitMonitor(vm) < 0) || ret < 0) return -1; if (detach) @@ -3914,8 +3907,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, if (virDomainCoreDumpWithFormatEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAsyncJob(driver, vm, - QEMU_ASYNC_JOB_DUMP, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) goto cleanup; @@ -3962,9 +3954,9 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, } else if (((resume && paused) || (flags & VIR_DUMP_RESET)) && virDomainObjIsActive(vm)) { if ((ret == 0) && (flags & VIR_DUMP_RESET)) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; } @@ -3982,7 +3974,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, } } - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); if (ret == 0 && flags & VIR_DUMP_CRASH) qemuDomainRemoveInactiveJob(driver, vm); @@ -4032,7 +4024,7 @@ qemuDomainScreenshot(virDomainPtr dom, if (virDomainScreenshotEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -4080,12 +4072,12 @@ qemuDomainScreenshot(virDomainPtr dom, qemuSecurityDomainSetPathLabel(driver, vm, tmp, false); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto endjob; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (VIR_CLOSE(tmp_fd) < 0) { @@ -4106,7 +4098,7 @@ qemuDomainScreenshot(virDomainPtr dom, if (unlink_tmp) unlink(tmp); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -4153,8 +4145,7 @@ processWatchdogEvent(virQEMUDriverPtr driver, switch (action) { case VIR_DOMAIN_WATCHDOG_ACTION_DUMP: - if (qemuDomainObjBeginAsyncJob(driver, vm, - QEMU_ASYNC_JOB_DUMP, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) { return; @@ -4182,7 +4173,7 @@ processWatchdogEvent(virQEMUDriverPtr driver, } endjob: - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); } static int @@ -4231,7 +4222,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, bool removeInactive = false; unsigned long flags = VIR_DUMP_MEMORY_ONLY; - if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_DUMP, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) return; @@ -4297,7 +4288,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, } endjob: - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); if (removeInactive) qemuDomainRemoveInactiveJob(driver, vm); } @@ -4314,7 +4305,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver, VIR_DEBUG("Removing device %s from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4323,7 +4314,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver, } if (STRPREFIX(devAlias, "vcpu")) { - qemuDomainRemoveVcpuAlias(driver, vm, devAlias); + qemuDomainRemoveVcpuAlias(vm, devAlias); } else { if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) goto endjob; @@ -4337,7 +4328,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver, devAlias); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } @@ -4538,8 +4529,7 @@ syncNicRxFilterMulticast(char *ifname, } static void -processNicRxFilterChangedEvent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +processNicRxFilterChangedEvent(virDomainObjPtr vm, const char *devAlias) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -4553,7 +4543,7 @@ processNicRxFilterChangedEvent(virQEMUDriverPtr driver, "from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -4590,9 +4580,9 @@ processNicRxFilterChangedEvent(virQEMUDriverPtr driver, VIR_DEBUG("process NIC_RX_FILTER_CHANGED event for network " "device %s in domain %s", def->info.alias, vm->def->name); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorQueryRxFilter(priv->mon, devAlias, &guestFilter); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) goto endjob; @@ -4635,7 +4625,7 @@ processNicRxFilterChangedEvent(virQEMUDriverPtr driver, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virNetDevRxFilterFree(hostFilter); @@ -4681,7 +4671,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver, memset(&dev, 0, sizeof(dev)); } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4722,13 +4712,12 @@ processSerialChangedEvent(virQEMUDriverPtr driver, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } static void -processBlockJobEvent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +processBlockJobEvent(virDomainObjPtr vm, const char *diskAlias, int type, int status) @@ -4736,7 +4725,7 @@ processBlockJobEvent(virQEMUDriverPtr driver, virDomainDiskDefPtr disk; g_autoptr(qemuBlockJobData) job = NULL; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4761,16 +4750,15 @@ processBlockJobEvent(virQEMUDriverPtr driver, qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } static void -processJobStatusChangeEvent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +processJobStatusChangeEvent(virDomainObjPtr vm, qemuBlockJobDataPtr job) { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4781,7 +4769,7 @@ processJobStatusChangeEvent(virQEMUDriverPtr driver, qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } @@ -4796,7 +4784,7 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, unsigned int stopFlags = 0; virObjectEventPtr event = NULL; - if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, true) < 0) + if (qemuProcessBeginStopJob(vm, QEMU_JOB_DESTROY, true) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4827,7 +4815,7 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, endjob: qemuDomainRemoveInactive(driver, vm); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } @@ -4925,20 +4913,19 @@ static void qemuProcessEventHandler(void *data, void *opaque) processDeviceDeletedEvent(driver, vm, processEvent->data); break; case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED: - processNicRxFilterChangedEvent(driver, vm, processEvent->data); + processNicRxFilterChangedEvent(vm, processEvent->data); break; case QEMU_PROCESS_EVENT_SERIAL_CHANGED: processSerialChangedEvent(driver, vm, processEvent->data, processEvent->action); break; case QEMU_PROCESS_EVENT_BLOCK_JOB: - processBlockJobEvent(driver, vm, - processEvent->data, + processBlockJobEvent(vm, processEvent->data, processEvent->action, processEvent->status); break; case QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE: - processJobStatusChangeEvent(driver, vm, processEvent->data); + processJobStatusChangeEvent(vm, processEvent->data); break; case QEMU_PROCESS_EVENT_MONITOR_EOF: processMonitorEOFEvent(driver, vm); @@ -5082,10 +5069,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, if (useAgent) { - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; } else { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; } @@ -5104,7 +5091,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, if (useAgent) qemuDomainObjEndAgentJob(vm); else - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -5227,7 +5214,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, if (virDomainPinVcpuFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5266,7 +5253,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -5355,7 +5342,7 @@ qemuDomainPinEmulator(virDomainPtr dom, if (virDomainPinEmulatorEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5422,7 +5409,7 @@ qemuDomainPinEmulator(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: if (cgroup_emulator) @@ -5517,7 +5504,6 @@ qemuDomainGetVcpus(virDomainPtr dom, static int qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; virDomainDefPtr def; int ret = -1; @@ -5541,7 +5527,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) goto cleanup; if (flags & VIR_DOMAIN_VCPU_GUEST) { - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -5598,16 +5584,15 @@ qemuDomainGetMaxVcpus(virDomainPtr dom) static int -qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetIOThreadsMon(virDomainObjPtr vm, qemuMonitorIOThreadInfoPtr **iothreads) { qemuDomainObjPrivatePtr priv = vm->privateData; int niothreads = 0; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || niothreads < 0) return -1; return niothreads; @@ -5615,8 +5600,7 @@ qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver, static int -qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetIOThreadsLive(virDomainObjPtr vm, virDomainIOThreadInfoPtr **info) { qemuDomainObjPrivatePtr priv; @@ -5626,7 +5610,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -5642,7 +5626,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, goto endjob; } - if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0) + if ((niothreads = qemuDomainGetIOThreadsMon(vm, &iothreads)) < 0) goto endjob; /* Nothing to do */ @@ -5676,7 +5660,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, ret = niothreads; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: if (info_ret) { @@ -5753,7 +5737,6 @@ qemuDomainGetIOThreadInfo(virDomainPtr dom, virDomainIOThreadInfoPtr **info, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; virDomainDefPtr targetDef = NULL; int ret = -1; @@ -5771,7 +5754,7 @@ qemuDomainGetIOThreadInfo(virDomainPtr dom, goto cleanup; if (!targetDef) - ret = qemuDomainGetIOThreadsLive(driver, vm, info); + ret = qemuDomainGetIOThreadsLive(vm, info); else ret = qemuDomainGetIOThreadsConfig(targetDef, info); @@ -5815,7 +5798,7 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virDomainPinIOThreadEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5904,7 +5887,7 @@ qemuDomainPinIOThread(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: if (cgroup_iothread) @@ -5916,8 +5899,7 @@ qemuDomainPinIOThread(virDomainPtr dom, } static int -qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainHotplugAddIOThread(virDomainObjPtr vm, unsigned int iothread_id) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -5937,7 +5919,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, if (qemuMonitorCreateObjectProps(&props, "iothread", alias, NULL) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorAddObject(priv->mon, &props, NULL) < 0) goto exit_monitor; @@ -5952,7 +5934,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, &new_iothreads)) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (new_niothreads != exp_niothreads) { @@ -6001,14 +5983,13 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, return ret; exit_monitor: - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto cleanup; } static int -qemuDomainHotplugModIOThread(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainHotplugModIOThread(virDomainObjPtr vm, qemuMonitorIOThreadInfo iothread) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -6020,11 +6001,11 @@ qemuDomainHotplugModIOThread(virQEMUDriverPtr driver, return -1; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetIOThread(priv->mon, &iothread); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (rc < 0) @@ -6035,8 +6016,7 @@ qemuDomainHotplugModIOThread(virQEMUDriverPtr driver, static int -qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainHotplugDelIOThread(virDomainObjPtr vm, unsigned int iothread_id) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -6052,7 +6032,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, if (!(alias = g_strdup_printf("iothread%u", iothread_id))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelObject(priv->mon, alias, true); exp_niothreads--; @@ -6063,7 +6043,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, &new_iothreads)) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (new_niothreads != exp_niothreads) { @@ -6093,7 +6073,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, return ret; exit_monitor: - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto cleanup; } @@ -6268,7 +6248,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -6286,7 +6266,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, if (qemuDomainAddIOThreadCheck(def, iothread.iothread_id) < 0) goto endjob; - if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0) + if (qemuDomainHotplugAddIOThread(vm, iothread.iothread_id) < 0) goto endjob; break; @@ -6295,7 +6275,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, if (qemuDomainDelIOThreadCheck(def, iothread.iothread_id) < 0) goto endjob; - if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0) + if (qemuDomainHotplugDelIOThread(vm, iothread.iothread_id) < 0) goto endjob; break; @@ -6308,7 +6288,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, goto endjob; } - if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) + if (qemuDomainHotplugModIOThread(vm, iothread) < 0) goto endjob; break; @@ -6355,7 +6335,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -7047,14 +7027,14 @@ qemuDomainRestoreFlags(virConnectPtr conn, priv->hookRun = true; } - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_RESTORE, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_RESTORE, flags) < 0) goto cleanup; ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, data, path, false, QEMU_ASYNC_JOB_START); - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); cleanup: virDomainDefFree(def); @@ -7576,7 +7556,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_START, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) goto cleanup; @@ -7594,7 +7574,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) ret = 0; endjob: - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -7724,7 +7704,7 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (virDomainUndefineFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!vm->persistent) { @@ -7820,7 +7800,7 @@ qemuDomainUndefineFlags(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -7853,7 +7833,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, break; case VIR_DOMAIN_DEVICE_CONTROLLER: - ret = qemuDomainAttachControllerDevice(driver, vm, dev->data.controller); + ret = qemuDomainAttachControllerDevice(vm, dev->data.controller); if (!ret) { alias = dev->data.controller->info.alias; dev->data.controller = NULL; @@ -7940,7 +7920,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, break; case VIR_DOMAIN_DEVICE_INPUT: - ret = qemuDomainAttachInputDevice(driver, vm, dev->data.input); + ret = qemuDomainAttachInputDevice(vm, dev->data.input); if (ret == 0) { alias = dev->data.input->info.alias; dev->data.input = NULL; @@ -7948,7 +7928,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, break; case VIR_DOMAIN_DEVICE_VSOCK: - ret = qemuDomainAttachVsockDevice(driver, vm, dev->data.vsock); + ret = qemuDomainAttachVsockDevice(vm, dev->data.vsock); if (ret == 0) { alias = dev->data.vsock->info.alias; dev->data.vsock = NULL; @@ -7984,7 +7964,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, } if (ret == 0) - ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); + ret = qemuDomainUpdateDeviceList(vm, QEMU_ASYNC_JOB_NONE); return ret; } @@ -8076,7 +8056,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm, return -1; } - ret = qemuDomainChangeNet(driver, vm, dev); + ret = qemuDomainChangeNet(vm, dev); break; case VIR_DOMAIN_DEVICE_FS: @@ -8792,7 +8772,7 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, if (virDomainAttachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8804,7 +8784,7 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -8849,7 +8829,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, if (virDomainUpdateDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8918,7 +8898,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainDefFree(vmdef); @@ -8988,7 +8968,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver, if ((rc = qemuDomainDetachDeviceLive(vm, dev_copy, driver, false)) < 0) goto cleanup; - if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (rc == 0 && qemuDomainUpdateDeviceList(vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; /* @@ -9071,7 +9051,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver, if ((rc = qemuDomainDetachDeviceLive(vm, &dev, driver, true)) < 0) goto cleanup; - if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (rc == 0 && qemuDomainUpdateDeviceList(vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; } @@ -9104,7 +9084,7 @@ qemuDomainDetachDeviceFlags(virDomainPtr dom, if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -9116,7 +9096,7 @@ qemuDomainDetachDeviceFlags(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -9139,7 +9119,7 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, if (virDomainDetachDeviceAliasEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -9151,7 +9131,7 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -9212,7 +9192,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, autostart = (autostart != 0); if (vm->autostart != autostart) { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!(configFile = virDomainConfigFile(cfg->configDir, vm->def->name))) @@ -9250,7 +9230,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, vm->autostart = autostart; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } ret = 0; @@ -9358,7 +9338,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9392,7 +9372,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -9534,7 +9514,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; /* QEMU and LXC implementation are identical */ @@ -9565,7 +9545,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -9788,7 +9768,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, } } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9843,7 +9823,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virBitmapFree(nodeset); @@ -9997,7 +9977,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, if (virDomainSetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -10039,7 +10019,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -10052,7 +10032,6 @@ qemuDomainGetPerfEvents(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuDomainObjPrivatePtr priv; virDomainDefPtr def; @@ -10072,7 +10051,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, if (virDomainGetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (!(def = virDomainObjGetOneDef(vm, flags))) @@ -10101,7 +10080,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -10275,7 +10254,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -10509,7 +10488,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainDefFree(persistentDefCopy); @@ -10775,7 +10754,6 @@ qemuDomainBlockResize(virDomainPtr dom, unsigned long long size, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; int ret = -1; @@ -10804,7 +10782,7 @@ qemuDomainBlockResize(virDomainPtr dom, if (virDomainBlockResizeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10838,18 +10816,18 @@ qemuDomainBlockResize(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorBlockResize(priv->mon, device, nodename, size) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto endjob; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -10874,7 +10852,6 @@ qemuDomainBlockStatsGatherTotals(qemuBlockStatsPtr data, /** * qemuDomainBlocksStatsGather: - * @driver: driver object * @vm: domain object * @path: to gather the statistics for * @capacity: refresh capacity of the backing image @@ -10885,8 +10862,7 @@ qemuDomainBlockStatsGatherTotals(qemuBlockStatsPtr data, * Returns -1 on error; number of filled block statistics on success. */ static int -qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainBlocksStatsGather(virDomainObjPtr vm, const char *path, bool capacity, qemuBlockStatsPtr *retstats) @@ -10921,7 +10897,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, } } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats, false); if (capacity && nstats >= 0) { @@ -10931,7 +10907,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats, false); } - if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || nstats < 0 || rc < 0) goto cleanup; if (VIR_ALLOC(*retstats) < 0) @@ -10993,7 +10969,6 @@ qemuDomainBlockStats(virDomainPtr dom, const char *path, virDomainBlockStatsPtr stats) { - virQEMUDriverPtr driver = dom->conn->privateData; qemuBlockStatsPtr blockstats = NULL; int ret = -1; virDomainObjPtr vm; @@ -11004,13 +10979,13 @@ qemuDomainBlockStats(virDomainPtr dom, if (virDomainBlockStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - if (qemuDomainBlocksStatsGather(driver, vm, path, false, &blockstats) < 0) + if (qemuDomainBlocksStatsGather(vm, path, false, &blockstats) < 0) goto endjob; if (VIR_ASSIGN_IS_OVERFLOW(stats->rd_req, blockstats->rd_req) || @@ -11027,7 +11002,7 @@ qemuDomainBlockStats(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -11043,7 +11018,6 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuBlockStatsPtr blockstats = NULL; int nstats; @@ -11062,13 +11036,13 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, if (virDomainBlockStatsFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - if ((nstats = qemuDomainBlocksStatsGather(driver, vm, path, false, + if ((nstats = qemuDomainBlocksStatsGather(vm, path, false, &blockstats)) < 0) goto endjob; @@ -11115,7 +11089,7 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, *nparams = nstats; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: VIR_FREE(blockstats); @@ -11207,7 +11181,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, if (virDomainSetInterfaceParametersEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -11381,7 +11355,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virNetDevBandwidthFree(bandwidth); @@ -11501,8 +11475,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom, /* This functions assumes that job QEMU_JOB_QUERY is started by a caller */ static int -qemuDomainMemoryStatsInternal(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainMemoryStatsInternal(virDomainObjPtr vm, virDomainMemoryStatPtr stats, unsigned int nr_stats) @@ -11514,10 +11487,10 @@ qemuDomainMemoryStatsInternal(virQEMUDriverPtr driver, return -1; if (virDomainDefHasMemballoon(vm->def)) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm), vm->def->memballoon, stats, nr_stats); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0 || ret >= nr_stats) @@ -11544,7 +11517,6 @@ qemuDomainMemoryStats(virDomainPtr dom, unsigned int nr_stats, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; @@ -11556,12 +11528,12 @@ qemuDomainMemoryStats(virDomainPtr dom, if (virDomainMemoryStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; - ret = qemuDomainMemoryStatsInternal(driver, vm, stats, nr_stats); + ret = qemuDomainMemoryStatsInternal(vm, stats, nr_stats); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -11661,7 +11633,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -11680,19 +11652,19 @@ qemuDomainMemoryPeek(virDomainPtr dom, qemuSecurityDomainSetPathLabel(driver, vm, tmp, false); priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (flags == VIR_MEMORY_VIRTUAL) { if (qemuMonitorSaveVirtualMemory(priv->mon, offset, size, tmp) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto endjob; } } else { if (qemuMonitorSavePhysicalMemory(priv->mon, offset, size, tmp) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto endjob; } } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; /* Read the memory file into buffer. */ @@ -11706,7 +11678,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: VIR_FORCE_CLOSE(fd); @@ -11941,7 +11913,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, if (virDomainGetBlockInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (!(disk = virDomainDiskByName(vm->def, path, false))) { @@ -11970,7 +11942,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, goto endjob; } - if (qemuDomainBlocksStatsGather(driver, vm, path, true, &entry) < 0) + if (qemuDomainBlocksStatsGather(vm, path, true, &entry) < 0) goto endjob; if (!entry->wr_highest_offset_valid) { @@ -12013,7 +11985,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: VIR_FREE(entry); virDomainObjEndAPI(&vm); @@ -13494,8 +13466,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, static int -qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetJobInfoMigrationStats(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -13507,13 +13478,13 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver, jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) { if (events && jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE && - qemuMigrationAnyFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuMigrationAnyFetchStats(vm, QEMU_ASYNC_JOB_NONE, jobInfo, NULL) < 0) return -1; if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE && jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION && - qemuMigrationSrcFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuMigrationSrcFetchMirrorStats(vm, QEMU_ASYNC_JOB_NONE, jobInfo) < 0) return -1; @@ -13526,20 +13497,19 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver, static int -qemuDomainGetJobInfoDumpStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetJobInfoDumpStats(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuMonitorDumpStats stats = { 0 }; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; rc = qemuMonitorQueryDump(priv->mon, &stats); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; jobInfo->stats.dump = stats; @@ -13577,8 +13547,7 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriverPtr driver, static int -qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetJobStatsInternal(virDomainObjPtr vm, bool completed, qemuDomainJobInfoPtr *jobInfo) { @@ -13602,7 +13571,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, return -1; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -13617,17 +13586,17 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, switch ((*jobInfo)->statsType) { case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION: case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP: - if (qemuDomainGetJobInfoMigrationStats(driver, vm, *jobInfo) < 0) + if (qemuDomainGetJobInfoMigrationStats(vm, *jobInfo) < 0) goto cleanup; break; case QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP: - if (qemuDomainGetJobInfoDumpStats(driver, vm, *jobInfo) < 0) + if (qemuDomainGetJobInfoDumpStats(vm, *jobInfo) < 0) goto cleanup; break; case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP: - if (qemuBackupGetJobInfoStats(driver, vm, *jobInfo) < 0) + if (qemuBackupGetJobInfoStats(vm, *jobInfo) < 0) goto cleanup; break; @@ -13638,7 +13607,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, ret = 0; cleanup: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -13647,7 +13616,6 @@ static int qemuDomainGetJobInfo(virDomainPtr dom, virDomainJobInfoPtr info) { - virQEMUDriverPtr driver = dom->conn->privateData; g_autoptr(qemuDomainJobInfo) jobInfo = NULL; virDomainObjPtr vm; int ret = -1; @@ -13660,7 +13628,7 @@ qemuDomainGetJobInfo(virDomainPtr dom, if (virDomainGetJobInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainGetJobStatsInternal(driver, vm, false, &jobInfo) < 0) + if (qemuDomainGetJobStatsInternal(vm, false, &jobInfo) < 0) goto cleanup; if (!jobInfo || @@ -13684,7 +13652,6 @@ qemuDomainGetJobStats(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; qemuDomainJobPrivatePtr jobPriv; @@ -13703,7 +13670,7 @@ qemuDomainGetJobStats(virDomainPtr dom, priv = vm->privateData; jobPriv = priv->job.privateData; - if (qemuDomainGetJobStatsInternal(driver, vm, completed, &jobInfo) < 0) + if (qemuDomainGetJobStatsInternal(vm, completed, &jobInfo) < 0) goto cleanup; if (!jobInfo || @@ -13735,9 +13702,9 @@ qemuDomainAbortJobMigration(virDomainObjPtr vm) VIR_DEBUG("Cancelling migration job at client request"); qemuDomainObjAbortAsyncJob(vm); - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorMigrateCancel(priv->mon); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; @@ -13746,7 +13713,6 @@ qemuDomainAbortJobMigration(virDomainObjPtr vm) static int qemuDomainAbortJob(virDomainPtr dom) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; qemuDomainObjPrivatePtr priv; @@ -13759,7 +13725,7 @@ static int qemuDomainAbortJob(virDomainPtr dom) if (virDomainAbortJobEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_ABORT) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_ABORT) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13828,7 +13794,7 @@ static int qemuDomainAbortJob(virDomainPtr dom) } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -13841,7 +13807,6 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, unsigned long long downtime, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; g_autoptr(qemuMigrationParams) migParams = NULL; @@ -13856,7 +13821,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, if (virDomainMigrateSetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13875,20 +13840,20 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, downtime) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, QEMU_ASYNC_JOB_NONE, migParams) < 0) goto endjob; } else { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetMigrationDowntime(priv->mon, downtime); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; } ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -13901,7 +13866,6 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, unsigned long long *downtime, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuMigrationParamsPtr migParams = NULL; int ret = -1; @@ -13915,13 +13879,13 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, if (virDomainMigrateGetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - if (qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, QEMU_ASYNC_JOB_NONE, &migParams) < 0) goto endjob; @@ -13941,7 +13905,7 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: qemuMigrationParamsFree(migParams); @@ -13955,7 +13919,6 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, unsigned long long *cacheSize, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; g_autoptr(qemuMigrationParams) migParams = NULL; @@ -13970,7 +13933,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, if (virDomainMigrateGetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13986,7 +13949,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, } if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { - if (qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, QEMU_ASYNC_JOB_NONE, &migParams) < 0) goto endjob; @@ -13995,16 +13958,16 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, cacheSize) < 0) goto endjob; } else { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; } ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -14016,7 +13979,6 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, unsigned long long cacheSize, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; g_autoptr(qemuMigrationParams) migParams = NULL; @@ -14031,7 +13993,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, if (virDomainMigrateSetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14056,20 +14018,20 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, cacheSize) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, QEMU_ASYNC_JOB_NONE, migParams) < 0) goto endjob; } else { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; } ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -14081,7 +14043,6 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, unsigned long bandwidth, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; bool postcopy = !!(flags & VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY); @@ -14117,7 +14078,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14142,15 +14103,15 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, bandwidth * 1024 * 1024) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, QEMU_ASYNC_JOB_NONE, migParams) < 0) goto endjob; } else { int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; } @@ -14160,7 +14121,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -14169,8 +14130,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, static int -qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainMigrationGetPostcopyBandwidth(virDomainObjPtr vm, unsigned long *bandwidth) { g_autoptr(qemuMigrationParams) migParams = NULL; @@ -14178,13 +14138,13 @@ qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriverPtr driver, int rc; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) goto cleanup; - if (qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, QEMU_ASYNC_JOB_NONE, &migParams) < 0) goto cleanup; @@ -14215,7 +14175,7 @@ qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriverPtr driver, ret = 0; cleanup: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -14225,7 +14185,6 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom, unsigned long *bandwidth, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; bool postcopy = !!(flags & VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY); @@ -14242,7 +14201,7 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom, goto cleanup; if (postcopy) { - if (qemuDomainMigrationGetPostcopyBandwidth(driver, vm, bandwidth) < 0) + if (qemuDomainMigrationGetPostcopyBandwidth(vm, bandwidth) < 0) goto cleanup; } else { *bandwidth = priv->migMaxBandwidth; @@ -14260,7 +14219,6 @@ static int qemuDomainMigrateStartPostCopy(virDomainPtr dom, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuDomainObjPrivatePtr priv; int ret = -1; @@ -14273,7 +14231,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14296,13 +14254,13 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, } VIR_DEBUG("Starting post-copy"); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorMigrateStartPostCopy(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -14518,14 +14476,13 @@ qemuDomainSnapshotCreateActiveInternal(virQEMUDriverPtr driver, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0) { resume = false; goto cleanup; } ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) goto cleanup; @@ -15032,11 +14989,11 @@ qemuDomainSnapshotDiskCleanup(qemuDomainSnapshotDiskDataPtr data, * be set to NULL by qemuDomainSnapshotDiskUpdateSource */ if (data[i].src) { if (data[i].blockdevadded) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), data[i].crdata->srcdata[0]); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } } @@ -15103,8 +15060,7 @@ qemuDomainSnapshotDiskBitmapsPropagate(qemuDomainSnapshotDiskDataPtr dd, static int -qemuDomainSnapshotDiskPrepareOneBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainSnapshotDiskPrepareOneBlockdev(virDomainObjPtr vm, qemuDomainSnapshotDiskDataPtr dd, virQEMUDriverConfigPtr cfg, bool reuse, @@ -15130,13 +15086,13 @@ qemuDomainSnapshotDiskPrepareOneBlockdev(virQEMUDriverPtr driver, return -1; if (reuse) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), dd->crdata->srcdata[0]); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; } else { if (qemuBlockStorageSourceCreateDetectSize(blockNamedNodeData, @@ -15244,7 +15200,7 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver, dd->prepared = true; if (blockdev) { - if (qemuDomainSnapshotDiskPrepareOneBlockdev(driver, vm, dd, cfg, reuse, + if (qemuDomainSnapshotDiskPrepareOneBlockdev(vm, dd, cfg, reuse, blockNamedNodeData, asyncJob) < 0) return -1; @@ -15411,12 +15367,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) rc = -1; for (i = 0; i < ndiskdata; i++) { @@ -15474,7 +15430,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) { int freeze; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) { @@ -15617,7 +15573,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, } if (thaw != 0 && - qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) >= 0 && + qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) >= 0 && virDomainObjIsActive(vm)) { if (qemuDomainSnapshotFSThaw(vm, ret == 0 && thaw > 0) < 0) { /* helper reported the error, if it was needed */ @@ -15777,7 +15733,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, * a regular job, so we need to set the job mask to disallow query as * 'savevm' blocks the monitor. External snapshot will then modify the * job mask appropriately. */ - if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_SNAPSHOT, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT, flags) < 0) goto cleanup; @@ -15915,7 +15871,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, virDomainSnapshotObjListRemove(vm->snapshots, snap); } - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -16371,8 +16327,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, goto cleanup; } - if (qemuProcessBeginJob(driver, vm, - VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT, flags) < 0) goto cleanup; @@ -16544,11 +16499,10 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_START) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_START) < 0) goto endjob; rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (rc < 0) { /* XXX resume domain if it was running before the @@ -16665,7 +16619,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (qemuDomainSnapshotRevertInactive(driver, vm, snap) < 0) { qemuDomainRemoveInactive(driver, vm); - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); goto cleanup; } @@ -16690,7 +16644,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, virDomainAuditStart(vm, "from-snapshot", rc >= 0); if (rc < 0) { qemuDomainRemoveInactive(driver, vm); - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); goto cleanup; } detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; @@ -16727,7 +16681,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, ret = 0; endjob: - qemuProcessEndJob(driver, vm); + qemuProcessEndJob(vm); cleanup: if (ret == 0) { @@ -16821,7 +16775,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, if (virDomainSnapshotDeleteEnsureACL(snapshot->domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot))) @@ -16894,7 +16848,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17147,7 +17101,7 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, if (virDomainQemuMonitorCommandEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17159,13 +17113,13 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, hmp = !!(flags & VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorArbitraryCommand(priv->mon, cmd, result, hmp); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17327,8 +17281,7 @@ qemuDomainOpenChannel(virDomainPtr dom, * abort with pivot; this updates the VM definition as appropriate, on * either success or failure. */ static int -qemuDomainBlockPivot(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainBlockPivot(virDomainObjPtr vm, qemuBlockJobDataPtr job, virDomainDiskDefPtr disk) { @@ -17418,7 +17371,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, break; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (blockdev) { int rc = 0; @@ -17438,7 +17391,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, } else { ret = qemuMonitorDrivePivot(priv->mon, job->name); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; /* The pivot failed. The block job in QEMU remains in the synchronised state */ @@ -17463,7 +17416,6 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, unsigned int flags) { qemuDomainObjPrivatePtr priv = vm->privateData; - virQEMUDriverPtr driver = priv->driver; const char *device = NULL; const char *jobname = NULL; virDomainDiskDefPtr disk; @@ -17485,7 +17437,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17563,7 +17515,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, device = job->name; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (!blockdev && baseSource) basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, baseSource); @@ -17572,7 +17524,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, (!baseSource || basePath)) ret = qemuMonitorBlockStream(priv->mon, device, jobname, persistjob, basePath, nodebase, backingPath, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) @@ -17581,7 +17533,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, qemuBlockJobStarted(job, vm); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: qemuBlockJobStartupFinalize(vm, job); @@ -17615,7 +17567,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17645,15 +17597,15 @@ qemuDomainBlockJobAbort(virDomainPtr dom, qemuBlockJobSyncBegin(job); if (pivot) { - if ((ret = qemuDomainBlockPivot(driver, vm, job, disk)) < 0) + if ((ret = qemuDomainBlockPivot(vm, job, disk)) < 0) goto endjob; } else { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (blockdev) ret = qemuMonitorJobCancel(priv->mon, job->name, false); else ret = qemuMonitorBlockJobCancel(priv->mon, job->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { ret = -1; goto endjob; } @@ -17698,7 +17650,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, endjob: if (job && !async) qemuBlockJobSyncEnd(vm, job, QEMU_ASYNC_JOB_NONE); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17760,7 +17712,6 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, virDomainBlockJobInfoPtr info, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; virDomainDiskDefPtr disk; int ret = -1; @@ -17776,7 +17727,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17790,9 +17741,9 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), job->name, &rawInfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret <= 0) goto endjob; @@ -17804,7 +17755,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, } endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17818,7 +17769,6 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, unsigned long bandwidth, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainDiskDefPtr disk; int ret = -1; virDomainObjPtr vm; @@ -17844,7 +17794,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, if (virDomainBlockJobSetSpeedEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17859,15 +17809,15 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorBlockJobSetSpeed(qemuDomainGetMonitor(vm), job->name, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -18046,7 +17996,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, return -1; } - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -18254,9 +18204,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, } if (data) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuBlockStorageSourceChainAttach(priv->mon, data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (rc < 0) @@ -18275,7 +18225,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE; /* Actually start the mirroring */ - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (blockdev) { ret = qemuMonitorBlockdevMirror(priv->mon, job->name, true, @@ -18291,7 +18241,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, } virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) { qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); @@ -18309,12 +18259,12 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (ret < 0 && virDomainObjIsActive(vm)) { if (data || crdata) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (data) qemuBlockStorageSourceChainDetach(priv->mon, data); if (crdata) qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } if (need_revoke) qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); @@ -18322,7 +18272,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (need_unlink && virStorageFileUnlink(mirror) < 0) VIR_WARN("%s", _("unable to remove just-created copy target")); virStorageFileDeinit(mirror); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); qemuBlockJobStartupFinalize(vm, job); return ret; @@ -18546,7 +18496,7 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -18723,7 +18673,7 @@ qemuDomainBlockCommit(virDomainPtr dom, device = job->name; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (!blockdev) { basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, @@ -18737,7 +18687,7 @@ qemuDomainBlockCommit(virDomainPtr dom, topPath, nodetop, basePath, nodebase, backingPath, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) { + if (qemuDomainObjExitMonitor(vm) < 0 || ret < 0) { ret = -1; goto endjob; } @@ -18762,7 +18712,7 @@ qemuDomainBlockCommit(virDomainPtr dom, virErrorRestore(&orig_err); } qemuBlockJobStartupFinalize(vm, job); - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -18789,7 +18739,7 @@ qemuDomainOpenGraphics(virDomainPtr dom, if (virDomainOpenGraphicsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -18827,14 +18777,14 @@ qemuDomainOpenGraphics(virDomainPtr dom, if (qemuSecuritySetImageFDLabel(driver->securityManager, vm->def, fd) < 0) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, fd, "graphicsfd", (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH) != 0); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -18902,14 +18852,14 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom, if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, pair[1], "graphicsfd", (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); if (ret < 0) goto cleanup; @@ -19148,7 +19098,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, cfg = virQEMUDriverGetConfig(driver); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; priv = vm->privateData; @@ -19359,12 +19309,12 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, /* NB: Let's let QEMU decide how to handle issues with _length * via the JSON error code from the block_set_io_throttle call */ - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info, supportMaxOptions, set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME, supportMaxLengthOptions); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) goto endjob; @@ -19414,7 +19364,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: VIR_FREE(info.group_name); @@ -19433,7 +19383,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, unsigned int flags) { virDomainDiskDefPtr disk; - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuDomainObjPrivatePtr priv = NULL; virDomainDefPtr def = NULL; @@ -19459,7 +19408,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (virDomainGetBlockIoTuneEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; /* the API check guarantees that only one of the definitions will be set */ @@ -19501,9 +19450,9 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid, &reply); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (ret < 0) goto endjob; @@ -19572,7 +19521,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: VIR_FREE(reply.group_name); @@ -19586,7 +19535,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom, unsigned int nerrors, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuDomainObjPrivatePtr priv; virHashTablePtr table = NULL; @@ -19606,7 +19554,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19617,9 +19565,9 @@ qemuDomainGetDiskErrors(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); table = qemuMonitorGetBlockInfo(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (!table) goto endjob; @@ -19647,7 +19595,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, ret = n; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -19683,7 +19631,7 @@ qemuDomainSetMetadata(virDomainPtr dom, if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, @@ -19696,7 +19644,7 @@ qemuDomainSetMetadata(virDomainPtr dom, virObjectEventStateQueue(driver->domainEventState, ev); } - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -19776,17 +19724,16 @@ qemuDomainGetCPUStats(virDomainPtr domain, static int -qemuDomainProbeQMPCurrentMachine(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainProbeQMPCurrentMachine(virDomainObjPtr vm, bool *wakeupSupported) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuMonitorCurrentMachineInfo info = { 0 }; int rv; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorGetCurrentMachineInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || + if (qemuDomainObjExitMonitor(vm) < 0 || rv < 0) return -1; @@ -19797,8 +19744,7 @@ qemuDomainProbeQMPCurrentMachine(virQEMUDriverPtr driver, /* returns -1 on error, or if query is not supported, 0 if query was successful */ static int -qemuDomainQueryWakeupSuspendSupport(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainQueryWakeupSuspendSupport(virDomainObjPtr vm, bool *wakeupSupported) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -19807,29 +19753,28 @@ qemuDomainQueryWakeupSuspendSupport(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) return -1; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) return -1; if ((ret = virDomainObjCheckActive(vm)) < 0) goto endjob; - ret = qemuDomainProbeQMPCurrentMachine(driver, vm, wakeupSupported); + ret = qemuDomainProbeQMPCurrentMachine(vm, wakeupSupported); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } static int -qemuDomainPMSuspendAgent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainPMSuspendAgent(virDomainObjPtr vm, unsigned int target) { qemuAgentPtr agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) return -1; if ((ret = virDomainObjCheckActive(vm)) < 0) @@ -19854,7 +19799,6 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, unsigned long long duration, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; bool wakeupSupported; @@ -19889,7 +19833,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, * that don't know about this cap, will keep their old behavior of * suspending 'in the dark'. */ - if (qemuDomainQueryWakeupSuspendSupport(driver, vm, &wakeupSupported) == 0) { + if (qemuDomainQueryWakeupSuspendSupport(vm, &wakeupSupported) == 0) { if (!wakeupSupported) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("Domain does not have suspend support")); @@ -19914,7 +19858,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, } } - ret = qemuDomainPMSuspendAgent(driver, vm, target); + ret = qemuDomainPMSuspendAgent(vm, target); cleanup: virDomainObjEndAPI(&vm); @@ -19925,7 +19869,6 @@ static int qemuDomainPMWakeup(virDomainPtr dom, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; qemuDomainObjPrivatePtr priv; @@ -19938,7 +19881,7 @@ qemuDomainPMWakeup(virDomainPtr dom, if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19946,13 +19889,13 @@ qemuDomainPMWakeup(virDomainPtr dom, priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemWakeup(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -19995,7 +19938,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, if (virDomainQemuAgentCommandEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20070,7 +20013,6 @@ qemuDomainFSTrim(virDomainPtr dom, unsigned long long minimum, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuAgentPtr agent; int ret = -1; @@ -20090,7 +20032,7 @@ qemuDomainFSTrim(virDomainPtr dom, if (virDomainFSTrimEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20254,14 +20196,13 @@ qemuConnectGetCPUModelNames(virConnectPtr conn, static int -qemuDomainGetHostnameAgent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetHostnameAgent(virDomainObjPtr vm, char **hostname) { qemuAgentPtr agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -20282,8 +20223,7 @@ qemuDomainGetHostnameAgent(virQEMUDriverPtr driver, static int -qemuDomainGetHostnameLease(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetHostnameLease(virDomainObjPtr vm, char **hostname) { char macaddr[VIR_MAC_STRING_BUFLEN]; @@ -20293,7 +20233,7 @@ qemuDomainGetHostnameLease(virQEMUDriverPtr driver, size_t i, j; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -20335,7 +20275,7 @@ qemuDomainGetHostnameLease(virQEMUDriverPtr driver, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -20344,7 +20284,6 @@ static char * qemuDomainGetHostname(virDomainPtr dom, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; char *hostname = NULL; @@ -20365,10 +20304,10 @@ qemuDomainGetHostname(virDomainPtr dom, goto cleanup; if (flags & VIR_DOMAIN_GET_HOSTNAME_AGENT) { - if (qemuDomainGetHostnameAgent(driver, vm, &hostname) < 0) + if (qemuDomainGetHostnameAgent(vm, &hostname) < 0) goto cleanup; } else if (flags & VIR_DOMAIN_GET_HOSTNAME_LEASE) { - if (qemuDomainGetHostnameLease(driver, vm, &hostname) < 0) + if (qemuDomainGetHostnameLease(vm, &hostname) < 0) goto cleanup; } @@ -20391,7 +20330,6 @@ qemuDomainGetTime(virDomainPtr dom, unsigned int *nseconds, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuAgentPtr agent; int ret = -1; @@ -20405,7 +20343,7 @@ qemuDomainGetTime(virDomainPtr dom, if (virDomainGetTimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20433,8 +20371,7 @@ qemuDomainGetTime(virDomainPtr dom, static int -qemuDomainSetTimeAgent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainSetTimeAgent(virDomainObjPtr vm, long long seconds, unsigned int nseconds, bool rtcSync) @@ -20442,7 +20379,7 @@ qemuDomainSetTimeAgent(virQEMUDriverPtr driver, qemuAgentPtr agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -20467,7 +20404,6 @@ qemuDomainSetTime(virDomainPtr dom, unsigned int nseconds, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; qemuDomainObjPrivatePtr priv; virDomainObjPtr vm; bool rtcSync = flags & VIR_DOMAIN_TIME_SYNC; @@ -20496,10 +20432,10 @@ qemuDomainSetTime(virDomainPtr dom, goto cleanup; } - if (qemuDomainSetTimeAgent(driver, vm, seconds, nseconds, rtcSync) < 0) + if (qemuDomainSetTimeAgent(vm, seconds, nseconds, rtcSync) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20507,9 +20443,9 @@ qemuDomainSetTime(virDomainPtr dom, /* Don't try to call rtc-reset-reinjection if it's not available */ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorRTCResetReinjection(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (rv < 0) @@ -20519,7 +20455,7 @@ qemuDomainSetTime(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -20533,7 +20469,6 @@ qemuDomainFSFreeze(virDomainPtr dom, unsigned int nmountpoints, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; @@ -20545,7 +20480,7 @@ qemuDomainFSFreeze(virDomainPtr dom, if (virDomainFSFreezeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20568,7 +20503,6 @@ qemuDomainFSThaw(virDomainPtr dom, unsigned int nmountpoints, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; @@ -20586,7 +20520,7 @@ qemuDomainFSThaw(virDomainPtr dom, if (virDomainFSThawEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -21015,7 +20949,7 @@ qemuDomainGetStatsMemory(virQEMUDriverPtr driver, static int -qemuDomainGetStatsBalloon(virQEMUDriverPtr driver, +qemuDomainGetStatsBalloon(virQEMUDriverPtr driver G_GNUC_UNUSED, virDomainObjPtr dom, virTypedParamListPtr params, unsigned int privflags) @@ -21041,7 +20975,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver, if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) return 0; - nr_stats = qemuDomainMemoryStatsInternal(driver, dom, stats, + nr_stats = qemuDomainMemoryStatsInternal(dom, stats, VIR_DOMAIN_MEMORY_STAT_NR); if (nr_stats < 0) return 0; @@ -21073,7 +21007,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver, static int -qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, +qemuDomainGetStatsVcpu(virQEMUDriverPtr driver G_GNUC_UNUSED, virDomainObjPtr dom, virTypedParamListPtr params, unsigned int privflags) @@ -21098,7 +21032,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, goto cleanup; if (HAVE_JOB(privflags) && virDomainObjIsActive(dom) && - qemuDomainRefreshVcpuHalted(driver, dom, QEMU_ASYNC_JOB_NONE) < 0) { + qemuDomainRefreshVcpuHalted(dom, QEMU_ASYNC_JOB_NONE) < 0) { /* it's ok to be silent and go ahead, because halted vcpu info * wasn't here from the beginning */ virResetLastError(); @@ -21519,7 +21453,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING); if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { - qemuDomainObjEnterMonitor(driver, dom); + qemuDomainObjEnterMonitor(dom); rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats, visitBacking); @@ -21534,7 +21468,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, if (fetchnodedata) nodedata = qemuMonitorQueryNamedBlockNodes(priv->mon); - if (qemuDomainObjExitMonitor(driver, dom) < 0) + if (qemuDomainObjExitMonitor(dom) < 0) goto cleanup; /* failure to retrieve stats is fine at this point */ @@ -21573,7 +21507,7 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, static int -qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, +qemuDomainGetStatsIOThread(virQEMUDriverPtr driver G_GNUC_UNUSED, virDomainObjPtr dom, virTypedParamListPtr params, unsigned int privflags) @@ -21590,7 +21524,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) return 0; - if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0) + if ((niothreads = qemuDomainGetIOThreadsMon(dom, &iothreads)) < 0) return -1; /* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we must free @@ -21837,9 +21771,9 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, int rv; if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT) - rv = qemuDomainObjBeginJobNowait(driver, vm, QEMU_JOB_QUERY); + rv = qemuDomainObjBeginJobNowait(vm, QEMU_JOB_QUERY); else - rv = qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY); + rv = qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY); if (rv == 0) domflags |= QEMU_DOMAIN_STATS_HAVE_JOB; @@ -21850,7 +21784,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, domflags |= QEMU_DOMAIN_STATS_BACKING; if (qemuDomainGetStats(conn, vm, stats, &tmp, domflags) < 0) { if (HAVE_JOB(domflags) && vm) - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); virObjectUnlock(vm); goto cleanup; @@ -21860,7 +21794,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, tmpstats[nstats++] = tmp; if (HAVE_JOB(domflags)) - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); virObjectUnlock(vm); } @@ -21901,15 +21835,13 @@ qemuNodeAllocPages(virConnectPtr conn, } static int -qemuDomainGetFSInfoAgent(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetFSInfoAgent(virDomainObjPtr vm, qemuAgentFSInfoPtr **info) { int ret = -1; qemuAgentPtr agent; - if (qemuDomainObjBeginAgentJob(driver, vm, - QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) return ret; if (virDomainObjCheckActive(vm) < 0) @@ -22003,7 +21935,6 @@ qemuDomainGetFSInfo(virDomainPtr dom, virDomainFSInfoPtr **info, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuAgentFSInfoPtr *agentinfo = NULL; int ret = -1; @@ -22017,10 +21948,10 @@ qemuDomainGetFSInfo(virDomainPtr dom, if (virDomainGetFSInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if ((nfs = qemuDomainGetFSInfoAgent(driver, vm, &agentinfo)) < 0) + if ((nfs = qemuDomainGetFSInfoAgent(vm, &agentinfo)) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -22029,7 +21960,7 @@ qemuDomainGetFSInfo(virDomainPtr dom, ret = virDomainFSInfoFormat(agentinfo, nfs, vm->def, info); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: g_free(agentinfo); @@ -22044,7 +21975,6 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, unsigned int source, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuAgentPtr agent; int ret = -1; @@ -22066,7 +21996,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, break; case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT: - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -22104,7 +22034,6 @@ qemuDomainSetUserPassword(virDomainPtr dom, const char *password, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm; qemuAgentPtr agent; int ret = -1; @@ -22118,7 +22047,7 @@ qemuDomainSetUserPassword(virDomainPtr dom, if (virDomainSetUserPasswordEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -22270,7 +22199,7 @@ static int qemuDomainRename(virDomainPtr dom, if (virDomainRenameEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjIsActive(vm)) { @@ -22317,7 +22246,7 @@ static int qemuDomainRename(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -22393,7 +22322,6 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, unsigned int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuAgentPtr agent; qemuAgentCPUInfoPtr info = NULL; @@ -22408,7 +22336,7 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, if (virDomainGetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -22442,7 +22370,6 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, int state, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; virBitmapPtr map = NULL; qemuAgentCPUInfoPtr info = NULL; @@ -22467,7 +22394,7 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, if (virDomainSetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -22560,7 +22487,7 @@ qemuDomainSetVcpu(virDomainPtr dom, if (virDomainSetVcpuEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -22587,7 +22514,7 @@ qemuDomainSetVcpu(virDomainPtr dom, ret = qemuDomainSetVcpuInternal(driver, vm, def, persistentDef, map, !!state); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virBitmapFree(map); @@ -22602,7 +22529,6 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, unsigned long long threshold, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; qemuDomainObjPrivatePtr priv; virDomainObjPtr vm = NULL; virStorageSourcePtr src; @@ -22620,7 +22546,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (virDomainSetBlockThresholdEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -22637,7 +22563,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && !src->nodestorage && - qemuBlockNodeNamesDetect(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + qemuBlockNodeNamesDetect(vm, QEMU_ASYNC_JOB_NONE) < 0) goto endjob; if (!src->nodestorage) { @@ -22649,15 +22575,15 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, nodename = g_strdup(src->nodestorage); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetBlockThreshold(priv->mon, nodename, threshold); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto endjob; ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -22715,7 +22641,7 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, if (virDomainSetLifecycleActionEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -22746,7 +22672,7 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -22827,8 +22753,7 @@ qemuNodeGetSEVInfo(virConnectPtr conn, static int -qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainGetSEVMeasurement(virDomainObjPtr vm, virTypedParameterPtr *params, int *nparams, unsigned int flags) @@ -22839,13 +22764,13 @@ qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver, virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); tmp = qemuMonitorGetSEVMeasurement(QEMU_DOMAIN_PRIVATE(vm)->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (!tmp) @@ -22859,7 +22784,7 @@ qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver, ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); return ret; } @@ -22870,7 +22795,6 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = domain->conn->privateData; virDomainObjPtr vm; int ret = -1; @@ -22881,7 +22805,7 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, goto cleanup; if (vm->def->sev) { - if (qemuDomainGetSEVMeasurement(driver, vm, params, nparams, flags) < 0) + if (qemuDomainGetSEVMeasurement(vm, params, nparams, flags) < 0) goto cleanup; } @@ -23017,7 +22941,6 @@ qemuDomainGetGuestInfo(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; qemuAgentPtr agent; int ret = -1; @@ -23041,8 +22964,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, if (virDomainGetGuestInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, - QEMU_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, QEMU_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -23093,7 +23015,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, qemuDomainObjEndAgentJob(vm); if (nfs > 0) { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -23104,7 +23026,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, qemuAgentFSInfoFormatParams(agentfsinfo, nfs, vm->def, params, nparams, &maxparams); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } cleanup: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2c6c30ce03..fda824ad7b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -99,14 +99,13 @@ qemuDomainDeleteDevice(virDomainObjPtr vm, const char *alias) { qemuDomainObjPrivatePtr priv = vm->privateData; - virQEMUDriverPtr driver = priv->driver; int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelDevice(priv->mon, alias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { /* Domain is no longer running. No cleanup needed. */ return -1; } @@ -231,7 +230,6 @@ qemuHotplugWaitForTrayEject(virDomainObjPtr vm, /** * qemuDomainChangeMediaLegacy: - * @driver: qemu driver structure * @vm: domain definition * @disk: disk definition to change the source of * @newsrc: new disk source to change to @@ -245,8 +243,7 @@ qemuHotplugWaitForTrayEject(virDomainObjPtr vm, * Returns 0 on success, -1 on error and reports libvirt error */ static int -qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainChangeMediaLegacy(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr newsrc, bool force) @@ -267,9 +264,9 @@ qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver, if (!(driveAlias = qemuAliasDiskDriveFromDisk(disk))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, force); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; /* If the tray is present wait for it to open. */ @@ -279,9 +276,9 @@ qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver, return -1; /* re-issue ejection command to pop out the media */ - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; } else { @@ -297,12 +294,12 @@ qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver, if (virStorageSourceGetActualType(newsrc) != VIR_STORAGE_TYPE_DIR) format = virStorageFileFormatTypeToString(newsrc->format); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorChangeMedia(priv->mon, driveAlias, sourcestr, format); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; } @@ -343,7 +340,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriverPtr driver, if (!(props = qemuBuildDBusVMStateInfoProps(driver, vm))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorAddObject(priv->mon, &props, NULL); @@ -351,7 +348,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriverPtr driver, if (ret == 0) priv->dbusVMState = true; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return ret; @@ -370,8 +367,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriverPtr driver, * Returns: 0 on success, -1 on error. */ int -qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuHotplugRemoveDBusVMState(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -380,7 +376,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, if (!priv->dbusVMState) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorDelObject(priv->mon, qemuDomainGetDBusVMStateAlias(), true); @@ -388,7 +384,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, if (ret == 0) priv->dbusVMState = false; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return ret; @@ -397,7 +393,6 @@ qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, /** * qemuHotplugAttachManagedPR: - * @driver: QEMU driver object * @vm: domain object * @src: new disk source to be attached to @vm * @asyncJob: asynchronous job identifier @@ -408,8 +403,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, * Returns: 0 on success, -1 on error. */ static int -qemuHotplugAttachManagedPR(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuHotplugAttachManagedPR(virDomainObjPtr vm, virStorageSourcePtr src, qemuDomainAsyncJob asyncJob) { @@ -431,12 +425,12 @@ qemuHotplugAttachManagedPR(virQEMUDriverPtr driver, daemonStarted = true; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorAddObject(priv->mon, &props, NULL); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; ret = 0; @@ -451,7 +445,6 @@ qemuHotplugAttachManagedPR(virQEMUDriverPtr driver, /** * qemuHotplugRemoveManagedPR: - * @driver: QEMU driver object * @vm: domain object * @asyncJob: asynchronous job identifier * @@ -459,8 +452,7 @@ qemuHotplugAttachManagedPR(virQEMUDriverPtr driver, * it any more. */ static int -qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuHotplugRemoveManagedPR(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -472,11 +464,11 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver, virErrorPreserveLast(&orig_err); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias(), false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; qemuProcessKillManagedPRDaemon(vm); @@ -490,7 +482,6 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver, /** * qemuDomainChangeMediaBlockdev: - * @driver: qemu driver structure * @vm: domain definition * @disk: disk definition to change the source of * @oldsrc: old source definition @@ -505,8 +496,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver, * Returns 0 on success, -1 on error and reports libvirt error */ static int -qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainChangeMediaBlockdev(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr oldsrc, virStorageSourcePtr newsrc, @@ -533,16 +523,16 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver, } if (diskPriv->tray && disk->tray_status != VIR_DOMAIN_DISK_TRAY_OPEN) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockdevTrayOpen(priv->mon, diskPriv->qomName, force); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; if (!force && qemuHotplugWaitForTrayEject(vm, disk) < 0) return -1; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockdevMediumRemove(priv->mon, diskPriv->qomName); @@ -564,7 +554,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver, if (rc < 0 && newbackend) qemuBlockStorageSourceChainDetach(priv->mon, newbackend); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; return 0; @@ -628,13 +618,13 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, if (qemuDomainStorageSourceChainAccessAllow(driver, vm, newsrc) < 0) goto cleanup; - if (qemuHotplugAttachManagedPR(driver, vm, newsrc, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuHotplugAttachManagedPR(vm, newsrc, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) - rc = qemuDomainChangeMediaBlockdev(driver, vm, disk, oldsrc, newsrc, force); + rc = qemuDomainChangeMediaBlockdev(vm, disk, oldsrc, newsrc, force); else - rc = qemuDomainChangeMediaLegacy(driver, vm, disk, newsrc, force); + rc = qemuDomainChangeMediaLegacy(vm, disk, newsrc, force); virDomainAuditDisk(vm, oldsrc, newsrc, "update", rc >= 0); @@ -664,7 +654,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, /* remove PR manager object if unneeded */ if (managedpr) - ignore_value(qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuHotplugRemoveManagedPR(vm, QEMU_ASYNC_JOB_NONE)); /* revert old image do the disk definition */ if (oldsrc) @@ -726,10 +716,10 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks + 1) < 0) goto cleanup; - if (qemuHotplugAttachManagedPR(driver, vm, disk->src, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuHotplugAttachManagedPR(vm, disk->src, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuBlockStorageSourceChainAttach(priv->mon, data) < 0) goto exit_monitor; @@ -764,7 +754,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { ret = -2; goto cleanup; } @@ -785,11 +775,11 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, ignore_value(qemuMonitorBlockdevDel(priv->mon, corAlias)); qemuBlockStorageSourceChainDetach(priv->mon, data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -2; if (virStorageSourceChainHasManagedPR(disk->src) && - qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + qemuHotplugRemoveManagedPR(vm, QEMU_ASYNC_JOB_NONE) < 0) ret = -2; virDomainAuditDisk(vm, NULL, disk->src, "attach", false); @@ -820,8 +810,7 @@ qemuDomainAttachVirtioDiskDevice(virQEMUDriverPtr driver, } -int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainAttachControllerDevice(virDomainObjPtr vm, virDomainControllerDefPtr controller) { int ret = -1; @@ -869,7 +858,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, &controller->info)) < 0) { @@ -880,7 +869,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &controller->info)); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseaddr = false; ret = -1; goto cleanup; @@ -897,8 +886,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, } static virDomainControllerDefPtr -qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainFindOrCreateSCSIDiskController(virDomainObjPtr vm, int controller) { size_t i; @@ -939,7 +927,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver, VIR_INFO("No SCSI controller present, hotplugging one model=%s", virDomainControllerModelSCSITypeToString(cont->model)); - if (qemuDomainAttachControllerDevice(driver, vm, cont) < 0) { + if (qemuDomainAttachControllerDevice(vm, cont) < 0) { VIR_FREE(cont); return NULL; } @@ -985,7 +973,7 @@ qemuDomainAttachSCSIDisk(virQEMUDriverPtr driver, * exist; there must not be any missing index in between. */ for (i = 0; i <= disk->info.addr.drive.controller; i++) { - if (!qemuDomainFindOrCreateSCSIDiskController(driver, vm, i)) + if (!qemuDomainFindOrCreateSCSIDiskController(vm, i)) return -1; } @@ -1391,11 +1379,11 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, slirpfdName))) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) { if (qemuMonitorAttachCharDev(priv->mon, charDevAlias, net->data.vhostuser) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto cleanup; } @@ -1406,13 +1394,13 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, tapfd, tapfdName, tapfdSize, vhostfd, vhostfdName, vhostfdSize, slirpfd, slirpfdName) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; } netdevPlugged = true; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; for (i = 0; i < tapfdSize; i++) @@ -1424,21 +1412,21 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, queueSize, priv->qemuCaps))) goto try_remove; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &net->info) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; } if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) { ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &net->info)); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; /* set link state */ @@ -1447,15 +1435,15 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("device alias not found: cannot set link state to down")); } else { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorSetLink(priv->mon, net->info.alias, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; } /* link set to down */ @@ -1528,7 +1516,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, netdev_name = g_strdup_printf("host%s", net->info.alias); if (QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp) qemuSlirpStop(QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp, vm, driver, net); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (charDevPlugged && qemuMonitorDetachCharDev(priv->mon, charDevAlias) < 0) VIR_WARN("Failed to remove associated chardev %s", charDevAlias); @@ -1536,7 +1524,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0) VIR_WARN("Failed to remove network backend for netdev %s", netdev_name); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virErrorRestore(&originalError); goto cleanup; } @@ -1634,7 +1622,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, if (!(devstr = qemuBuildPCIHostdevDevStr(vm->def, hostdev, 0, priv->qemuCaps))) goto error; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)) < 0) goto exit_monitor; @@ -1643,7 +1631,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->info)); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto error; virDomainAuditHostdev(vm, hostdev, "attach", ret == 0); @@ -1676,8 +1664,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, void -qemuDomainDelTLSObjects(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainDelTLSObjects(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, const char *secAlias, const char *tlsAlias) @@ -1690,7 +1677,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, virErrorPreserveLast(&orig_err); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; if (tlsAlias) @@ -1699,7 +1686,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, if (secAlias) ignore_value(qemuMonitorDelObject(priv->mon, secAlias, false)); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); cleanup: virErrorRestore(&orig_err); @@ -1707,8 +1694,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, int -qemuDomainAddTLSObjects(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainAddTLSObjects(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virJSONValuePtr *secProps, virJSONValuePtr *tlsProps) @@ -1720,7 +1706,7 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver, if (!tlsProps && !secProps) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (secProps && *secProps && @@ -1731,13 +1717,13 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver, qemuMonitorAddObject(priv->mon, tlsProps, NULL) < 0) goto error; - return qemuDomainObjExitMonitor(driver, vm); + return qemuDomainObjExitMonitor(vm); error: virErrorPreserveLast(&orig_err); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, NULL); + qemuDomainDelTLSObjects(vm, asyncJob, secAlias, NULL); return -1; } @@ -1816,7 +1802,7 @@ qemuDomainAddChardevTLSObjects(virQEMUDriverPtr driver, goto cleanup; dev->data.tcp.tlscreds = true; - if (qemuDomainAddTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, + if (qemuDomainAddTLSObjects(vm, QEMU_ASYNC_JOB_NONE, &secProps, &tlsProps) < 0) goto cleanup; @@ -1857,13 +1843,13 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver, !(secAlias = qemuAliasForSecret(inAlias, NULL))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias, false)); if (secAlias) ignore_value(qemuMonitorDelObject(priv->mon, secAlias, false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return 0; @@ -1906,7 +1892,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, &tlsAlias, &secAlias) < 0) goto audit; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorAttachCharDev(priv->mon, charAlias, @@ -1917,7 +1903,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, if (qemuMonitorAddDevice(priv->mon, devstr) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto audit; def->redirdevs[def->nredirdevs++] = redirdev; @@ -1934,9 +1920,9 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, /* detach associated chardev on error */ if (chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2169,7 +2155,7 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver, &tlsAlias, &secAlias) < 0) goto audit; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorAttachCharDev(priv->mon, charAlias, chr->source) < 0) goto exit_monitor; @@ -2186,7 +2172,7 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto audit; qemuDomainChrInsertPreAlloced(vmdef, chr); @@ -2213,10 +2199,10 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver, /* detach associated chardev on error */ if (chardevAttached) qemuMonitorDetachCharDev(priv->mon, charAlias); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2278,7 +2264,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, goto audit; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && qemuMonitorAttachCharDev(priv->mon, charAlias, @@ -2297,7 +2283,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseaddr = false; goto cleanup; } @@ -2327,11 +2313,11 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, ignore_value(qemuMonitorDelObject(priv->mon, objAlias, false)); if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) releaseaddr = false; virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2412,7 +2398,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, if (qemuDomainAdjustMaxMemLock(vm, false) < 0) goto removedef; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorAddObject(priv->mon, &props, NULL) < 0) goto exit_monitor; objAdded = true; @@ -2420,7 +2406,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, if (qemuMonitorAddDevice(priv->mon, devstr) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { /* we shouldn't touch mem now, as the def might be freed */ mem = NULL; goto audit; @@ -2430,14 +2416,13 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, virObjectEventStateQueue(driver->domainEventState, event); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm, QEMU_ASYNC_JOB_NONE)); /* mem is consumed by vm->def */ mem = NULL; /* this step is best effort, removing the device would be so much trouble */ - ignore_value(qemuDomainUpdateMemoryDeviceInfo(driver, vm, - QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuDomainUpdateMemoryDeviceInfo(vm, QEMU_ASYNC_JOB_NONE)); ret = 0; @@ -2462,7 +2447,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, virErrorPreserveLast(&orig_err); if (objAdded) ignore_value(qemuMonitorDelObject(priv->mon, objalias, false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) mem = NULL; if (objAdded && mem) @@ -2528,9 +2513,9 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorAddDevice(priv->mon, devstr); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { ret = -1; goto cleanup; } @@ -2583,7 +2568,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver, * exist; there must not be any missing index in between. */ for (i = 0; i <= hostdev->info->addr.drive.controller; i++) { - if (!qemuDomainFindOrCreateSCSIDiskController(driver, vm, i)) + if (!qemuDomainFindOrCreateSCSIDiskController(vm, i)) return -1; } @@ -2618,7 +2603,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuBlockStorageSourceAttachApply(priv->mon, data) < 0) goto exit_monitor; @@ -2626,7 +2611,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver, if (qemuMonitorAddDevice(priv->mon, devstr) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; virDomainAuditHostdev(vm, hostdev, "attach", true); @@ -2653,7 +2638,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver, exit_monitor: virErrorPreserveLast(&orig_err); qemuBlockStorageSourceAttachRollback(priv->mon, data); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); virErrorRestore(&orig_err); virDomainAuditHostdev(vm, hostdev, "attach", false); @@ -2730,7 +2715,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)) < 0) goto exit_monitor; @@ -2742,7 +2727,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver, } exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || ret < 0) goto audit; vm->def->hostdevs[vm->def->nhostdevs++] = hostdev; @@ -2837,9 +2822,9 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver, goto cleanup; teardownmemlock = true; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorAddDevice(priv->mon, devstr); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { ret = -1; goto cleanup; } @@ -2978,7 +2963,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (shmem->server.enabled) { if (qemuMonitorAttachCharDev(priv->mon, charAlias, @@ -2999,7 +2984,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { release_address = false; goto cleanup; } @@ -3031,7 +3016,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, ignore_value(qemuMonitorDelObject(priv->mon, memAlias, false)); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) release_address = false; virErrorRestore(&orig_err); @@ -3085,14 +3070,14 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver, actionStr = virDomainWatchdogActionTypeToString(actualAction); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorSetWatchdogAction(priv->mon, actionStr); if (rv >= 0) rv = qemuMonitorAddDevice(priv->mon, watchdogstr); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseAddress = false; goto cleanup; } @@ -3112,8 +3097,7 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver, int -qemuDomainAttachInputDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainAttachInputDevice(virDomainObjPtr vm, virDomainInputDefPtr input) { int ret = -1; @@ -3165,7 +3149,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(vm->def->inputs, vm->def->ninputs + 1) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &input->info) < 0) goto exit_monitor; @@ -3175,7 +3159,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseaddr = false; goto cleanup; } @@ -3204,7 +3188,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver, return ret; exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseaddr = false; goto cleanup; } @@ -3213,8 +3197,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver, int -qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainAttachVsockDevice(virDomainObjPtr vm, virDomainVsockDefPtr vsock) { qemuDomainVsockPrivatePtr vsockPriv = (qemuDomainVsockPrivatePtr)vsock->privateData; @@ -3248,7 +3231,7 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, if (!(devstr = qemuBuildVsockDevStr(vm->def, vsock, priv->qemuCaps, fdprefix))) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &vsock->info) < 0) goto exit_monitor; @@ -3258,7 +3241,7 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (qemuDomainObjExitMonitor(vm) < 0) { releaseaddr = false; goto cleanup; } @@ -3278,7 +3261,7 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, return ret; exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) releaseaddr = false; goto cleanup; } @@ -3421,8 +3404,7 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, return 0; } -int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainChangeNetLinkState(virDomainObjPtr vm, virDomainNetDefPtr dev, int linkstate) { @@ -3437,7 +3419,7 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver, VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSetLink(priv->mon, dev->info.alias, linkstate); if (ret < 0) @@ -3447,15 +3429,14 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver, dev->linkstate = linkstate; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; return ret; } int -qemuDomainChangeNet(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainChangeNet(virDomainObjPtr vm, virDomainDeviceDefPtr dev) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -3879,7 +3860,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, } if (needLinkStateChange && - qemuDomainChangeNetLinkState(driver, vm, olddev, newdev->linkstate) < 0) { + qemuDomainChangeNetLinkState(vm, olddev, newdev->linkstate) < 0) { goto cleanup; } @@ -3970,8 +3951,7 @@ qemuDomainFindGraphicsIndex(virDomainDefPtr def, int -qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainChangeGraphicsPasswords(virDomainObjPtr vm, int type, virDomainGraphicsAuthDefPtr auth, const char *defaultPasswd, @@ -3993,7 +3973,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, if (auth->connected) connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return ret; ret = qemuMonitorSetPassword(priv->mon, type, password, connected); @@ -4013,7 +3993,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, ret = qemuMonitorExpirePassword(priv->mon, type, expire); end_job: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; @@ -4117,8 +4097,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, dev->data.vnc.auth.passwd)) { VIR_DEBUG("Updating password on VNC server %p %p", dev->data.vnc.auth.passwd, cfg->vncPassword); - if (qemuDomainChangeGraphicsPasswords(driver, vm, - VIR_DOMAIN_GRAPHICS_TYPE_VNC, + if (qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC, &dev->data.vnc.auth, cfg->vncPassword, QEMU_ASYNC_JOB_NONE) < 0) @@ -4165,8 +4144,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, dev->data.spice.auth.passwd)) { VIR_DEBUG("Updating password on SPICE server %p %p", dev->data.spice.auth.passwd, cfg->spicePassword); - if (qemuDomainChangeGraphicsPasswords(driver, vm, - VIR_DOMAIN_GRAPHICS_TYPE_SPICE, + if (qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &dev->data.spice.auth, cfg->spicePassword, QEMU_ASYNC_JOB_NONE) < 0) @@ -4280,7 +4258,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, } } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (corAlias) ignore_value(qemuMonitorBlockdevDel(priv->mon, corAlias)); @@ -4288,7 +4266,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, if (diskBackend) qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; virDomainAuditDisk(vm, disk->src, NULL, "detach", true); @@ -4304,7 +4282,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, ignore_value(qemuRemoveSharedDevice(driver, &dev, vm->def->name)); if (virStorageSourceChainHasManagedPR(disk->src) && - qemuHotplugRemoveManagedPR(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + qemuHotplugRemoveManagedPR(vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; ret = 0; @@ -4354,9 +4332,9 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver, backendAlias = g_strdup_printf("mem%s", mem->info.alias); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelObject(priv->mon, backendAlias, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) rc = -1; virDomainAuditMemory(vm, oldmem, newmem, "update", rc == 0); @@ -4381,7 +4359,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver, virDomainMemoryDefFree(mem); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm, QEMU_ASYNC_JOB_NONE)); /* decrease the mlock limit after memory unplug if necessary */ ignore_value(qemuDomainAdjustMaxMemLock(vm, false)); @@ -4452,9 +4430,9 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, detachscsi = qemuBuildHostdevSCSIDetachPrepare(hostdev, priv->qemuCaps); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); qemuBlockStorageSourceAttachRollback(priv->mon, detachscsi); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; } @@ -4565,9 +4543,9 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, */ ignore_value(qemuInterfaceStopDevice(net)); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) { - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; virDomainAuditNet(vm, net, NULL, "detach", false); return -1; @@ -4583,7 +4561,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, } } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp) @@ -4651,9 +4629,9 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver, return -1; if (monitor) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDetachCharDev(priv->mon, charAlias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; } @@ -4710,7 +4688,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver, if (!(charAlias = qemuAliasChardevFromDevAlias(rng->info.alias))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorDelObject(priv->mon, objAlias, true) < 0) rc = -1; @@ -4720,7 +4698,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver, qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) rc = -1; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && @@ -4749,8 +4727,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver, static int -qemuDomainRemoveShmemDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRemoveShmemDevice(virDomainObjPtr vm, virDomainShmemDefPtr shmem) { int rc; @@ -4768,14 +4745,14 @@ qemuDomainRemoveShmemDevice(virQEMUDriverPtr driver, memAlias = g_strdup_printf("shmmem-%s", shmem->info.alias); } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (shmem->server.enabled) rc = qemuMonitorDetachCharDev(priv->mon, charAlias); else rc = qemuMonitorDelObject(priv->mon, memAlias, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; virDomainAuditShmem(vm, shmem, "detach", rc == 0); @@ -4864,13 +4841,13 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver, if (!(charAlias = qemuAliasChardevFromDevAlias(dev->info.alias))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); /* DeviceDel from Detach may remove chardev, * so we cannot rely on return status to delete TLS chardevs. */ ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (qemuDomainDelChardevTLSObjects(driver, vm, dev->source, charAlias) < 0) @@ -5009,7 +4986,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver, return -1; break; case VIR_DOMAIN_DEVICE_SHMEM: - if (qemuDomainRemoveShmemDevice(driver, vm, dev->data.shmem) < 0) + if (qemuDomainRemoveShmemDevice(vm, dev->data.shmem) < 0) return -1; break; case VIR_DOMAIN_DEVICE_INPUT: @@ -5553,9 +5530,9 @@ qemuDomainDetachDeviceChr(virQEMUDriverPtr driver, if (guestfwd) { int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorRemoveNetdev(priv->mon, tmpChr->info.alias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) rc = -1; if (rc < 0) @@ -5914,8 +5891,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, static int -qemuDomainRemoveVcpu(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRemoveVcpu(virDomainObjPtr vm, unsigned int vcpu) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -5926,7 +5902,7 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver, virErrorPtr save_error = NULL; size_t i; - if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, QEMU_ASYNC_JOB_NONE, false) < 0) return -1; /* validation requires us to set the expected state prior to calling it */ @@ -5960,8 +5936,7 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver, void -qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRemoveVcpuAlias(virDomainObjPtr vm, const char *alias) { virDomainVcpuDefPtr vcpu; @@ -5973,7 +5948,7 @@ qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu); if (STREQ_NULLABLE(alias, vcpupriv->alias)) { - qemuDomainRemoveVcpu(driver, vm, i); + qemuDomainRemoveVcpu(vm, i); return; } } @@ -6016,7 +5991,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainRemoveVcpu(driver, vm, vcpu) < 0) + if (qemuDomainRemoveVcpu(vm, vcpu) < 0) goto cleanup; qemuDomainVcpuPersistOrder(vm->def); @@ -6055,7 +6030,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, goto cleanup; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (newhotplug) { rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops); @@ -6064,7 +6039,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, rc = qemuMonitorSetCPU(qemuDomainGetMonitor(vm), vcpu, true); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; virDomainAuditVcpu(vm, oldvcpus, oldvcpus + nvcpus, "update", rc == 0); @@ -6076,7 +6051,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, if (newhotplug) vm->def->individualvcpus = true; - if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, QEMU_ASYNC_JOB_NONE, false) < 0) goto cleanup; /* validation requires us to set the expected state prior to calling it */ diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 6287c5b5e8..51af92f840 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -31,14 +31,12 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, virStorageSourcePtr newsrc, bool force); -void qemuDomainDelTLSObjects(virQEMUDriverPtr driver, - virDomainObjPtr vm, +void qemuDomainDelTLSObjects(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, const char *secAlias, const char *tlsAlias); -int qemuDomainAddTLSObjects(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainAddTLSObjects(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virJSONValuePtr *secProps, virJSONValuePtr *tlsProps); @@ -52,8 +50,7 @@ int qemuDomainGetTLSObjects(virQEMUCapsPtr qemuCaps, virJSONValuePtr *tlsProps, virJSONValuePtr *secProps); -int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainAttachControllerDevice(virDomainObjPtr vm, virDomainControllerDefPtr controller); int qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -81,26 +78,21 @@ int qemuDomainAttachMemory(virQEMUDriverPtr driver, int qemuDomainChangeGraphics(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainGraphicsDefPtr dev); -int qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainChangeGraphicsPasswords(virDomainObjPtr vm, int type, virDomainGraphicsAuthDefPtr auth, const char *defaultPasswd, int asyncJob); -int qemuDomainChangeNet(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainChangeNet(virDomainObjPtr vm, virDomainDeviceDefPtr dev); -int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainChangeNetLinkState(virDomainObjPtr vm, virDomainNetDefPtr dev, int linkstate); -int qemuDomainAttachInputDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainAttachInputDevice(virDomainObjPtr vm, virDomainInputDefPtr input); -int qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainAttachVsockDevice(virDomainObjPtr vm, virDomainVsockDefPtr vsock); int qemuDomainAttachLease(virQEMUDriverPtr driver, @@ -118,8 +110,7 @@ int qemuDomainDetachDeviceLive(virDomainObjPtr vm, virQEMUDriverPtr driver, bool async); -void qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, - virDomainObjPtr vm, +void qemuDomainRemoveVcpuAlias(virDomainObjPtr vm, const char *alias); int @@ -157,6 +148,5 @@ int qemuHotplugAttachDBusVMState(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); -int qemuHotplugRemoveDBusVMState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuHotplugRemoveDBusVMState(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9b481c3443..6008fd1b1b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -82,21 +82,18 @@ VIR_ENUM_IMPL(qemuMigrationJobPhase, ); static int -qemuMigrationJobStart(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobStart(virDomainObjPtr vm, qemuDomainAsyncJob job, unsigned long apiFlags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; static void -qemuMigrationJobSetPhase(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobSetPhase(virDomainObjPtr vm, qemuMigrationJobPhase phase) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); static void -qemuMigrationJobStartPhase(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobStartPhase(virDomainObjPtr vm, qemuMigrationJobPhase phase) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); @@ -110,8 +107,7 @@ qemuMigrationJobIsActive(virDomainObjPtr vm, ATTRIBUTE_NONNULL(1); static void -qemuMigrationJobFinish(virQEMUDriverPtr driver, - virDomainObjPtr obj) +qemuMigrationJobFinish(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); static void @@ -424,8 +420,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, devicename = diskAlias; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) goto cleanup; if (port == 0) { @@ -441,7 +436,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, if (qemuMonitorNBDServerAdd(priv->mon, devicename, exportname, true, NULL) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; } @@ -454,14 +449,13 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, return ret; exit_monitor: - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto cleanup; } static int -qemuMigrationDstStopNBDServer(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationDstStopNBDServer(virDomainObjPtr vm, qemuMigrationCookiePtr mig) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -469,13 +463,12 @@ qemuMigrationDstStopNBDServer(virQEMUDriverPtr driver, if (!mig->nbd) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) return -1; if (qemuMonitorNBDServerStop(priv->mon) < 0) VIR_WARN("Unable to stop NBD server"); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; virPortAllocatorRelease(priv->nbdPort); @@ -646,8 +639,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObjPtr vm, * -1 on error or when job failed and failNoJob is true. */ static int -qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcNBDCopyCancelOne(virDomainObjPtr vm, virDomainDiskDefPtr disk, qemuBlockJobDataPtr job, bool failNoJob, @@ -669,12 +661,12 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver, return 1; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rv = qemuMonitorBlockJobCancel(priv->mon, job->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rv < 0) return -1; return 0; @@ -683,7 +675,6 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver, /** * qemuMigrationSrcNBDCopyCancel: - * @driver: qemu driver * @vm: domain * @check: if true report an error when some of the mirrors fails * @@ -695,8 +686,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriverPtr driver, * Returns 0 on success, -1 otherwise. */ static int -qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcNBDCopyCancel(virDomainObjPtr vm, bool check, qemuDomainAsyncJob asyncJob, virConnectPtr dconn) @@ -723,7 +713,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, continue; } - rv = qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk, job, + rv = qemuMigrationSrcNBDCopyCancelOne(vm, disk, job, check, asyncJob); if (rv != 0) { if (rv < 0) { @@ -766,7 +756,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, if (!diskPriv->migrSource) continue; - qemuBlockStorageSourceDetachOneBlockdev(driver, vm, asyncJob, + qemuBlockStorageSourceDetachOneBlockdev(vm, asyncJob, diskPriv->migrSource); virObjectUnref(diskPriv->migrSource); diskPriv->migrSource = NULL; @@ -818,8 +808,7 @@ qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDefPtr disk, static int -qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcNBDStorageCopyBlockdev(virDomainObjPtr vm, virDomainDiskDefPtr disk, const char *jobname, const char *sourcename, @@ -847,8 +836,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, false))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; mon_ret = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), data); @@ -861,7 +849,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, if (mon_ret != 0) qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), data); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || mon_ret < 0) return -1; diskPriv->migrSource = g_steal_pointer(©src); @@ -871,8 +859,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver, static int -qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcNBDStorageCopyDriveMirror(virDomainObjPtr vm, const char *diskAlias, const char *host, int port, @@ -890,15 +877,14 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriverPtr driver, diskAlias); } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; mon_ret = qemuMonitorDriveMirror(qemuDomainGetMonitor(vm), diskAlias, nbd_dest, "raw", mirror_speed, 0, 0, mirror_shallow, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || mon_ret < 0) return -1; return 0; @@ -906,8 +892,7 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriverPtr driver, static int -qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcNBDStorageCopyOne(virDomainObjPtr vm, virDomainDiskDefPtr disk, const char *host, int port, @@ -946,15 +931,14 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driver, if (flags & VIR_MIGRATE_TLS || virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { - rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, - disk, jobname, + rc = qemuMigrationSrcNBDStorageCopyBlockdev(vm, disk, jobname, sourcename, persistjob, host, port, mirror_speed, mirror_shallow, tlsAlias); } else { - rc = qemuMigrationSrcNBDStorageCopyDriveMirror(driver, vm, diskAlias, + rc = qemuMigrationSrcNBDStorageCopyDriveMirror(vm, diskAlias, host, port, mirror_speed, mirror_shallow); @@ -1037,7 +1021,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver, if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks)) continue; - if (qemuMigrationSrcNBDStorageCopyOne(driver, vm, disk, host, port, + if (qemuMigrationSrcNBDStorageCopyOne(vm, disk, host, port, mirror_speed, mirror_shallow, tlsAlias, flags) < 0) return -1; @@ -1070,7 +1054,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr driver, return -1; } - qemuMigrationSrcFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationSrcFetchMirrorStats(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->current); /* Okay, all disks are ready. Modify migrate_flags */ @@ -1492,8 +1476,7 @@ qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo) int -qemuMigrationAnyFetchStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationAnyFetchStats(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, qemuDomainJobInfoPtr jobInfo, char **error) @@ -1502,12 +1485,12 @@ qemuMigrationAnyFetchStats(virQEMUDriverPtr driver, qemuMonitorMigrationStats stats; int rv; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rv = qemuMonitorGetMigrationStats(priv->mon, &stats, error); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rv < 0) return -1; jobInfo->stats.mig = stats; @@ -1546,8 +1529,7 @@ qemuMigrationJobName(virDomainObjPtr vm) static int -qemuMigrationJobCheckStatus(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobCheckStatus(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -1559,7 +1541,7 @@ qemuMigrationJobCheckStatus(virQEMUDriverPtr driver, if (!events || jobInfo->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) { - if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobInfo, &error) < 0) + if (qemuMigrationAnyFetchStats(vm, asyncJob, jobInfo, &error) < 0) return -1; } @@ -1615,8 +1597,7 @@ enum qemuMigrationCompletedFlags { * -2 something else failed, we need to cancel migration. */ static int -qemuMigrationAnyCompleted(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationAnyCompleted(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) @@ -1626,7 +1607,7 @@ qemuMigrationAnyCompleted(virQEMUDriverPtr driver, qemuDomainJobInfoPtr jobInfo = jobPriv->current; int pauseReason; - if (qemuMigrationJobCheckStatus(driver, vm, asyncJob) < 0) + if (qemuMigrationJobCheckStatus(vm, asyncJob) < 0) goto error; /* This flag should only be set when run on src host */ @@ -1707,8 +1688,7 @@ qemuMigrationAnyCompleted(virQEMUDriverPtr driver, * QEMU reports failed migration. */ static int -qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcWaitForCompletion(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) @@ -1721,7 +1701,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver, jobInfo->status = QEMU_DOMAIN_JOB_STATUS_MIGRATING; - while ((rv = qemuMigrationAnyCompleted(driver, vm, asyncJob, + while ((rv = qemuMigrationAnyCompleted(vm, asyncJob, dconn, flags)) != 1) { if (rv < 0) return rv; @@ -1743,7 +1723,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver, } if (events) - ignore_value(qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobInfo, NULL)); + ignore_value(qemuMigrationAnyFetchStats(vm, asyncJob, jobInfo, NULL)); qemuDomainJobInfoUpdateTime(jobInfo); qemuDomainJobInfoUpdateDowntime(jobInfo); @@ -1760,8 +1740,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver, static int -qemuMigrationDstWaitForCompletion(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationDstWaitForCompletion(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, bool postcopy) { @@ -1777,7 +1756,7 @@ qemuMigrationDstWaitForCompletion(virQEMUDriverPtr driver, if (postcopy) flags = QEMU_MIGRATION_COMPLETED_POSTCOPY; - while ((rv = qemuMigrationAnyCompleted(driver, vm, asyncJob, + while ((rv = qemuMigrationAnyCompleted(vm, asyncJob, NULL, flags)) != 1) { if (rv < 0 || virDomainObjWait(vm) < 0) return -1; @@ -1788,8 +1767,7 @@ qemuMigrationDstWaitForCompletion(virQEMUDriverPtr driver, static int -qemuMigrationSrcGraphicsRelocate(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcGraphicsRelocate(virDomainObjPtr vm, qemuMigrationCookiePtr cookie, const char *graphicsuri) { @@ -1871,14 +1849,13 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { qemuDomainJobPrivatePtr jobPriv = priv->job.privateData; ret = qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, port, tlsPort, tlsSubject); jobPriv->spiceMigration = !ret; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; } @@ -1963,8 +1940,7 @@ qemuMigrationDstGetURI(const char *migrateFrom, int -qemuMigrationDstRun(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationDstRun(virDomainObjPtr vm, const char *uri, qemuDomainAsyncJob asyncJob) { @@ -1973,7 +1949,7 @@ qemuMigrationDstRun(virQEMUDriverPtr driver, VIR_DEBUG("Setting up incoming migration with URI %s", uri); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rv = qemuMonitorSetDBusVMStateIdList(priv->mon, @@ -1984,7 +1960,7 @@ qemuMigrationDstRun(virQEMUDriverPtr driver, rv = qemuMonitorMigrateIncoming(priv->mon, uri); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rv < 0) return -1; if (asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) { @@ -1992,7 +1968,7 @@ qemuMigrationDstRun(virQEMUDriverPtr driver, return 0; } - if (qemuMigrationDstWaitForCompletion(driver, vm, asyncJob, false) < 0) + if (qemuMigrationDstWaitForCompletion(vm, asyncJob, false) < 0) return -1; return 0; @@ -2008,9 +1984,8 @@ qemuMigrationDstRun(virQEMUDriverPtr driver, static void qemuMigrationSrcCleanup(virDomainObjPtr vm, virConnectPtr conn, - void *opaque) + void *opaque G_GNUC_UNUSED) { - virQEMUDriverPtr driver = opaque; qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainJobPrivatePtr jobPriv = priv->job.privateData; @@ -2030,17 +2005,17 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm, switch ((qemuMigrationJobPhase) priv->job.phase) { case QEMU_MIGRATION_PHASE_BEGIN3: /* just forget we were about to migrate */ - qemuDomainObjDiscardAsyncJob(driver, vm); + qemuDomainObjDiscardAsyncJob(vm); break; case QEMU_MIGRATION_PHASE_PERFORM3_DONE: VIR_WARN("Migration of domain %s finished but we don't know if the" " domain was successfully started on destination or not", vm->def->name); - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); /* clear the job and let higher levels decide what to do */ - qemuDomainObjDiscardAsyncJob(driver, vm); + qemuDomainObjDiscardAsyncJob(vm); break; case QEMU_MIGRATION_PHASE_PERFORM3: @@ -2091,7 +2066,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver, * change protection. */ if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_BEGIN3); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_BEGIN3); if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags)) return NULL; @@ -2233,12 +2208,12 @@ qemuMigrationSrcBegin(virConnectPtr conn, qemuDomainAsyncJob asyncJob; if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) { - if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationJobStart(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, flags) < 0) goto cleanup; asyncJob = QEMU_ASYNC_JOB_MIGRATION_OUT; } else { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; asyncJob = QEMU_ASYNC_JOB_NONE; } @@ -2252,7 +2227,7 @@ qemuMigrationSrcBegin(virConnectPtr conn, * We don't want to require them on the destination. */ if (!(flags & VIR_MIGRATE_OFFLINE) && - qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) + qemuProcessRefreshDisks(vm, asyncJob) < 0) goto endjob; if (!(xml = qemuMigrationSrcBeginPhase(driver, vm, xmlin, dname, @@ -2281,9 +2256,9 @@ qemuMigrationSrcBegin(virConnectPtr conn, endjob: if (flags & VIR_MIGRATE_CHANGE_PROTECTION) - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); else - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); goto cleanup; } @@ -2308,7 +2283,7 @@ qemuMigrationDstPrepareCleanup(virQEMUDriverPtr driver, if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_IN)) return; - qemuDomainObjDiscardAsyncJob(driver, vm); + qemuDomainObjDiscardAsyncJob(vm); } static qemuProcessIncomingDefPtr @@ -2547,10 +2522,9 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, !!(flags & VIR_MIGRATE_NON_SHARED_INC)) < 0) goto cleanup; - if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, - flags) < 0) + if (qemuMigrationJobStart(vm, QEMU_ASYNC_JOB_MIGRATION_IN, flags) < 0) goto cleanup; - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PREPARE); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PREPARE); /* Domain starts inactive, even if the domain XML had an id field. */ vm->def->id = -1; @@ -2607,7 +2581,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, goto stopjob; } - if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationParamsCheck(vm, QEMU_ASYNC_JOB_MIGRATION_IN, migParams, mig->caps->automatic) < 0) goto stopjob; @@ -2624,7 +2598,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, goto stopjob; } - if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationParamsApply(vm, QEMU_ASYNC_JOB_MIGRATION_IN, migParams) < 0) goto stopjob; @@ -2661,7 +2635,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, } if (incoming->deferredURI && - qemuMigrationDstRun(driver, vm, incoming->deferredURI, + qemuMigrationDstRun(vm, incoming->deferredURI, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) goto stopjob; @@ -2731,7 +2705,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, return ret; stopjob: - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_IN, jobPriv->migParams, priv->job.apiFlags); if (stopProcess) { @@ -2743,7 +2717,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, QEMU_ASYNC_JOB_MIGRATION_IN, stopFlags); } - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); goto cleanup; } @@ -3011,8 +2985,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, virCheckFlags(QEMU_MIGRATION_FLAGS, -1); - qemuMigrationJobSetPhase(driver, vm, - retcode == 0 + qemuMigrationJobSetPhase(vm, retcode == 0 ? QEMU_MIGRATION_PHASE_CONFIRM3 : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED); @@ -3036,7 +3009,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, */ if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED && reason == VIR_DOMAIN_PAUSED_POSTCOPY && - qemuMigrationAnyFetchStats(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationAnyFetchStats(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobInfo, NULL) < 0) VIR_WARN("Could not refresh migration statistics"); @@ -3075,8 +3048,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, virErrorPreserveLast(&orig_err); /* cancel any outstanding NBD jobs */ - qemuMigrationSrcNBDCopyCancel(driver, vm, false, - QEMU_ASYNC_JOB_MIGRATION_OUT, NULL); + qemuMigrationSrcNBDCopyCancel(vm, false, QEMU_ASYNC_JOB_MIGRATION_OUT, NULL); virErrorRestore(&orig_err); @@ -3086,7 +3058,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, else qemuMigrationSrcRestoreDomainState(driver, vm); - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) @@ -3118,7 +3090,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver, else phase = QEMU_MIGRATION_PHASE_CONFIRM3; - qemuMigrationJobStartPhase(driver, vm, phase); + qemuMigrationJobStartPhase(vm, phase); virCloseCallbacksUnset(driver->closeCallbacks, vm, qemuMigrationSrcCleanup); @@ -3126,7 +3098,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver, cookiein, cookieinlen, flags, cancelled); - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); if (!virDomainObjIsActive(vm)) { if (!cancelled && ret == 0 && flags & VIR_MIGRATE_UNDEFINE_SOURCE) { virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm); @@ -3412,20 +3384,19 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, static int -qemuMigrationSrcContinue(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcContinue(virDomainObjPtr vm, qemuMonitorMigrationStatus status, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorMigrateContinue(priv->mon, status); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; @@ -3444,18 +3415,18 @@ qemuMigrationSetDBusVMState(virQEMUDriverPtr driver, if (qemuHotplugAttachDBusVMState(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; rv = qemuMonitorSetDBusVMStateIdList(priv->mon, (const char **)priv->dbusVMStateIds); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) rv = -1; return rv; } else { - if (qemuHotplugRemoveDBusVMState(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuHotplugRemoveDBusVMState(vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; } @@ -3555,10 +3526,10 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (!mig) goto error; - if (qemuMigrationSrcGraphicsRelocate(driver, vm, mig, graphicsuri) < 0) + if (qemuMigrationSrcGraphicsRelocate(vm, mig, graphicsuri) < 0) VIR_WARN("unable to provide data for graphics client relocation"); - if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationParamsCheck(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, migParams, mig->caps->automatic) < 0) goto error; @@ -3586,7 +3557,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, migrate_speed * 1024 * 1024) < 0) goto error; - if (qemuMigrationParamsApply(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationParamsApply(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, migParams) < 0) goto error; @@ -3633,8 +3604,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, goto error; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto error; if (priv->job.abortJob) { @@ -3690,7 +3660,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, break; } - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto error; /* From this point onwards we *must* call cancel to abort the @@ -3714,8 +3684,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (flags & VIR_MIGRATE_POSTCOPY) waitFlags |= QEMU_MIGRATION_COMPLETED_POSTCOPY; - rc = qemuMigrationSrcWaitForCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT, + rc = qemuMigrationSrcWaitForCompletion(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn, waitFlags); if (rc == -2) { goto error; @@ -3737,7 +3706,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, } if (mig->nbd && - qemuMigrationSrcNBDCopyCancel(driver, vm, true, + qemuMigrationSrcNBDCopyCancel(vm, true, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn) < 0) goto error; @@ -3747,15 +3716,13 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, * end of the migration. */ if (jobPriv->current->status == QEMU_DOMAIN_JOB_STATUS_PAUSED) { - if (qemuMigrationSrcContinue(driver, vm, - QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER, + if (qemuMigrationSrcContinue(vm, QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto error; waitFlags ^= QEMU_MIGRATION_COMPLETED_PRE_SWITCHOVER; - rc = qemuMigrationSrcWaitForCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT, + rc = qemuMigrationSrcWaitForCompletion(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn, waitFlags); if (rc == -2) { goto error; @@ -3807,15 +3774,14 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (virDomainObjIsActive(vm)) { if (cancel && jobPriv->current->status != QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED && - qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { + qemuDomainObjEnterMonitorAsync(vm, QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { qemuMonitorMigrateCancel(priv->mon); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } /* cancel any outstanding NBD jobs */ if (mig && mig->nbd) - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(vm, false, QEMU_ASYNC_JOB_MIGRATION_OUT, dconn); @@ -3829,7 +3795,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, goto cleanup; exit_monitor: - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto error; } @@ -4064,7 +4030,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver, * until the migration is complete. */ VIR_DEBUG("Perform %p", sconn); - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2); if (flags & VIR_MIGRATE_TUNNELLED) ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL, NULL, 0, NULL, NULL, @@ -4302,7 +4268,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver, * confirm migration completion. */ VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri)); - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3); VIR_FREE(cookiein); cookiein = g_steal_pointer(&cookieout); cookieinlen = cookieoutlen; @@ -4327,8 +4293,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver, if (ret < 0) { virErrorPreserveLast(&orig_err); } else { - qemuMigrationJobSetPhase(driver, vm, - QEMU_MIGRATION_PHASE_PERFORM3_DONE); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE); } /* If Perform returns < 0, then we need to cancel the VM @@ -4668,8 +4633,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainJobPrivatePtr jobPriv = priv->job.privateData; - if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, - flags) < 0) + if (qemuMigrationJobStart(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, flags) < 0) goto cleanup; if (!(flags & VIR_MIGRATE_OFFLINE) && virDomainObjCheckActive(vm) < 0) @@ -4692,7 +4656,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, migParams, flags, dname, resource, &v3proto); } else { - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2); ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen, cookieout, cookieoutlen, flags, resource, NULL, NULL, 0, NULL, @@ -4723,12 +4687,12 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, * here */ if (!v3proto && ret < 0) - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); qemuMigrationSrcRestoreDomainState(driver, vm); - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); if (!virDomainObjIsActive(vm) && ret == 0) { if (flags & VIR_MIGRATE_UNDEFINE_SOURCE) { virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm); @@ -4770,14 +4734,14 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver, /* If we didn't start the job in the begin phase, start it now. */ if (!(flags & VIR_MIGRATE_CHANGE_PROTECTION)) { - if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationJobStart(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, flags) < 0) return ret; } else if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_OUT)) { return ret; } - qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3); + qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3); virCloseCallbacksUnset(driver->closeCallbacks, vm, qemuMigrationSrcCleanup); @@ -4791,7 +4755,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver, goto endjob; } - qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE); + qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE); if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn, qemuMigrationSrcCleanup) < 0) @@ -4799,9 +4763,9 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver, endjob: if (ret < 0) { - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); } else { qemuMigrationJobContinue(vm); } @@ -5023,7 +4987,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, ignore_value(virTimeMillisNow(&timeReceived)); - qemuMigrationJobStartPhase(driver, vm, + qemuMigrationJobStartPhase(vm, v3proto ? QEMU_MIGRATION_PHASE_FINISH3 : QEMU_MIGRATION_PHASE_FINISH2); @@ -5052,7 +5016,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, /* Check for a possible error on the monitor in case Finish was called * earlier than monitor EOF handler got a chance to process the error */ - qemuDomainCheckMonitor(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN); + qemuDomainCheckMonitor(vm, QEMU_ASYNC_JOB_MIGRATION_IN); goto endjob; } @@ -5069,7 +5033,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, if (mig->network && qemuMigrationDstOPDRelocate(driver, vm, mig) < 0) VIR_WARN("unable to provide network data for relocation"); - if (qemuMigrationDstStopNBDServer(driver, vm, mig) < 0) + if (qemuMigrationDstStopNBDServer(vm, mig) < 0) goto endjob; if (qemuRefreshVirtioChannelState(driver, vm, @@ -5101,8 +5065,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, /* We need to wait for QEMU to process all data sent by the source * before starting guest CPUs. */ - if (qemuMigrationDstWaitForCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationDstWaitForCompletion(vm, QEMU_ASYNC_JOB_MIGRATION_IN, !!(flags & VIR_MIGRATE_POSTCOPY)) < 0) { /* There's not much we can do for v2 protocol since the * original domain on the source host is already gone. @@ -5170,8 +5133,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, } if (inPostCopy) { - if (qemuMigrationDstWaitForCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationDstWaitForCompletion(vm, QEMU_ASYNC_JOB_MIGRATION_IN, false) < 0) { goto endjob; } @@ -5252,10 +5214,10 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, g_clear_pointer(&jobPriv->completed, qemuDomainJobInfoFree); } - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_MIGRATION_IN, jobPriv->migParams, priv->job.apiFlags); - qemuMigrationJobFinish(driver, vm); + qemuMigrationJobFinish(vm); if (!virDomainObjIsActive(vm)) qemuDomainRemoveInactiveJob(driver, vm); @@ -5308,16 +5270,16 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024 * 1024) < 0) return -1; - if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0) + if (qemuMigrationParamsApply(vm, asyncJob, migParams) < 0) return -1; priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; } else { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuMonitorSetMigrationSpeed(priv->mon, QEMU_DOMAIN_MIG_BANDWIDTH_MAX); priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; } } @@ -5340,7 +5302,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, compressor ? pipeFD[1] : fd) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; if (!compressor) { @@ -5355,11 +5317,11 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, if (virSetCloseExec(pipeFD[1]) < 0) { virReportSystemError(errno, "%s", _("Unable to set cloexec flag")); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto cleanup; } if (virCommandRunAsync(compressor, NULL) < 0) { - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); goto cleanup; } rc = qemuMonitorMigrateToFd(priv->mon, @@ -5369,21 +5331,21 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, VIR_CLOSE(pipeFD[1]) < 0) VIR_WARN("failed to close intermediate pipe"); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (rc < 0) goto cleanup; - rc = qemuMigrationSrcWaitForCompletion(driver, vm, asyncJob, NULL, 0); + rc = qemuMigrationSrcWaitForCompletion(vm, asyncJob, NULL, 0); if (rc < 0) { if (rc == -2) { virErrorPreserveLast(&orig_err); virCommandAbort(compressor); if (virDomainObjIsActive(vm) && - qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuMonitorMigrateCancel(priv->mon); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } } goto cleanup; @@ -5405,12 +5367,12 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, if (qemuMigrationParamsSetULL(migParams, QEMU_MIGRATION_PARAM_MAX_BANDWIDTH, saveMigBandwidth * 1024 * 1024) == 0) - ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob, + ignore_value(qemuMigrationParamsApply(vm, asyncJob, migParams)); } else { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth); - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); } } priv->migMaxBandwidth = saveMigBandwidth; @@ -5430,8 +5392,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, int -qemuMigrationSrcCancel(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuMigrationSrcCancel(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; bool storage = false; @@ -5440,9 +5401,9 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver, VIR_DEBUG("Canceling unfinished outgoing migration of domain %s", vm->def->name); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; for (i = 0; i < vm->def->ndisks; i++) { @@ -5463,7 +5424,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver, } if (storage && - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(vm, false, QEMU_ASYNC_JOB_NONE, NULL) < 0) return -1; @@ -5472,8 +5433,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver, static int -qemuMigrationJobStart(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobStart(virDomainObjPtr vm, qemuDomainAsyncJob job, unsigned long apiFlags) { @@ -5492,7 +5452,7 @@ qemuMigrationJobStart(virQEMUDriverPtr driver, JOB_MASK(QEMU_JOB_MIGRATION_OP); } - if (qemuDomainObjBeginAsyncJob(driver, vm, job, op, apiFlags) < 0) + if (qemuDomainObjBeginAsyncJob(vm, job, op, apiFlags) < 0) return -1; jobPriv->current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION; @@ -5502,8 +5462,7 @@ qemuMigrationJobStart(virQEMUDriverPtr driver, } static void -qemuMigrationJobSetPhase(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobSetPhase(virDomainObjPtr vm, qemuMigrationJobPhase phase) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -5515,15 +5474,14 @@ qemuMigrationJobSetPhase(virQEMUDriverPtr driver, return; } - qemuDomainObjSetJobPhase(driver, vm, phase); + qemuDomainObjSetJobPhase(vm, phase); } static void -qemuMigrationJobStartPhase(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationJobStartPhase(virDomainObjPtr vm, qemuMigrationJobPhase phase) { - qemuMigrationJobSetPhase(driver, vm, phase); + qemuMigrationJobSetPhase(vm, phase); } static void @@ -5553,9 +5511,9 @@ qemuMigrationJobIsActive(virDomainObjPtr vm, } static void -qemuMigrationJobFinish(virQEMUDriverPtr driver, virDomainObjPtr vm) +qemuMigrationJobFinish(virDomainObjPtr vm) { - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); } @@ -5612,8 +5570,7 @@ qemuMigrationDstErrorReport(virQEMUDriverPtr driver, int -qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcFetchMirrorStats(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, qemuDomainJobInfoPtr jobInfo) { @@ -5634,12 +5591,12 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver, if (!nbd) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; blockinfo = qemuMonitorGetAllBlockJobInfo(priv->mon, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockinfo) + if (qemuDomainObjExitMonitor(vm) < 0 || !blockinfo) return -1; memset(stats, 0, sizeof(*stats)); diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index b6f88d3fd9..e99351ef82 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -210,12 +210,10 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; int -qemuMigrationSrcCancel(virQEMUDriverPtr driver, - virDomainObjPtr vm); +qemuMigrationSrcCancel(virDomainObjPtr vm); int -qemuMigrationAnyFetchStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationAnyFetchStats(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, qemuDomainJobInfoPtr jobInfo, char **error); @@ -241,8 +239,7 @@ qemuMigrationDstGetURI(const char *migrateFrom, int migrateFd); int -qemuMigrationDstRun(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationDstRun(virDomainObjPtr vm, const char *uri, qemuDomainAsyncJob asyncJob); @@ -251,7 +248,6 @@ qemuMigrationAnyPostcopyFailed(virQEMUDriverPtr driver, virDomainObjPtr vm); int -qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSrcFetchMirrorStats(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, qemuDomainJobInfoPtr jobInfo); diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index a0e8cba8ba..949f2a2d97 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -450,7 +450,6 @@ qemuMigrationCookieAddNetwork(qemuMigrationCookiePtr mig, static int qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig, - virQEMUDriverPtr driver, virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -473,13 +472,13 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig, mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks); mig->nbd->ndisks = 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, priv->job.asyncJob) < 0) return -1; if (blockdev) rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); else rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; for (i = 0; i < vm->def->ndisks; i++) { @@ -1421,7 +1420,7 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig, } if ((flags & QEMU_MIGRATION_COOKIE_NBD) && - qemuMigrationCookieAddNBD(mig, driver, dom) < 0) + qemuMigrationCookieAddNBD(mig, dom) < 0) return -1; if (flags & QEMU_MIGRATION_COOKIE_STATS && diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 04434e9557..9252ce50d5 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -819,7 +819,6 @@ qemuMigrationCapsToJSON(virBitmapPtr caps, /** * qemuMigrationParamsApply - * @driver: qemu driver * @vm: domain object * @asyncJob: migration job * @migParams: migration parameters to send to QEMU @@ -829,8 +828,7 @@ qemuMigrationCapsToJSON(virBitmapPtr caps, * Returns 0 on success, -1 on failure. */ int -qemuMigrationParamsApply(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsApply(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr migParams) { @@ -842,7 +840,7 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, int ret = -1; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (asyncJob == QEMU_ASYNC_JOB_NONE) { @@ -890,7 +888,7 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (xbzrleCacheSize_old) @@ -991,9 +989,9 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver, * This should prevent any issues just in case some cleanup wasn't * properly completed (both src and dst use the same alias) or * some other error path between now and perform . */ - qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, *tlsAlias); + qemuDomainDelTLSObjects(vm, asyncJob, secAlias, *tlsAlias); - if (qemuDomainAddTLSObjects(driver, vm, asyncJob, &secProps, &tlsProps) < 0) + if (qemuDomainAddTLSObjects(vm, asyncJob, &secProps, &tlsProps) < 0) return -1; if (qemuMigrationParamsSetString(migParams, @@ -1042,7 +1040,6 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm, /* qemuMigrationParamsResetTLS - * @driver: pointer to qemu driver * @vm: domain object * @asyncJob: migration job to join * @apiFlags: API flags used to start the migration @@ -1051,8 +1048,7 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm, * security objects and free the secinfo */ static void -qemuMigrationParamsResetTLS(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsResetTLS(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr origParams, unsigned long apiFlags) @@ -1069,14 +1065,13 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver, tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE); secAlias = qemuAliasForSecret(QEMU_MIGRATION_TLS_ALIAS_BASE, NULL); - qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias); + qemuDomainDelTLSObjects(vm, asyncJob, secAlias, tlsAlias); g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree); } int -qemuMigrationParamsFetch(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsFetch(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr *migParams) { @@ -1086,12 +1081,12 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver, *migParams = NULL; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMigrationParams(priv->mon, &jsonParams); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; if (!(*migParams = qemuMigrationParamsFromJSON(jsonParams))) @@ -1145,8 +1140,7 @@ qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams, * are unsupported by QEMU. */ int -qemuMigrationParamsCheck(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsCheck(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr migParams, virBitmapPtr remoteCaps) @@ -1206,7 +1200,7 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver, * to ask QEMU for their current settings. */ - return qemuMigrationParamsFetch(driver, vm, asyncJob, &jobPriv->migParams); + return qemuMigrationParamsFetch(vm, asyncJob, &jobPriv->migParams); } @@ -1217,8 +1211,7 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver, * migration (save, managedsave, snapshots, dump) will not try to use them. */ void -qemuMigrationParamsReset(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsReset(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr origParams, unsigned long apiFlags) @@ -1233,10 +1226,10 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver, if (!virDomainObjIsActive(vm) || !origParams) goto cleanup; - if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams) < 0) + if (qemuMigrationParamsApply(vm, asyncJob, origParams) < 0) goto cleanup; - qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags); + qemuMigrationParamsResetTLS(vm, asyncJob, origParams, apiFlags); cleanup: virErrorRestore(&err); @@ -1384,8 +1377,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt, int -qemuMigrationCapsCheck(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationCapsCheck(virDomainObjPtr vm, int asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -1396,12 +1388,12 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver, int ret = -1; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) goto cleanup; if (!caps) { @@ -1434,13 +1426,13 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver, if (!(json = qemuMigrationCapsToJSON(migEvent, migEvent))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorSetMigrationCapabilities(priv->mon, json); json = NULL; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (rc < 0) { diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h index 9aea24725f..231f4db90b 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -95,8 +95,7 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams); G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMigrationParams, qemuMigrationParamsFree); int -qemuMigrationParamsApply(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsApply(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr migParams); @@ -114,8 +113,7 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm, qemuMigrationParamsPtr migParams); int -qemuMigrationParamsFetch(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsFetch(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr *migParams); @@ -130,15 +128,13 @@ qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams, unsigned long long *value); int -qemuMigrationParamsCheck(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsCheck(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr migParams, virBitmapPtr remoteCaps); void -qemuMigrationParamsReset(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationParamsReset(virDomainObjPtr vm, int asyncJob, qemuMigrationParamsPtr origParams, unsigned long apiFlags); @@ -152,8 +148,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt, qemuMigrationParamsPtr *migParams); int -qemuMigrationCapsCheck(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationCapsCheck(virDomainObjPtr vm, int asyncJob); bool diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 652d217b5c..b30b7fa11d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -422,7 +422,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon G_GNUC_UNUSED, if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY || vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) { - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -436,7 +436,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon G_GNUC_UNUSED, virDomainAuditStop(vm, "destroyed"); qemuDomainRemoveInactive(driver, vm); endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); } ret = 0; @@ -467,7 +467,7 @@ qemuProcessFakeReboot(void *opaque) VIR_DEBUG("vm=%p", vm); virObjectLock(vm); - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -476,10 +476,10 @@ qemuProcessFakeReboot(void *opaque) goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; if (rc < 0) @@ -505,7 +505,7 @@ qemuProcessFakeReboot(void *opaque) ret = 0; endjob: - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: priv->pausedShutdown = false; @@ -1947,18 +1947,17 @@ qemuProcessMonitorLogFree(void *opaque) static int -qemuProcessInitMonitor(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessInitMonitor(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorSetCapabilities(QEMU_DOMAIN_PRIVATE(vm)->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; @@ -2017,10 +2016,10 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob, return -1; } - if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0) + if (qemuProcessInitMonitor(vm, asyncJob) < 0) return -1; - if (qemuMigrationCapsCheck(driver, vm, asyncJob) < 0) + if (qemuMigrationCapsCheck(vm, asyncJob) < 0) return -1; return 0; @@ -2255,11 +2254,11 @@ qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, virHashTablePtr info = NULL; int ret = -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorGetChardevInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) @@ -2300,8 +2299,7 @@ qemuProcessRefreshPRManagerState(virDomainObjPtr vm, static int -qemuRefreshPRManagerState(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuRefreshPRManagerState(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virHashTablePtr info = NULL; @@ -2311,9 +2309,9 @@ qemuRefreshPRManagerState(virQEMUDriverPtr driver, !qemuDomainDefHasManagedPR(vm)) return 0; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetPRManagerInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) @@ -2328,8 +2326,7 @@ qemuRefreshPRManagerState(virQEMUDriverPtr driver, static void -qemuRefreshRTC(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuRefreshRTC(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; time_t now, then; @@ -2341,10 +2338,10 @@ qemuRefreshRTC(virQEMUDriverPtr driver, return; memset(&thenbits, 0, sizeof(thenbits)); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); now = time(NULL); rv = qemuMonitorGetRTCTime(priv->mon, &thenbits); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) rv = -1; if (rv < 0) @@ -2365,8 +2362,7 @@ qemuRefreshRTC(virQEMUDriverPtr driver, } int -qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessRefreshBalloonState(virDomainObjPtr vm, int asyncJob) { unsigned long long balloon; @@ -2379,11 +2375,11 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, return 0; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetBalloonInfo(qemuDomainGetMonitor(vm), &balloon); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; vm->def->mem.cur_balloon = balloon; @@ -2417,11 +2413,11 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, * reliable if it's available. * Note that the monitor itself can be on a pty, so we still need to try the * log output method. */ - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorGetChardevInfo(priv->mon, &info); VIR_DEBUG("qemuMonitorGetChardevInfo returned %i", ret); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret == 0) { @@ -2445,8 +2441,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, static int -qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessDetectIOThreadPIDs(virDomainObjPtr vm, int asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -2461,10 +2456,10 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, } /* Get the list of IOThreads from qemu */ - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; niothreads = qemuMonitorGetIOThreads(priv->mon, &iothreads); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (niothreads < 0) goto cleanup; @@ -2589,8 +2584,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm G_GNUC_UNUSED) /* set link states to down on interfaces at qemu start */ static int -qemuProcessSetLinkStates(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessSetLinkStates(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -2599,7 +2593,7 @@ qemuProcessSetLinkStates(virQEMUDriverPtr driver, int ret = -1; int rv; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; for (i = 0; i < def->nnets; i++) { @@ -2627,7 +2621,7 @@ qemuProcessSetLinkStates(virQEMUDriverPtr driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; } @@ -2978,14 +2972,12 @@ qemuProcessInitPasswords(virQEMUDriverPtr driver, for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = vm->def->graphics[i]; if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - ret = qemuDomainChangeGraphicsPasswords(driver, vm, - VIR_DOMAIN_GRAPHICS_TYPE_VNC, + ret = qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC, &graphics->data.vnc.auth, cfg->vncPassword, asyncJob); } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - ret = qemuDomainChangeGraphicsPasswords(driver, vm, - VIR_DOMAIN_GRAPHICS_TYPE_SPICE, + ret = qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &graphics->data.spice.auth, cfg->spicePassword, asyncJob); @@ -3057,7 +3049,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, virDomainVideoDefPtr video = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; for (i = 0; i < vm->def->nvideos; i++) { @@ -3109,7 +3101,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; cfg = virQEMUDriverGetConfig(driver); @@ -3118,7 +3110,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, return ret; error: - ignore_value(qemuDomainObjExitMonitor(driver, vm)); + ignore_value(qemuDomainObjExitMonitor(vm)); return -1; } @@ -3237,11 +3229,11 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, priv->runningReason = reason; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto release; ret = qemuMonitorStartCPUs(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) @@ -3276,11 +3268,11 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver, priv->pausedReason = reason; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorStopCPUs(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; if (ret < 0) @@ -3360,7 +3352,7 @@ qemuProcessFiltersInstantiate(virDomainDefPtr def) } static int -qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm) +qemuProcessUpdateState(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virDomainState state; @@ -3372,9 +3364,9 @@ qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm) g_autofree char *msg = NULL; int ret; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetStatus(priv->mon, &running, &reason); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (ret < 0) @@ -3479,7 +3471,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver, break; } - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_NONE, jobPriv->migParams, job->apiFlags); return 0; } @@ -3523,7 +3515,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, } else { VIR_DEBUG("Cancelling unfinished migration of domain %s", vm->def->name); - if (qemuMigrationSrcCancel(driver, vm) < 0) { + if (qemuMigrationSrcCancel(vm) < 0) { VIR_WARN("Could not cancel ongoing migration of domain %s", vm->def->name); } @@ -3575,7 +3567,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, } } - qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_NONE, + qemuMigrationParamsReset(vm, QEMU_ASYNC_JOB_NONE, jobPriv->migParams, job->apiFlags); return 0; } @@ -3610,9 +3602,9 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver, case QEMU_ASYNC_JOB_SAVE: case QEMU_ASYNC_JOB_DUMP: case QEMU_ASYNC_JOB_SNAPSHOT: - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; /* resume the domain but only if it was paused as a result of * running a migration-to-file operation. Although we are @@ -3721,7 +3713,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, old = priv->qemuDevices; priv->qemuDevices = NULL; - if (qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuDomainUpdateDeviceList(vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; qemuDevices = (const char **)priv->qemuDevices; @@ -4196,8 +4188,7 @@ qemuProcessTranslateCPUFeatures(const char *name, static int -qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessFetchGuestCPU(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virCPUDataPtr *enabled, virCPUDataPtr *disabled) @@ -4216,7 +4207,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, if (!generic && !ARCH_IS_X86(vm->def->os.arch)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (generic) { @@ -4228,7 +4219,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) return -1; if (rc == -1) @@ -4303,15 +4294,14 @@ qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, static int -qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessUpdateAndVerifyCPU(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { virCPUDataPtr cpu = NULL; virCPUDataPtr disabled = NULL; int ret = -1; - if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) + if (qemuProcessFetchGuestCPU(vm, asyncJob, &cpu, &disabled) < 0) goto cleanup; if (qemuProcessVerifyCPU(vm, cpu) < 0) @@ -4330,8 +4320,7 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver, static int -qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessFetchCPUDefinitions(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob, virDomainCapsCPUModelsPtr *cpuModels) { @@ -4339,12 +4328,12 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver, g_autoptr(virDomainCapsCPUModels) models = NULL; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = virQEMUCapsFetchCPUModels(priv->mon, vm->def->os.arch, &models); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; *cpuModels = g_steal_pointer(&models); @@ -4353,8 +4342,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver, static int -qemuProcessUpdateCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessUpdateCPU(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { g_autoptr(virCPUData) cpu = NULL; @@ -4366,13 +4354,13 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, */ vm->def->cpu->fallback = VIR_CPU_FALLBACK_ALLOW; - if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) + if (qemuProcessFetchGuestCPU(vm, asyncJob, &cpu, &disabled) < 0) return -1; if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) return -1; - if (qemuProcessFetchCPUDefinitions(driver, vm, asyncJob, &models) < 0 || + if (qemuProcessFetchCPUDefinitions(vm, asyncJob, &models) < 0 || virCPUTranslate(vm->def->os.arch, vm->def->cpu, models) < 0) return -1; @@ -4578,12 +4566,11 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps, * parameter between qemuProcessBeginJob and qemuProcessEndJob. */ int -qemuProcessBeginJob(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessBeginJob(virDomainObjPtr vm, virDomainJobOperation operation, unsigned long apiFlags) { - if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_START, + if (qemuDomainObjBeginAsyncJob(vm, QEMU_ASYNC_JOB_START, operation, apiFlags) < 0) return -1; @@ -4593,10 +4580,9 @@ qemuProcessBeginJob(virQEMUDriverPtr driver, void -qemuProcessEndJob(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuProcessEndJob(virDomainObjPtr vm) { - qemuDomainObjEndAsyncJob(driver, vm); + qemuDomainObjEndAsyncJob(vm); } @@ -5052,8 +5038,7 @@ qemuProcessSetupRawIO(virQEMUDriverPtr driver, static int -qemuProcessSetupBalloon(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessSetupBalloon(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { unsigned long long balloon = vm->def->mem.cur_balloon; @@ -5063,7 +5048,7 @@ qemuProcessSetupBalloon(virQEMUDriverPtr driver, if (!virDomainDefHasMemballoon(vm->def)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (vm->def->memballoon->period) @@ -5075,7 +5060,7 @@ qemuProcessSetupBalloon(virQEMUDriverPtr driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; } @@ -5918,8 +5903,7 @@ qemuProcessVcpusSortOrder(const void *a, static int -qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessSetupHotpluggableVcpus(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { unsigned int maxvcpus = virDomainDefGetVcpusMax(vm->def); @@ -5965,13 +5949,13 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver, if (!(vcpuprops = qemuBuildHotpluggableCPUProps(vcpu))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops); vcpuprops = NULL; - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; if (rc < 0) @@ -6602,8 +6586,7 @@ qemuProcessGenID(virDomainObjPtr vm, * Same hack is done in qemuDomainAttachDiskGeneric. */ static int -qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessSetupDiskThrottlingBlockdev(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -6615,7 +6598,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver, VIR_DEBUG("Setting up disk throttling for -blockdev via block_set_io_throttle"); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; for (i = 0; i < vm->def->ndisks; i++) { @@ -6638,7 +6621,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; return ret; } @@ -6928,23 +6911,23 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; VIR_DEBUG("Verifying and updating provided guest CPU"); - if (qemuProcessUpdateAndVerifyCPU(driver, vm, asyncJob) < 0) + if (qemuProcessUpdateAndVerifyCPU(vm, asyncJob) < 0) goto cleanup; VIR_DEBUG("setting up hotpluggable cpus"); if (qemuDomainHasHotpluggableStartupVcpus(vm->def)) { - if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, asyncJob, false) < 0) goto cleanup; if (qemuProcessValidateHotpluggableVcpus(vm->def) < 0) goto cleanup; - if (qemuProcessSetupHotpluggableVcpus(driver, vm, asyncJob) < 0) + if (qemuProcessSetupHotpluggableVcpus(vm, asyncJob) < 0) goto cleanup; } VIR_DEBUG("Refreshing VCPU info"); - if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, asyncJob, false) < 0) goto cleanup; if (qemuDomainValidateVcpuInfo(vm) < 0) @@ -6953,7 +6936,7 @@ qemuProcessLaunch(virConnectPtr conn, qemuDomainVcpuPersistOrder(vm->def); VIR_DEBUG("Detecting IOThread PIDs"); - if (qemuProcessDetectIOThreadPIDs(driver, vm, asyncJob) < 0) + if (qemuProcessDetectIOThreadPIDs(vm, asyncJob) < 0) goto cleanup; VIR_DEBUG("Setting global CPU cgroup (if required)"); @@ -6983,21 +6966,21 @@ qemuProcessLaunch(virConnectPtr conn, /* qemu doesn't support setting this on the command line, so * enter the monitor */ VIR_DEBUG("Setting network link states"); - if (qemuProcessSetLinkStates(driver, vm, asyncJob) < 0) + if (qemuProcessSetLinkStates(vm, asyncJob) < 0) goto cleanup; VIR_DEBUG("Setting initial memory amount"); - if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0) + if (qemuProcessSetupBalloon(vm, asyncJob) < 0) goto cleanup; - if (qemuProcessSetupDiskThrottlingBlockdev(driver, vm, asyncJob) < 0) + if (qemuProcessSetupDiskThrottlingBlockdev(vm, asyncJob) < 0) goto cleanup; /* Since CPUs were not started yet, the balloon could not return the memory * to the host and thus cur_balloon needs to be updated so that GetXMLdesc * and friends return the correct size in case they can't grab the job */ if (!incoming && !snapshot && - qemuProcessRefreshBalloonState(driver, vm, asyncJob) < 0) + qemuProcessRefreshBalloonState(vm, asyncJob) < 0) goto cleanup; if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY && @@ -7030,11 +7013,11 @@ qemuProcessRefreshState(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; VIR_DEBUG("Fetching list of active devices"); - if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) + if (qemuDomainUpdateDeviceList(vm, asyncJob) < 0) return -1; VIR_DEBUG("Updating info of memory devices"); - if (qemuDomainUpdateMemoryDeviceInfo(driver, vm, asyncJob) < 0) + if (qemuDomainUpdateMemoryDeviceInfo(vm, asyncJob) < 0) return -1; VIR_DEBUG("Detecting actual memory size for video device"); @@ -7042,10 +7025,10 @@ qemuProcessRefreshState(virQEMUDriverPtr driver, return -1; VIR_DEBUG("Updating disk data"); - if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) + if (qemuProcessRefreshDisks(vm, asyncJob) < 0) return -1; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && - qemuBlockNodeNamesDetect(driver, vm, asyncJob) < 0) + qemuBlockNodeNamesDetect(vm, asyncJob) < 0) return -1; return 0; @@ -7164,7 +7147,7 @@ qemuProcessStart(virConnectPtr conn, if (incoming) { if (incoming->deferredURI && - qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0) + qemuMigrationDstRun(vm, incoming->deferredURI, asyncJob) < 0) goto stop; } else { /* Refresh state of devices from QEMU. During migration this happens @@ -7292,8 +7275,7 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags) * qemuProcessStop. */ int -qemuProcessBeginStopJob(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessBeginStopJob(virDomainObjPtr vm, qemuDomainJob job, bool forceKill) { @@ -7313,7 +7295,7 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver, /* Wake up anything waiting on domain condition */ virDomainObjBroadcast(vm); - if (qemuDomainObjBeginJob(driver, vm, job) < 0) + if (qemuDomainObjBeginJob(vm, job) < 0) goto cleanup; ret = 0; @@ -7354,7 +7336,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, virErrorPreserveLast(&orig_err); if (asyncJob != QEMU_ASYNC_JOB_NONE) { - if (qemuDomainObjBeginNestedJob(driver, vm, asyncJob) < 0) + if (qemuDomainObjBeginNestedJob(vm, asyncJob) < 0) goto cleanup; } else if (priv->job.asyncJob != QEMU_ASYNC_JOB_NONE && priv->job.asyncOwner == virThreadSelfID() && @@ -7660,7 +7642,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, endjob: if (asyncJob != QEMU_ASYNC_JOB_NONE) - qemuDomainObjEndJob(driver, vm); + qemuDomainObjEndJob(vm); cleanup: virErrorRestore(&orig_err); @@ -7685,12 +7667,12 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, if (priv->job.asyncJob) { VIR_DEBUG("vm=%s has long-term job active, cancelling", dom->def->name); - qemuDomainObjDiscardAsyncJob(driver, dom); + qemuDomainObjDiscardAsyncJob(dom); } VIR_DEBUG("Killing domain"); - if (qemuProcessBeginStopJob(driver, dom, QEMU_JOB_DESTROY, true) < 0) + if (qemuProcessBeginStopJob(dom, QEMU_JOB_DESTROY, true) < 0) return; qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, @@ -7703,7 +7685,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, qemuDomainRemoveInactive(driver, dom); - qemuDomainObjEndJob(driver, dom); + qemuDomainObjEndJob(dom); virObjectEventStateQueue(driver->domainEventState, event); } @@ -7736,8 +7718,7 @@ bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver, int -qemuProcessRefreshDisks(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessRefreshDisks(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -7746,9 +7727,9 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, int ret = -1; size_t i; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { table = qemuMonitorGetBlockInfo(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; } @@ -7793,8 +7774,7 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, static int -qemuProcessRefreshCPUMigratability(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuProcessRefreshCPUMigratability(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -7813,12 +7793,12 @@ qemuProcessRefreshCPUMigratability(virQEMUDriverPtr driver, if (!ARCH_IS_X86(def->os.arch)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetCPUMigratable(priv->mon, &migratable); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) return -1; if (rc == 1) @@ -7853,7 +7833,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, if (!vm->def->cpu) return 0; - if (qemuProcessRefreshCPUMigratability(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshCPUMigratability(vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; if (!(host = virQEMUDriverGetHostCPU(driver))) { @@ -7888,7 +7868,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, cpu) < 0) return -1; - if (qemuProcessUpdateCPU(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessUpdateCPU(vm, QEMU_ASYNC_JOB_NONE) < 0) return -1; } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) { /* We only try to fix CPUs when the libvirt/QEMU combo used to start @@ -7967,15 +7947,14 @@ qemuProcessRefreshLegacyBlockjob(void *payload, static int -qemuProcessRefreshLegacyBlockjobs(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuProcessRefreshLegacyBlockjobs(virDomainObjPtr vm) { virHashTablePtr blockJobs = NULL; int ret = -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); blockJobs = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockJobs) + if (qemuDomainObjExitMonitor(vm) < 0 || !blockJobs) goto cleanup; if (virHashForEach(blockJobs, qemuProcessRefreshLegacyBlockjob, vm) < 0) @@ -7990,15 +7969,14 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriverPtr driver, static int -qemuProcessRefreshBlockjobs(virQEMUDriverPtr driver, - virDomainObjPtr vm) +qemuProcessRefreshBlockjobs(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) - return qemuBlockJobRefreshJobs(driver, vm); + return qemuBlockJobRefreshJobs(vm); else - return qemuProcessRefreshLegacyBlockjobs(driver, vm); + return qemuProcessRefreshLegacyBlockjobs(vm); } @@ -8053,7 +8031,7 @@ qemuProcessReconnect(void *opaque) cfg = virQEMUDriverGetConfig(driver); priv = obj->privateData; - if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(obj, QEMU_JOB_MODIFY) < 0) goto error; jobStarted = true; @@ -8137,7 +8115,7 @@ qemuProcessReconnect(void *opaque) goto error; } - if (qemuProcessUpdateState(driver, obj) < 0) + if (qemuProcessUpdateState(obj) < 0) goto error; state = virDomainObjGetState(obj, &reason); @@ -8186,12 +8164,12 @@ qemuProcessReconnect(void *opaque) if (qemuProcessRefreshCPU(driver, obj) < 0) goto error; - if (qemuDomainRefreshVcpuInfo(driver, obj, QEMU_ASYNC_JOB_NONE, true) < 0) + if (qemuDomainRefreshVcpuInfo(obj, QEMU_ASYNC_JOB_NONE, true) < 0) goto error; qemuDomainVcpuPersistOrder(obj->def); - if (qemuProcessDetectIOThreadPIDs(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessDetectIOThreadPIDs(obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) @@ -8201,32 +8179,32 @@ qemuProcessReconnect(void *opaque) qemuProcessFiltersInstantiate(obj->def); - if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshDisks(obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && - qemuBlockNodeNamesDetect(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + qemuBlockNodeNamesDetect(obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; /* If querying of guest's RTC failed, report error, but do not kill the domain. */ - qemuRefreshRTC(driver, obj); + qemuRefreshRTC(obj); - if (qemuProcessRefreshBalloonState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshBalloonState(obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; if (qemuProcessRecoverJob(driver, obj, &oldjob, &stopFlags) < 0) goto error; - if (qemuProcessRefreshBlockjobs(driver, obj) < 0) + if (qemuProcessRefreshBlockjobs(obj) < 0) goto error; if (qemuProcessUpdateDevices(driver, obj) < 0) goto error; - if (qemuRefreshPRManagerState(driver, obj) < 0) + if (qemuRefreshPRManagerState(obj) < 0) goto error; qemuProcessReconnectCheckMemAliasOrderMismatch(obj); @@ -8280,7 +8258,7 @@ qemuProcessReconnect(void *opaque) if (jobStarted) { if (!virDomainObjIsActive(obj)) qemuDomainRemoveInactive(driver, obj); - qemuDomainObjEndJob(driver, obj); + qemuDomainObjEndJob(obj); } else { if (!virDomainObjIsActive(obj)) qemuDomainRemoveInactiveJob(driver, obj); diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index dbd989c321..448b65537a 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -66,12 +66,10 @@ qemuProcessIncomingDefPtr qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps, const char *path); void qemuProcessIncomingDefFree(qemuProcessIncomingDefPtr inc); -int qemuProcessBeginJob(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuProcessBeginJob(virDomainObjPtr vm, virDomainJobOperation operation, unsigned long apiFlags); -void qemuProcessEndJob(virQEMUDriverPtr driver, - virDomainObjPtr vm); +void qemuProcessEndJob(virDomainObjPtr vm); typedef enum { VIR_QEMU_PROCESS_START_COLD = 1 << 0, @@ -145,8 +143,7 @@ typedef enum { VIR_QEMU_PROCESS_STOP_NO_RELABEL = 1 << 1, } qemuProcessStopFlags; -int qemuProcessBeginStopJob(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuProcessBeginStopJob(virDomainObjPtr vm, qemuDomainJob job, bool forceKill); void qemuProcessStop(virQEMUDriverPtr driver, @@ -195,12 +192,10 @@ int qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); -int qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuProcessRefreshBalloonState(virDomainObjPtr vm, int asyncJob); -int qemuProcessRefreshDisks(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuProcessRefreshDisks(virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); int qemuProcessStartManagedPRDaemon(virDomainObjPtr vm) G_GNUC_NO_INLINE; diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 1e18820a2b..b95335eca7 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -457,7 +457,7 @@ testQemuHotplugCpuPrepare(const char *test, priv->mon = qemuMonitorTestGetMonitor(data->mon); virObjectUnlock(priv->mon); - if (qemuDomainRefreshVcpuInfo(&driver, data->vm, 0, false) < 0) + if (qemuDomainRefreshVcpuInfo(data->vm, 0, false) < 0) goto error; return data; -- 2.25.1