Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/qemu/qemu_backup.c | 21 +- src/qemu/qemu_backup.h | 3 +- src/qemu/qemu_block.c | 26 +- src/qemu/qemu_block.h | 6 +- src/qemu/qemu_blockjob.c | 25 +- src/qemu/qemu_blockjob.h | 3 +- src/qemu/qemu_checkpoint.c | 15 +- src/qemu/qemu_domain.c | 43 +-- src/qemu/qemu_domain.h | 21 +- src/qemu/qemu_domainjob.c | 30 +- src/qemu/qemu_domainjob.h | 15 +- src/qemu/qemu_driver.c | 563 +++++++++++++------------------ src/qemu/qemu_hotplug.c | 213 ++++++------ src/qemu/qemu_hotplug.h | 39 +-- src/qemu/qemu_migration.c | 222 ++++++------ src/qemu/qemu_migration.h | 15 +- src/qemu/qemu_migration_cookie.c | 5 +- src/qemu/qemu_migration_params.c | 38 +-- src/qemu/qemu_migration_params.h | 15 +- src/qemu/qemu_process.c | 201 +++++------ src/qemu/qemu_process.h | 12 +- src/qemu/qemu_snapshot.c | 23 +- tests/qemuhotplugtest.c | 6 +- 23 files changed, 672 insertions(+), 888 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index d2a5d2db5f..61c6f89d7c 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -125,7 +125,7 @@ qemuBackupDiskDataCleanupOne(virDomainObj *vm, if (!dd->started) { if (dd->added) { - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]); qemuDomainObjExitMonitor(vm); } @@ -464,7 +464,7 @@ qemuBackupDiskPrepareOneStorage(virDomainObj *vm, VIR_ASYNC_JOB_BACKUP) < 0) return -1; } else { - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, VIR_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_BACKUP) < 0) return -1; rc = qemuBlockStorageSourceAttachApply(priv->mon, dd->crdata->srcdata[0]); @@ -671,7 +671,7 @@ qemuBackupJobCancelBlockjobs(virDomainObj *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 = qemuMonitorBlockJobCancel(priv->mon, job->name, true); @@ -786,7 +786,7 @@ qemuBackupBegin(virDomainObj *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, VIR_ASYNC_JOB_BACKUP, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_BACKUP, VIR_DOMAIN_JOB_OPERATION_BACKUP, flags) < 0) return -1; @@ -869,7 +869,7 @@ qemuBackupBegin(virDomainObj *vm, priv->backup = g_steal_pointer(&def); - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, VIR_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_BACKUP) < 0) goto endjob; if (pull) { @@ -905,7 +905,7 @@ qemuBackupBegin(virDomainObj *vm, } if (pull) { - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, VIR_ASYNC_JOB_BACKUP) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_BACKUP) < 0) goto endjob; /* note that if the export fails we've already created the checkpoint * and we will not delete it */ @@ -927,7 +927,7 @@ qemuBackupBegin(virDomainObj *vm, qemuCheckpointRollbackMetadata(vm, chk); if (!job_started && (nbd_running || tlsAlias || tlsSecretAlias) && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, VIR_ASYNC_JOB_BACKUP) == 0) { + qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_BACKUP) == 0) { if (nbd_running) ignore_value(qemuMonitorNBDServerStop(priv->mon)); if (tlsAlias) @@ -995,7 +995,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *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) @@ -1132,8 +1132,7 @@ qemuBackupGetJobInfoStatsUpdateOne(virDomainObj *vm, int -qemuBackupGetJobInfoStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuBackupGetJobInfoStats(virDomainObj *vm, virDomainJobData *jobData) { qemuDomainJobDataPrivate *privJob = jobData->privateData; @@ -1156,7 +1155,7 @@ qemuBackupGetJobInfoStats(virQEMUDriver *driver, jobData->status = VIR_DOMAIN_JOB_STATUS_ACTIVE; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetJobInfo(priv->mon, &blockjobs, &nblockjobs); diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index de4dff9357..ec0603026a 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -48,8 +48,7 @@ qemuBackupJobTerminate(virDomainObj *vm, virDomainJobStatus jobstatus); int -qemuBackupGetJobInfoStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuBackupGetJobInfoStats(virDomainObj *vm, virDomainJobData *jobData); /* exported for testing */ diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9fe22f18f2..c782611919 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -305,8 +305,7 @@ qemuBlockDiskDetectNodes(virDomainDiskDef *disk, int -qemuBlockNodeNamesDetect(virQEMUDriver *driver, - virDomainObj *vm, +qemuBlockNodeNamesDetect(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -319,7 +318,7 @@ qemuBlockNodeNamesDetect(virQEMUDriver *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)); @@ -2111,14 +2110,13 @@ qemuBlockStorageSourceChainDetach(qemuMonitor *mon, * monitor internally. */ int -qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuBlockStorageSourceDetachOneBlockdev(virDomainObj *vm, virDomainAsyncJob asyncJob, virStorageSource *src) { int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodeformat); @@ -2700,7 +2698,7 @@ qemuBlockStorageSourceCreateGeneric(virDomainObj *vm, qemuBlockJobSyncBegin(job); - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorBlockdevCreate(priv->mon, job->name, &props); @@ -2847,7 +2845,7 @@ qemuBlockStorageSourceCreate(virDomainObj *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); @@ -2859,7 +2857,7 @@ qemuBlockStorageSourceCreate(virDomainObj *vm, 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); @@ -2881,7 +2879,7 @@ qemuBlockStorageSourceCreate(virDomainObj *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); @@ -2895,7 +2893,7 @@ qemuBlockStorageSourceCreate(virDomainObj *vm, cleanup: if (ret < 0 && virDomainObjIsActive(vm) && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) == 0) { + qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { qemuBlockStorageSourceAttachRollback(priv->mon, data); qemuDomainObjExitMonitor(vm); @@ -3016,12 +3014,11 @@ qemuBlockGetNamedNodeData(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; g_autoptr(GHashTable) 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); @@ -3368,7 +3365,6 @@ qemuBlockReopenFormat(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; int rc; /* If we are lacking the object here, qemu might have opened an image with @@ -3379,7 +3375,7 @@ qemuBlockReopenFormat(virDomainObj *vm, return -1; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuBlockReopenFormatMon(priv->mon, src); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 8641c8a2d2..d488a3b8d1 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -44,8 +44,7 @@ qemuBlockNodeNameGetBackingChain(virJSONValue *namednodesdata, virJSONValue *blockstats); int -qemuBlockNodeNamesDetect(virQEMUDriver *driver, - virDomainObj *vm, +qemuBlockNodeNamesDetect(virDomainObj *vm, virDomainAsyncJob asyncJob); GHashTable * @@ -140,8 +139,7 @@ qemuBlockStorageSourceAttachRollback(qemuMonitor *mon, qemuBlockStorageSourceAttachData *data); int -qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuBlockStorageSourceDetachOneBlockdev(virDomainObj *vm, virDomainAsyncJob asyncJob, virStorageSource *src); diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index ed82ac5dc2..080b127a7e 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -486,8 +486,7 @@ qemuBlockJobRefreshJobsFindInactive(const void *payload, int -qemuBlockJobRefreshJobs(virQEMUDriver *driver, - virDomainObj *vm) +qemuBlockJobRefreshJobs(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; qemuMonitorJobInfo **jobinfo = NULL; @@ -498,7 +497,7 @@ qemuBlockJobRefreshJobs(virQEMUDriver *driver, int ret = -1; int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetJobInfo(priv->mon, &jobinfo, &njobinfo); @@ -520,7 +519,7 @@ qemuBlockJobRefreshJobs(virQEMUDriver *driver, qemuBlockJobMarkBroken(job); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockJobCancel(priv->mon, job->name, true); if (rc == -1 && jobinfo[i]->status == QEMU_MONITOR_JOB_STATUS_CONCLUDED) @@ -760,7 +759,7 @@ qemuBlockJobEventProcessLegacyCompleted(virQEMUDriver *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); } @@ -845,7 +844,7 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriver *driver, if (!(data = qemuBlockStorageSourceChainDetachPrepareBlockdev(chain))) return; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuBlockStorageSourceChainDetach(qemuDomainGetMonitor(vm), data); @@ -960,7 +959,7 @@ qemuBlockJobProcessEventCompletedPullBitmaps(virDomainObj *vm, if (!actions) return 0; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); @@ -1133,7 +1132,7 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObj *vm, return -1; } - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); @@ -1350,7 +1349,7 @@ qemuBlockJobProcessEventCompletedCopyBitmaps(virDomainObj *vm, if (!actions) return 0; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorTransaction(priv->mon, &actions); @@ -1446,7 +1445,7 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriver *driver, if (!disk) return; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuMonitorBitmapRemove(priv->mon, @@ -1494,7 +1493,7 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriver *driver, VIR_FREE(backend->encryptsecretAlias); } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), backend); @@ -1523,7 +1522,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver, !(backend = qemuBlockStorageSourceDetachPrepare(job->data.backup.store, NULL))) return; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return; if (backend) @@ -1614,7 +1613,7 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobData *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 */ diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 5ad3bfba42..741d8df6c5 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -214,8 +214,7 @@ qemuBlockJobStartupFinalize(virDomainObj *vm, qemuBlockJobData *job); int -qemuBlockJobRefreshJobs(virQEMUDriver *driver, - virDomainObj *vm); +qemuBlockJobRefreshJobs(virDomainObj *vm); void qemuBlockJobUpdate(virDomainObj *vm, diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 933ea41023..71650bde0e 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -232,7 +232,7 @@ qemuCheckpointDiscardBitmaps(virDomainObj *vm, relabelimages = g_slist_prepend(relabelimages, src); } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(priv->mon, &actions); qemuDomainObjExitMonitor(vm); @@ -519,7 +519,7 @@ qemuCheckpointCreate(virQEMUDriver *driver, if (qemuCheckpointCreateCommon(driver, vm, def, &actions, &chk) < 0) return NULL; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(qemuDomainGetMonitor(vm), &actions); qemuDomainObjExitMonitor(vm); if (rc < 0) { @@ -604,7 +604,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, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return NULL; if (redefine) { @@ -643,7 +643,6 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, virDomainCheckpointDef *chkdef) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; g_autoptr(GHashTable) nodedataMerge = NULL; g_autoptr(GHashTable) nodedataStats = NULL; g_autofree struct qemuCheckpointDiskMap *diskmap = NULL; @@ -655,7 +654,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -725,7 +724,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (rc == 0 && recoveractions) rc = qemuMonitorTransaction(priv->mon, &recoveractions); @@ -741,7 +740,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, if (!(nodedataStats = qemuBlockGetNamedNodeData(vm, VIR_ASYNC_JOB_NONE))) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorTransaction(priv->mon, &cleanupactions); @@ -849,7 +848,7 @@ qemuCheckpointDelete(virDomainObj *vm, VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY | VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, -1); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (!metadata_only) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7ac7c3c05a..b1c17bcd03 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6014,15 +6014,14 @@ qemuDomainSaveConfig(virDomainObj *obj) * To be followed with qemuDomainObjExitMonitor() once complete */ static int -qemuDomainObjEnterMonitorInternal(virQEMUDriver *driver, - virDomainObj *obj, +qemuDomainObjEnterMonitorInternal(virDomainObj *obj, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = obj->privateData; if (asyncJob != VIR_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", @@ -6080,10 +6079,9 @@ qemuDomainObjExitMonitor(virDomainObj *obj) qemuDomainObjEndJob(obj); } -void qemuDomainObjEnterMonitor(virQEMUDriver *driver, - virDomainObj *obj) +void qemuDomainObjEnterMonitor(virDomainObj *obj) { - ignore_value(qemuDomainObjEnterMonitorInternal(driver, obj, + ignore_value(qemuDomainObjEnterMonitorInternal(obj, VIR_ASYNC_JOB_NONE)); } @@ -6102,11 +6100,10 @@ void qemuDomainObjEnterMonitor(virQEMUDriver *driver, * in the meantime). */ int -qemuDomainObjEnterMonitorAsync(virQEMUDriver *driver, - virDomainObj *obj, +qemuDomainObjEnterMonitorAsync(virDomainObj *obj, virDomainAsyncJob asyncJob) { - return qemuDomainObjEnterMonitorInternal(driver, obj, asyncJob); + return qemuDomainObjEnterMonitorInternal(obj, asyncJob); } @@ -7143,7 +7140,7 @@ qemuDomainSnapshotDiscard(virQEMUDriver *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); qemuDomainObjExitMonitor(vm); @@ -7292,7 +7289,6 @@ qemuDomainRemoveInactiveLocked(virQEMUDriver *driver, virDomainObjListRemoveLocked(driver->domains, vm); } - void qemuDomainSetFakeReboot(virDomainObj *vm, bool value) @@ -8300,15 +8296,14 @@ qemuDomainHasBlockjob(virDomainObj *vm, int -qemuDomainUpdateDeviceList(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainUpdateDeviceList(virDomainObj *vm, int asyncJob) { qemuDomainObjPrivate *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); qemuDomainObjExitMonitor(vm); @@ -8322,8 +8317,7 @@ qemuDomainUpdateDeviceList(virQEMUDriver *driver, int -qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm, int asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -8334,7 +8328,7 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *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); @@ -9611,8 +9605,7 @@ qemuDomainSupportsNewVcpuHotplug(virDomainObj *vm) * Returns 0 on success and -1 on fatal error. */ int -qemuDomainRefreshVcpuInfo(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRefreshVcpuInfo(virDomainObj *vm, int asyncJob, bool state) { @@ -9629,7 +9622,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriver *driver, hotplug = qemuDomainSupportsNewVcpuHotplug(vm); VIR_DEBUG("Maxvcpus %zu hotplug %d", maxvcpus, hotplug); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, @@ -9757,8 +9750,7 @@ qemuDomainGetVcpuHalted(virDomainObj *vm, * Returns 0 on success and -1 on error */ int -qemuDomainRefreshVcpuHalted(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRefreshVcpuHalted(virDomainObj *vm, int asyncJob) { virDomainVcpuDef *vcpu; @@ -9777,7 +9769,7 @@ qemuDomainRefreshVcpuHalted(virQEMUDriver *driver, if (!ARCH_IS_S390(vm->def->os.arch)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus); @@ -10201,14 +10193,13 @@ qemuDomainVcpuPersistOrder(virDomainDef *def) int -qemuDomainCheckMonitor(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainCheckMonitor(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorCheck(priv->mon); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 4680df1098..0141213804 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -542,13 +542,11 @@ void qemuDomainEventFlush(int timer, void *opaque); qemuMonitor *qemuDomainGetMonitor(virDomainObj *vm) ATTRIBUTE_NONNULL(1); -void qemuDomainObjEnterMonitor(virQEMUDriver *driver, - virDomainObj *obj) +void qemuDomainObjEnterMonitor(virDomainObj *obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); void qemuDomainObjExitMonitor(virDomainObj *obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int qemuDomainObjEnterMonitorAsync(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjEnterMonitorAsync(virDomainObj *obj, virDomainAsyncJob asyncJob) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; @@ -782,11 +780,9 @@ extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; extern virDomainABIStability virQEMUDriverDomainABIStability; extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie; -int qemuDomainUpdateDeviceList(virQEMUDriver *driver, - virDomainObj *vm, int asyncJob); +int qemuDomainUpdateDeviceList(virDomainObj *vm, int asyncJob); -int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm, int asyncJob); bool qemuDomainDefCheckABIStability(virQEMUDriver *driver, @@ -854,13 +850,11 @@ bool qemuDomainSupportsNewVcpuHotplug(virDomainObj *vm); bool qemuDomainHasVcpuPids(virDomainObj *vm); pid_t qemuDomainGetVcpuPid(virDomainObj *vm, unsigned int vcpuid); int qemuDomainValidateVcpuInfo(virDomainObj *vm); -int qemuDomainRefreshVcpuInfo(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainRefreshVcpuInfo(virDomainObj *vm, int asyncJob, bool state); bool qemuDomainGetVcpuHalted(virDomainObj *vm, unsigned int vcpu); -int qemuDomainRefreshVcpuHalted(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainRefreshVcpuHalted(virDomainObj *vm, int asyncJob); bool qemuDomainSupportsNicdev(virDomainDef *def, @@ -948,8 +942,7 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDef *def) void qemuDomainVcpuPersistOrder(virDomainDef *def) ATTRIBUTE_NONNULL(1); -int qemuDomainCheckMonitor(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainCheckMonitor(virDomainObj *vm, virDomainAsyncJob asyncJob); bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video, diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index 0e1c7210c5..1b85e3bb2d 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -702,7 +702,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj) /** * qemuDomainObjBeginJobInternal: - * @driver: qemu driver * @obj: domain object * @job: virDomainJob to start * @asyncJob: virDomainAsyncJob to start @@ -723,8 +722,7 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj) * -1 otherwise. */ static int ATTRIBUTE_NONNULL(1) -qemuDomainObjBeginJobInternal(virQEMUDriver *driver G_GNUC_UNUSED, - virDomainObj *obj, +qemuDomainObjBeginJobInternal(virDomainObj *obj, virDomainJob job, virDomainAgentJob agentJob, virDomainAsyncJob asyncJob, @@ -949,11 +947,10 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver G_GNUC_UNUSED, * * Successful calls must be followed by EndJob eventually */ -int qemuDomainObjBeginJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginJob(virDomainObj *obj, virDomainJob job) { - if (qemuDomainObjBeginJobInternal(driver, obj, job, + if (qemuDomainObjBeginJobInternal(obj, job, VIR_AGENT_JOB_NONE, VIR_ASYNC_JOB_NONE, false) < 0) return -1; @@ -968,24 +965,22 @@ int qemuDomainObjBeginJob(virQEMUDriver *driver, * To end job call qemuDomainObjEndAgentJob. */ int -qemuDomainObjBeginAgentJob(virQEMUDriver *driver, - virDomainObj *obj, +qemuDomainObjBeginAgentJob(virDomainObj *obj, virDomainAgentJob agentJob) { - return qemuDomainObjBeginJobInternal(driver, obj, VIR_JOB_NONE, + return qemuDomainObjBeginJobInternal(obj, VIR_JOB_NONE, agentJob, VIR_ASYNC_JOB_NONE, false); } -int qemuDomainObjBeginAsyncJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginAsyncJob(virDomainObj *obj, virDomainAsyncJob asyncJob, virDomainJobOperation operation, unsigned long apiFlags) { qemuDomainObjPrivate *priv; - if (qemuDomainObjBeginJobInternal(driver, obj, VIR_JOB_ASYNC, + if (qemuDomainObjBeginJobInternal(obj, VIR_JOB_ASYNC, VIR_AGENT_JOB_NONE, asyncJob, false) < 0) return -1; @@ -997,8 +992,7 @@ int qemuDomainObjBeginAsyncJob(virQEMUDriver *driver, } int -qemuDomainObjBeginNestedJob(virQEMUDriver *driver, - virDomainObj *obj, +qemuDomainObjBeginNestedJob(virDomainObj *obj, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = obj->privateData; @@ -1015,7 +1009,7 @@ qemuDomainObjBeginNestedJob(virQEMUDriver *driver, priv->job.asyncOwner); } - return qemuDomainObjBeginJobInternal(driver, obj, + return qemuDomainObjBeginJobInternal(obj, VIR_JOB_ASYNC_NESTED, VIR_AGENT_JOB_NONE, VIR_ASYNC_JOB_NONE, @@ -1025,7 +1019,6 @@ qemuDomainObjBeginNestedJob(virQEMUDriver *driver, /** * qemuDomainObjBeginJobNowait: * - * @driver: qemu driver * @obj: domain object * @job: virDomainJob to start * @@ -1036,11 +1029,10 @@ qemuDomainObjBeginNestedJob(virQEMUDriver *driver, * Returns: see qemuDomainObjBeginJobInternal */ int -qemuDomainObjBeginJobNowait(virQEMUDriver *driver, - virDomainObj *obj, +qemuDomainObjBeginJobNowait(virDomainObj *obj, virDomainJob job) { - return qemuDomainObjBeginJobInternal(driver, obj, job, + return qemuDomainObjBeginJobInternal(obj, job, VIR_AGENT_JOB_NONE, VIR_ASYNC_JOB_NONE, true); } diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 7f2869bb41..bb3c7ede14 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -71,26 +71,21 @@ int qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob job, void qemuDomainEventEmitJobCompleted(virQEMUDriver *driver, virDomainObj *vm); -int qemuDomainObjBeginJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginJob(virDomainObj *obj, virDomainJob job) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginAgentJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginAgentJob(virDomainObj *obj, virDomainAgentJob agentJob) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginAsyncJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginAsyncJob(virDomainObj *obj, virDomainAsyncJob asyncJob, virDomainJobOperation operation, unsigned long apiFlags) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginNestedJob(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginNestedJob(virDomainObj *obj, virDomainAsyncJob asyncJob) G_GNUC_WARN_UNUSED_RESULT; -int qemuDomainObjBeginJobNowait(virQEMUDriver *driver, - virDomainObj *obj, +int qemuDomainObjBeginJobNowait(virDomainObj *obj, virDomainJob job) G_GNUC_WARN_UNUSED_RESULT; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 019ec4a035..0503a79075 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -184,7 +184,7 @@ qemuAutostartDomain(virDomainObj *vm, virResetLastError(); if (vm->autostart && !virDomainObjIsActive(vm)) { - if (qemuProcessBeginJob(driver, vm, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to start job on VM '%s': %s"), @@ -1623,7 +1623,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, NULL))) goto cleanup; - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_START, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_START, flags) < 0) { qemuDomainRemoveInactive(driver, vm); goto cleanup; @@ -1683,7 +1683,7 @@ static int qemuDomainSuspend(virDomainPtr dom) priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_SUSPEND) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_SUSPEND) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1733,7 +1733,7 @@ static int qemuDomainResume(virDomainPtr dom) if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1775,8 +1775,7 @@ static int qemuDomainResume(virDomainPtr dom) static int -qemuDomainShutdownFlagsAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainShutdownFlagsAgent(virDomainObj *vm, bool isReboot, bool reportError) { @@ -1785,7 +1784,7 @@ qemuDomainShutdownFlagsAgent(virQEMUDriver *driver, int agentFlag = isReboot ? QEMU_AGENT_SHUTDOWN_REBOOT : QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(driver, vm, + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; @@ -1810,8 +1809,7 @@ qemuDomainShutdownFlagsAgent(virQEMUDriver *driver, static int -qemuDomainShutdownFlagsMonitor(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainShutdownFlagsMonitor(virDomainObj *vm, bool isReboot) { int ret = -1; @@ -1819,7 +1817,7 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriver *driver, priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { @@ -1829,7 +1827,7 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriver *driver, } qemuDomainSetFakeReboot(vm, isReboot); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemPowerdown(priv->mon); qemuDomainObjExitMonitor(vm); @@ -1841,7 +1839,6 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriver *driver, static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; qemuDomainObjPrivate *priv; @@ -1874,7 +1871,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) agentForced = agentRequested && !acpiRequested; if (useAgent) { - ret = qemuDomainShutdownFlagsAgent(driver, vm, isReboot, agentForced); + ret = qemuDomainShutdownFlagsAgent(vm, isReboot, agentForced); if (ret < 0 && agentForced) goto cleanup; } @@ -1890,7 +1887,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) goto cleanup; } - ret = qemuDomainShutdownFlagsMonitor(driver, vm, isReboot); + ret = qemuDomainShutdownFlagsMonitor(vm, isReboot); } cleanup: @@ -1905,8 +1902,7 @@ static int qemuDomainShutdown(virDomainPtr dom) static int -qemuDomainRebootAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRebootAgent(virDomainObj *vm, bool isReboot, bool agentForced) { @@ -1917,7 +1913,7 @@ qemuDomainRebootAgent(virQEMUDriver *driver, if (!isReboot) agentFlag = QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(driver, vm, + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; @@ -1939,14 +1935,13 @@ qemuDomainRebootAgent(virQEMUDriver *driver, static int -qemuDomainRebootMonitor(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRebootMonitor(virDomainObj *vm, bool isReboot) { qemuDomainObjPrivate *priv = vm->privateData; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; @@ -1954,7 +1949,7 @@ qemuDomainRebootMonitor(virQEMUDriver *driver, goto endjob; qemuDomainSetFakeReboot(vm, isReboot); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemPowerdown(priv->mon); qemuDomainObjExitMonitor(vm); @@ -1967,7 +1962,6 @@ qemuDomainRebootMonitor(virQEMUDriver *driver, static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; qemuDomainObjPrivate *priv; @@ -2000,7 +1994,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) agentForced = agentRequested && !acpiRequested; if (useAgent) - ret = qemuDomainRebootAgent(driver, vm, isReboot, agentForced); + ret = qemuDomainRebootAgent(vm, isReboot, agentForced); if (ret < 0 && agentForced) goto cleanup; @@ -2010,7 +2004,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) */ if ((!useAgent) || (ret < 0 && (acpiRequested || !flags))) { - ret = qemuDomainRebootMonitor(driver, vm, isReboot); + ret = qemuDomainRebootMonitor(vm, isReboot); } cleanup: @@ -2022,7 +2016,6 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) static int qemuDomainReset(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; qemuDomainObjPrivate *priv; @@ -2036,14 +2029,14 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) if (virDomainResetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemReset(priv->mon); qemuDomainObjExitMonitor(vm); @@ -2095,7 +2088,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, reason == VIR_DOMAIN_PAUSED_STARTING_UP && !priv->beingDestroyed); - if (qemuProcessBeginStopJob(driver, vm, VIR_JOB_DESTROY, + if (qemuProcessBeginStopJob(vm, VIR_JOB_DESTROY, !(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < 0) goto cleanup; @@ -2205,7 +2198,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (virDomainSetMemoryFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2284,7 +2277,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (def) { priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); r = qemuMonitorSetBalloon(priv->mon, newmem); qemuDomainObjExitMonitor(vm); if (r < 0) @@ -2348,7 +2341,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, if (virDomainSetMemoryStatsPeriodEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2365,7 +2358,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); r = qemuMonitorSetMemoryStatsPeriod(priv->mon, def->memballoon, period); qemuDomainObjExitMonitor(vm); if (r < 0) { @@ -2401,7 +2394,6 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) { - virQEMUDriver *driver = domain->conn->privateData; virDomainObj *vm = NULL; int ret = -1; qemuDomainObjPrivate *priv; @@ -2416,13 +2408,13 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorInjectNMI(priv->mon); qemuDomainObjExitMonitor(vm); @@ -2441,7 +2433,6 @@ static int qemuDomainSendKey(virDomainPtr domain, int nkeycodes, unsigned int flags) { - virQEMUDriver *driver = domain->conn->privateData; virDomainObj *vm = NULL; int ret = -1; qemuDomainObjPrivate *priv; @@ -2475,13 +2466,13 @@ static int qemuDomainSendKey(virDomainPtr domain, if (virDomainSendKeyEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes); qemuDomainObjExitMonitor(vm); @@ -2651,7 +2642,7 @@ qemuDomainSaveInternal(virQEMUDriver *driver, virQEMUSaveData *data = NULL; g_autoptr(qemuDomainSaveCookie) cookie = NULL; - if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_SAVE, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_SAVE, VIR_DOMAIN_JOB_OPERATION_SAVE, flags) < 0) goto cleanup; @@ -3083,7 +3074,7 @@ qemuDumpToFd(virQEMUDriver *driver, g_clear_pointer(&priv->job.current, virDomainJobDataFree); } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (dumpformat) { @@ -3230,7 +3221,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, if (virDomainCoreDumpWithFormatEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAsyncJob(driver, vm, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) @@ -3278,7 +3269,7 @@ 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); qemuDomainObjExitMonitor(vm); } @@ -3345,7 +3336,7 @@ qemuDomainScreenshot(virDomainPtr dom, if (virDomainScreenshotEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -3392,7 +3383,7 @@ qemuDomainScreenshot(virDomainPtr dom, qemuSecurityDomainSetPathLabel(driver, vm, tmp, false); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp) < 0) { qemuDomainObjExitMonitor(vm); goto endjob; @@ -3469,7 +3460,7 @@ processWatchdogEvent(virQEMUDriver *driver, switch (action) { case VIR_DOMAIN_WATCHDOG_ACTION_DUMP: - if (qemuDomainObjBeginAsyncJob(driver, vm, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) { @@ -3546,7 +3537,7 @@ processGuestPanicEvent(virQEMUDriver *driver, bool removeInactive = false; unsigned long flags = VIR_DUMP_MEMORY_ONLY; - if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_DUMP, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_DUMP, VIR_DOMAIN_JOB_OPERATION_DUMP, flags) < 0) return; @@ -3626,7 +3617,7 @@ processDeviceDeletedEvent(virQEMUDriver *driver, VIR_DEBUG("Removing device %s from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -3635,7 +3626,7 @@ processDeviceDeletedEvent(virQEMUDriver *driver, } if (STRPREFIX(devAlias, "vcpu")) { - qemuDomainRemoveVcpuAlias(driver, vm, devAlias); + qemuDomainRemoveVcpuAlias(vm, devAlias); } else { if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) goto endjob; @@ -3848,8 +3839,7 @@ syncNicRxFilterMulticast(char *ifname, } static void -processNicRxFilterChangedEvent(virQEMUDriver *driver, - virDomainObj *vm, +processNicRxFilterChangedEvent(virDomainObj *vm, const char *devAlias) { qemuDomainObjPrivate *priv = vm->privateData; @@ -3863,7 +3853,7 @@ processNicRxFilterChangedEvent(virQEMUDriver *driver, "from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -3900,7 +3890,7 @@ processNicRxFilterChangedEvent(virQEMUDriver *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); qemuDomainObjExitMonitor(vm); if (ret < 0) @@ -3989,7 +3979,7 @@ processSerialChangedEvent(virQEMUDriver *driver, memset(&dev, 0, sizeof(dev)); } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY_MIGRATION_SAFE) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY_MIGRATION_SAFE) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4032,8 +4022,7 @@ processSerialChangedEvent(virQEMUDriver *driver, static void -processBlockJobEvent(virQEMUDriver *driver, - virDomainObj *vm, +processBlockJobEvent(virDomainObj *vm, const char *diskAlias, int type, int status) @@ -4041,7 +4030,7 @@ processBlockJobEvent(virQEMUDriver *driver, virDomainDiskDef *disk; g_autoptr(qemuBlockJobData) job = NULL; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4071,11 +4060,10 @@ processBlockJobEvent(virQEMUDriver *driver, static void -processJobStatusChangeEvent(virQEMUDriver *driver, - virDomainObj *vm, +processJobStatusChangeEvent(virDomainObj *vm, qemuBlockJobData *job) { - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4101,7 +4089,7 @@ processMonitorEOFEvent(virQEMUDriver *driver, unsigned int stopFlags = 0; virObjectEvent *event = NULL; - if (qemuProcessBeginStopJob(driver, vm, VIR_JOB_DESTROY, true) < 0) + if (qemuProcessBeginStopJob(vm, VIR_JOB_DESTROY, true) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4217,7 +4205,7 @@ processMemoryDeviceSizeChange(virQEMUDriver *driver, virObjectEvent *event = NULL; unsigned long long balloon; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4273,20 +4261,20 @@ 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, + 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); @@ -4438,10 +4426,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, if (useAgent) { - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; } else { - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; } @@ -4578,7 +4566,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, if (virDomainPinVcpuFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -4704,7 +4692,7 @@ qemuDomainPinEmulator(virDomainPtr dom, if (virDomainPinEmulatorEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -4856,7 +4844,6 @@ qemuDomainGetVcpus(virDomainPtr dom, static int qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; virDomainDef *def; int ret = -1; @@ -4880,7 +4867,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) goto cleanup; if (flags & VIR_DOMAIN_VCPU_GUEST) { - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -4937,15 +4924,14 @@ qemuDomainGetMaxVcpus(virDomainPtr dom) static int -qemuDomainGetIOThreadsMon(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetIOThreadsMon(virDomainObj *vm, qemuMonitorIOThreadInfo ***iothreads, int *niothreads) { qemuDomainObjPrivate *priv = vm->privateData; int ret = -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetIOThreads(priv->mon, iothreads, niothreads); qemuDomainObjExitMonitor(vm); @@ -4954,8 +4940,7 @@ qemuDomainGetIOThreadsMon(virQEMUDriver *driver, static int -qemuDomainGetIOThreadsLive(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetIOThreadsLive(virDomainObj *vm, virDomainIOThreadInfoPtr **info) { qemuDomainObjPrivate *priv; @@ -4965,7 +4950,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriver *driver, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -4981,7 +4966,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriver *driver, goto endjob; } - if ((ret = qemuDomainGetIOThreadsMon(driver, vm, &iothreads, &niothreads)) < 0) + if ((ret = qemuDomainGetIOThreadsMon(vm, &iothreads, &niothreads)) < 0) goto endjob; /* Nothing to do */ @@ -5032,7 +5017,6 @@ qemuDomainGetIOThreadInfo(virDomainPtr dom, virDomainIOThreadInfoPtr **info, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; virDomainDef *targetDef = NULL; int ret = -1; @@ -5050,7 +5034,7 @@ qemuDomainGetIOThreadInfo(virDomainPtr dom, goto cleanup; if (!targetDef) - ret = qemuDomainGetIOThreadsLive(driver, vm, info); + ret = qemuDomainGetIOThreadsLive(vm, info); else ret = virDomainDriverGetIOThreadsConfig(targetDef, info, 0); @@ -5094,7 +5078,7 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virDomainPinIOThreadEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5183,8 +5167,7 @@ qemuDomainPinIOThread(virDomainPtr dom, } static int -qemuDomainHotplugAddIOThread(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainHotplugAddIOThread(virDomainObj *vm, unsigned int iothread_id) { qemuDomainObjPrivate *priv = vm->privateData; @@ -5205,7 +5188,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriver *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; @@ -5264,7 +5247,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriver *driver, virDomainIOThreadIDDel(vm->def, iothread_id); if (objectAdded) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorDelObject(priv->mon, alias, true) < 0) VIR_WARN("deletion of iothread object %d of domain %s failed when cleanup", iothread_id, vm->def->name); @@ -5288,8 +5271,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriver *driver, static int -qemuDomainHotplugModIOThread(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainHotplugModIOThread(virDomainObj *vm, qemuMonitorIOThreadInfo iothread) { qemuDomainObjPrivate *priv = vm->privateData; @@ -5301,7 +5283,7 @@ qemuDomainHotplugModIOThread(virQEMUDriver *driver, return -1; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetIOThread(priv->mon, &iothread); @@ -5335,8 +5317,7 @@ qemuDomainHotplugModIOThreadIDDef(virDomainIOThreadIDDef *def, static int -qemuDomainHotplugDelIOThread(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainHotplugDelIOThread(virDomainObj *vm, unsigned int iothread_id) { qemuDomainObjPrivate *priv = vm->privateData; @@ -5351,7 +5332,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriver *driver, alias = g_strdup_printf("iothread%u", iothread_id); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelObject(priv->mon, alias, true); exp_niothreads--; @@ -5605,7 +5586,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, priv = vm->privateData; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5672,7 +5653,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, if (virDomainDriverAddIOThreadCheck(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; @@ -5681,7 +5662,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, if (virDomainDriverDelIOThreadCheck(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; @@ -5699,7 +5680,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0) goto endjob; - if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) + if (qemuDomainHotplugModIOThread(vm, iothread) < 0) goto endjob; qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread); @@ -6059,7 +6040,7 @@ qemuDomainRestoreInternal(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; @@ -6669,7 +6650,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; @@ -6817,7 +6798,7 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (virDomainUndefineFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!vm->persistent) { @@ -6952,7 +6933,7 @@ qemuDomainAttachDeviceLive(virDomainObj *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; @@ -7020,7 +7001,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, break; case VIR_DOMAIN_DEVICE_SHMEM: - ret = qemuDomainAttachShmemDevice(driver, vm, + ret = qemuDomainAttachShmemDevice(vm, dev->data.shmem); if (!ret) { alias = dev->data.shmem->info.alias; @@ -7029,7 +7010,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, break; case VIR_DOMAIN_DEVICE_WATCHDOG: - ret = qemuDomainAttachWatchdog(driver, vm, + ret = qemuDomainAttachWatchdog(vm, dev->data.watchdog); if (!ret) { alias = dev->data.watchdog->info.alias; @@ -7038,7 +7019,7 @@ qemuDomainAttachDeviceLive(virDomainObj *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; @@ -7046,7 +7027,7 @@ qemuDomainAttachDeviceLive(virDomainObj *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; @@ -7090,7 +7071,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, } if (ret == 0) - ret = qemuDomainUpdateDeviceList(driver, vm, VIR_ASYNC_JOB_NONE); + ret = qemuDomainUpdateDeviceList(vm, VIR_ASYNC_JOB_NONE); return ret; } @@ -7312,7 +7293,7 @@ qemuDomainChangeMemoryLive(virQEMUDriver *driver G_GNUC_UNUSED, if (!qemuDomainChangeMemoryLiveValidateChange(oldDef, newDef)) return -1; - if (qemuDomainChangeMemoryRequestedSize(driver, vm, + if (qemuDomainChangeMemoryRequestedSize(vm, newDef->info.alias, newDef->requestedsize) < 0) return -1; @@ -8077,7 +8058,7 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, if (virDomainAttachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8132,7 +8113,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, if (virDomainUpdateDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8260,7 +8241,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriver *driver, if ((rc = qemuDomainDetachDeviceLive(vm, dev, driver, false)) < 0) goto cleanup; - if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (rc == 0 && qemuDomainUpdateDeviceList(vm, VIR_ASYNC_JOB_NONE) < 0) goto cleanup; qemuDomainSaveStatus(vm); @@ -8333,7 +8314,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriver *driver, if ((rc = qemuDomainDetachDeviceLive(vm, &dev, driver, true)) < 0) return -1; - if (rc == 0 && qemuDomainUpdateDeviceList(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (rc == 0 && qemuDomainUpdateDeviceList(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; } @@ -8362,7 +8343,7 @@ qemuDomainDetachDeviceFlags(virDomainPtr dom, if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8397,7 +8378,7 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, if (virDomainDetachDeviceAliasEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8470,7 +8451,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, autostart = (autostart != 0); if (vm->autostart != autostart) { - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!(configFile = virDomainConfigFile(cfg->configDir, vm->def->name))) @@ -8616,7 +8597,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -8790,7 +8771,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; /* QEMU and LXC implementation are identical */ @@ -9033,7 +9014,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, } } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9250,7 +9231,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, if (virDomainSetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9304,7 +9285,6 @@ qemuDomainGetPerfEvents(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuDomainObjPrivate *priv; virDomainDef *def; @@ -9325,7 +9305,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, if (virDomainGetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!(def = virDomainObjGetOneDefState(vm, flags, &live))) @@ -9502,7 +9482,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9976,7 +9956,6 @@ qemuDomainBlockResize(virDomainPtr dom, unsigned long long size, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuDomainObjPrivate *priv; int ret = -1; @@ -10005,7 +9984,7 @@ qemuDomainBlockResize(virDomainPtr dom, if (virDomainBlockResizeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10045,7 +10024,7 @@ qemuDomainBlockResize(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorBlockResize(priv->mon, device, nodename, size) < 0) { qemuDomainObjExitMonitor(vm); goto endjob; @@ -10091,8 +10070,7 @@ qemuDomainBlockStatsGatherTotals(qemuBlockStats *data, * Returns -1 on error; number of filled block statistics on success. */ static int -qemuDomainBlocksStatsGather(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainBlocksStatsGather(virDomainObj *vm, const char *path, bool capacity, qemuBlockStats **retstats) @@ -10132,7 +10110,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, } } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats); if (capacity && nstats >= 0) { @@ -10205,7 +10183,6 @@ qemuDomainBlockStats(virDomainPtr dom, const char *path, virDomainBlockStatsPtr stats) { - virQEMUDriver *driver = dom->conn->privateData; qemuBlockStats *blockstats = NULL; int ret = -1; virDomainObj *vm; @@ -10216,13 +10193,13 @@ qemuDomainBlockStats(virDomainPtr dom, if (virDomainBlockStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_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) || @@ -10255,7 +10232,6 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuBlockStats *blockstats = NULL; int nstats; @@ -10274,13 +10250,13 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, if (virDomainBlockStatsFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_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; @@ -10436,7 +10412,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, if (virDomainSetInterfaceParametersEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -10747,8 +10723,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom, /* This functions assumes that job VIR_JOB_QUERY is started by a caller */ static int -qemuDomainMemoryStatsInternal(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainMemoryStatsInternal(virDomainObj *vm, virDomainMemoryStatPtr stats, unsigned int nr_stats) @@ -10760,7 +10735,7 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver, return -1; if (virDomainDefHasMemballoon(vm->def)) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm), vm->def->memballoon, stats, nr_stats); qemuDomainObjExitMonitor(vm); @@ -10789,7 +10764,6 @@ qemuDomainMemoryStats(virDomainPtr dom, unsigned int nr_stats, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; @@ -10801,10 +10775,10 @@ qemuDomainMemoryStats(virDomainPtr dom, if (virDomainMemoryStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; - ret = qemuDomainMemoryStatsInternal(driver, vm, stats, nr_stats); + ret = qemuDomainMemoryStatsInternal(vm, stats, nr_stats); qemuDomainObjEndJob(vm); @@ -10911,7 +10885,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10928,7 +10902,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, qemuSecurityDomainSetPathLabel(driver, vm, tmp, false); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (flags == VIR_MEMORY_VIRTUAL) { if (qemuMonitorSaveVirtualMemory(priv->mon, offset, size, tmp) < 0) { qemuDomainObjExitMonitor(vm); @@ -11188,7 +11162,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, if (virDomainGetBlockInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!(disk = virDomainDiskByName(vm->def, path, false))) { @@ -11223,7 +11197,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) { @@ -12667,8 +12641,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, static int -qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetJobInfoMigrationStats(virDomainObj *vm, virDomainJobData *jobData) { qemuDomainJobDataPrivate *privStats = jobData->privateData; @@ -12676,7 +12649,7 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, switch (jobData->status) { case VIR_DOMAIN_JOB_STATUS_ACTIVE: if (privStats->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION && - qemuMigrationSrcFetchMirrorStats(driver, vm, VIR_ASYNC_JOB_NONE, + qemuMigrationSrcFetchMirrorStats(vm, VIR_ASYNC_JOB_NONE, jobData) < 0) return -1; break; @@ -12686,7 +12659,7 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, case VIR_DOMAIN_JOB_STATUS_POSTCOPY: case VIR_DOMAIN_JOB_STATUS_PAUSED: case VIR_DOMAIN_JOB_STATUS_POSTCOPY_PAUSED: - if (qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationAnyFetchStats(vm, VIR_ASYNC_JOB_NONE, jobData, NULL) < 0) return -1; break; @@ -12704,8 +12677,7 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, static int -qemuDomainGetJobInfoDumpStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetJobInfoDumpStats(virDomainObj *vm, virDomainJobData *jobData) { qemuDomainObjPrivate *priv = vm->privateData; @@ -12713,7 +12685,7 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriver *driver, qemuMonitorDumpStats stats = { 0 }; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; rc = qemuMonitorQueryDump(priv->mon, &stats); @@ -12757,8 +12729,7 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriver *driver, static int -qemuDomainGetJobStatsInternal(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetJobStatsInternal(virDomainObj *vm, bool completed, virDomainJobData **jobData) { @@ -12782,7 +12753,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriver *driver, return -1; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -12799,17 +12770,17 @@ qemuDomainGetJobStatsInternal(virQEMUDriver *driver, switch (privStats->statsType) { case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION: case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP: - if (qemuDomainGetJobInfoMigrationStats(driver, vm, *jobData) < 0) + if (qemuDomainGetJobInfoMigrationStats(vm, *jobData) < 0) goto cleanup; break; case QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP: - if (qemuDomainGetJobInfoDumpStats(driver, vm, *jobData) < 0) + if (qemuDomainGetJobInfoDumpStats(vm, *jobData) < 0) goto cleanup; break; case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP: - if (qemuBackupGetJobInfoStats(driver, vm, *jobData) < 0) + if (qemuBackupGetJobInfoStats(vm, *jobData) < 0) goto cleanup; break; @@ -12829,7 +12800,6 @@ static int qemuDomainGetJobInfo(virDomainPtr dom, virDomainJobInfoPtr info) { - virQEMUDriver *driver = dom->conn->privateData; g_autoptr(virDomainJobData) jobData = NULL; virDomainObj *vm; int ret = -1; @@ -12842,7 +12812,7 @@ qemuDomainGetJobInfo(virDomainPtr dom, if (virDomainGetJobInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainGetJobStatsInternal(driver, vm, false, &jobData) < 0) + if (qemuDomainGetJobStatsInternal(vm, false, &jobData) < 0) goto cleanup; if (!jobData || @@ -12866,7 +12836,6 @@ qemuDomainGetJobStats(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuDomainObjPrivate *priv; g_autoptr(virDomainJobData) jobData = NULL; @@ -12883,7 +12852,7 @@ qemuDomainGetJobStats(virDomainPtr dom, goto cleanup; priv = vm->privateData; - if (qemuDomainGetJobStatsInternal(driver, vm, completed, &jobData) < 0) + if (qemuDomainGetJobStatsInternal(vm, completed, &jobData) < 0) goto cleanup; if (!jobData || @@ -12915,7 +12884,7 @@ qemuDomainAbortJobMigration(virDomainObj *vm) VIR_DEBUG("Cancelling migration job at client request"); qemuDomainObjAbortAsyncJob(vm); - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorMigrateCancel(priv->mon); qemuDomainObjExitMonitor(vm); @@ -12939,7 +12908,7 @@ qemuDomainAbortJobPostcopy(virDomainObj *vm, VIR_DEBUG("Suspending post-copy migration at client request"); qemuDomainObjAbortAsyncJob(vm); - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorMigratePause(priv->mon); qemuDomainObjExitMonitor(vm); @@ -12951,7 +12920,6 @@ static int qemuDomainAbortJobFlags(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; qemuDomainObjPrivate *priv; @@ -12966,7 +12934,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom, if (virDomainAbortJobFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_ABORT) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_ABORT) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13057,7 +13025,6 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, unsigned long long downtime, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; @@ -13070,7 +13037,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, if (virDomainMigrateSetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13086,7 +13053,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, downtime) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_NONE, migParams, 0) < 0) goto endjob; @@ -13106,7 +13073,6 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, unsigned long long *downtime, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; @@ -13120,13 +13086,13 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, if (virDomainMigrateGetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) goto endjob; - if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, VIR_ASYNC_JOB_NONE, &migParams) < 0) goto endjob; @@ -13159,7 +13125,6 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, unsigned long long *cacheSize, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; @@ -13172,7 +13137,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, if (virDomainMigrateGetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13185,7 +13150,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, goto endjob; } - if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, VIR_ASYNC_JOB_NONE, &migParams) < 0) goto endjob; @@ -13209,7 +13174,6 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, unsigned long long cacheSize, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; g_autoptr(qemuMigrationParams) migParams = NULL; int ret = -1; @@ -13222,7 +13186,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, if (virDomainMigrateSetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13244,7 +13208,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, cacheSize) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_NONE, migParams, 0) < 0) goto endjob; @@ -13263,7 +13227,6 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, unsigned long bandwidth, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuDomainObjPrivate *priv; bool postcopy = !!(flags & VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY); @@ -13299,7 +13262,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13320,7 +13283,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, bandwidth * 1024 * 1024) < 0) goto endjob; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_NONE, migParams, 0) < 0) goto endjob; @@ -13339,8 +13302,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, static int -qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainMigrationGetPostcopyBandwidth(virDomainObj *vm, unsigned long *bandwidth) { g_autoptr(qemuMigrationParams) migParams = NULL; @@ -13348,13 +13310,13 @@ qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriver *driver, int rc; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) goto cleanup; - if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuMigrationParamsFetch(vm, VIR_ASYNC_JOB_NONE, &migParams) < 0) goto cleanup; @@ -13395,7 +13357,6 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom, unsigned long *bandwidth, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuDomainObjPrivate *priv; bool postcopy = !!(flags & VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY); @@ -13412,7 +13373,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; @@ -13430,7 +13391,6 @@ static int qemuDomainMigrateStartPostCopy(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuDomainObjPrivate *priv; int ret = -1; @@ -13443,7 +13403,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MIGRATION_OP) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13466,7 +13426,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, } VIR_DEBUG("Starting post-copy"); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorMigrateStartPostCopy(priv->mon); qemuDomainObjExitMonitor(vm); @@ -14188,7 +14148,7 @@ qemuDomainQemuMonitorCommandWithFiles(virDomainPtr domain, if (virDomainQemuMonitorCommandWithFilesEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14200,7 +14160,7 @@ qemuDomainQemuMonitorCommandWithFiles(virDomainPtr domain, hmp = !!(flags & VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorArbitraryCommand(priv->mon, cmd, fd, result, hmp); qemuDomainObjExitMonitor(vm); @@ -14377,8 +14337,7 @@ qemuDomainOpenChannel(virDomainPtr dom, * abort with pivot; this updates the VM definition as appropriate, on * either success or failure. */ static int -qemuDomainBlockPivot(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainBlockPivot(virDomainObj *vm, qemuBlockJobData *job, virDomainDiskDef *disk) { @@ -14467,7 +14426,7 @@ qemuDomainBlockPivot(virQEMUDriver *driver, break; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (blockdev) { int rc = 0; @@ -14511,7 +14470,6 @@ qemuDomainBlockPullCommon(virDomainObj *vm, unsigned int flags) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; const char *device = NULL; const char *jobname = NULL; virDomainDiskDef *disk; @@ -14532,7 +14490,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14609,7 +14567,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, device = job->name; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (!blockdev && baseSource) basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, baseSource); @@ -14640,7 +14598,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom, const char *path, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainDiskDef *disk = NULL; bool pivot = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT); bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC); @@ -14658,7 +14615,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14687,10 +14644,10 @@ 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); ret = qemuMonitorBlockJobCancel(priv->mon, job->name, false); qemuDomainObjExitMonitor(vm); @@ -14803,7 +14760,6 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, virDomainBlockJobInfoPtr info, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; virDomainDiskDef *disk; int ret = -1; @@ -14820,7 +14776,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14834,7 +14790,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); blockjobstats = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true); qemuDomainObjExitMonitor(vm); @@ -14864,7 +14820,6 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, unsigned long bandwidth, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainDiskDef *disk; int ret = -1; virDomainObj *vm; @@ -14890,7 +14845,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, if (virDomainBlockJobSetSpeedEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14905,7 +14860,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorBlockJobSetSpeed(qemuDomainGetMonitor(vm), job->name, speed); @@ -15091,7 +15046,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, return -1; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -15306,7 +15261,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, } if (data) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuBlockStorageSourceChainAttach(priv->mon, data); qemuDomainObjExitMonitor(vm); @@ -15326,7 +15281,7 @@ qemuDomainBlockCopyCommon(virDomainObj *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, @@ -15360,7 +15315,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (ret < 0 && virDomainObjIsActive(vm)) { if (data || crdata) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (data) qemuBlockStorageSourceChainDetach(priv->mon, data); if (crdata) @@ -15593,7 +15548,7 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -15767,7 +15722,7 @@ qemuDomainBlockCommit(virDomainPtr dom, device = job->name; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (!blockdev) { basePath = qemuMonitorDiskNameLookup(priv->mon, device, disk->src, @@ -15833,7 +15788,7 @@ qemuDomainOpenGraphics(virDomainPtr dom, if (virDomainOpenGraphicsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -15874,7 +15829,7 @@ 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); qemuDomainObjExitMonitor(vm); @@ -15951,9 +15906,9 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom, if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, pair[1], "graphicsfd", (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)); qemuDomainObjExitMonitor(vm); @@ -16206,7 +16161,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, cfg = virQEMUDriverGetConfig(driver); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; priv = vm->privateData; @@ -16390,7 +16345,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, !virStorageSourceIsEmpty(disk->src)) { int rc = 0; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info); qemuDomainObjExitMonitor(vm); @@ -16461,7 +16416,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, unsigned int flags) { virDomainDiskDef *disk; - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuDomainObjPrivate *priv = NULL; virDomainDef *def = NULL; @@ -16487,7 +16441,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (virDomainGetBlockIoTuneEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; /* the API check guarantees that only one of the definitions will be set */ @@ -16522,7 +16476,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid, &reply); qemuDomainObjExitMonitor(vm); @@ -16611,7 +16565,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom, unsigned int nerrors, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuDomainObjPrivate *priv; g_autoptr(GHashTable) table = NULL; @@ -16631,7 +16584,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -16642,7 +16595,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); table = qemuMonitorGetBlockInfo(priv->mon); qemuDomainObjExitMonitor(vm); if (!table) @@ -16706,7 +16659,7 @@ qemuDomainSetMetadata(virDomainPtr dom, if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, @@ -16798,15 +16751,14 @@ qemuDomainGetCPUStats(virDomainPtr domain, static int -qemuDomainProbeQMPCurrentMachine(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainProbeQMPCurrentMachine(virDomainObj *vm, bool *wakeupSupported) { qemuDomainObjPrivate *priv = vm->privateData; qemuMonitorCurrentMachineInfo info = { 0 }; int rv; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorGetCurrentMachineInfo(priv->mon, &info); qemuDomainObjExitMonitor(vm); if (rv < 0) @@ -16819,8 +16771,7 @@ qemuDomainProbeQMPCurrentMachine(virQEMUDriver *driver, /* returns -1 on error, or if query is not supported, 0 if query was successful */ static int -qemuDomainQueryWakeupSuspendSupport(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainQueryWakeupSuspendSupport(virDomainObj *vm, bool *wakeupSupported) { qemuDomainObjPrivate *priv = vm->privateData; @@ -16829,13 +16780,13 @@ qemuDomainQueryWakeupSuspendSupport(virQEMUDriver *driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) return -1; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if ((ret = virDomainObjCheckActive(vm)) < 0) goto endjob; - ret = qemuDomainProbeQMPCurrentMachine(driver, vm, wakeupSupported); + ret = qemuDomainProbeQMPCurrentMachine(vm, wakeupSupported); endjob: qemuDomainObjEndJob(vm); @@ -16844,14 +16795,13 @@ qemuDomainQueryWakeupSuspendSupport(virQEMUDriver *driver, static int -qemuDomainPMSuspendAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainPMSuspendAgent(virDomainObj *vm, unsigned int target) { qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -16876,7 +16826,6 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, unsigned long long duration, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; bool wakeupSupported; @@ -16914,7 +16863,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")); @@ -16939,7 +16888,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, } } - ret = qemuDomainPMSuspendAgent(driver, vm, target); + ret = qemuDomainPMSuspendAgent(vm, target); cleanup: virDomainObjEndAPI(&vm); @@ -16950,7 +16899,6 @@ static int qemuDomainPMWakeup(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; qemuDomainObjPrivate *priv; @@ -16963,7 +16911,7 @@ qemuDomainPMWakeup(virDomainPtr dom, if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -16971,7 +16919,7 @@ qemuDomainPMWakeup(virDomainPtr dom, priv = vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSystemWakeup(priv->mon); qemuDomainObjExitMonitor(vm); @@ -17019,7 +16967,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, if (virDomainQemuAgentCommandEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17094,7 +17042,6 @@ qemuDomainFSTrim(virDomainPtr dom, unsigned long long minimum, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuAgent *agent; int ret = -1; @@ -17114,7 +17061,7 @@ qemuDomainFSTrim(virDomainPtr dom, if (virDomainFSTrimEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -17278,14 +17225,13 @@ qemuConnectGetCPUModelNames(virConnectPtr conn, static int -qemuDomainGetHostnameAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetHostnameAgent(virDomainObj *vm, char **hostname) { qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17306,8 +17252,7 @@ qemuDomainGetHostnameAgent(virQEMUDriver *driver, static int -qemuDomainGetHostnameLease(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetHostnameLease(virDomainObj *vm, char **hostname) { char macaddr[VIR_MAC_STRING_BUFLEN]; @@ -17317,7 +17262,7 @@ qemuDomainGetHostnameLease(virQEMUDriver *driver, size_t i, j; int ret = -1; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17368,7 +17313,6 @@ static char * qemuDomainGetHostname(virDomainPtr dom, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; char *hostname = NULL; @@ -17389,10 +17333,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; } @@ -17415,7 +17359,6 @@ qemuDomainGetTime(virDomainPtr dom, unsigned int *nseconds, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; int ret = -1; @@ -17429,7 +17372,7 @@ qemuDomainGetTime(virDomainPtr dom, if (virDomainGetTimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17457,8 +17400,7 @@ qemuDomainGetTime(virDomainPtr dom, static int -qemuDomainSetTimeAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainSetTimeAgent(virDomainObj *vm, long long seconds, unsigned int nseconds, bool rtcSync) @@ -17466,7 +17408,7 @@ qemuDomainSetTimeAgent(virQEMUDriver *driver, qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17491,7 +17433,6 @@ qemuDomainSetTime(virDomainPtr dom, unsigned int nseconds, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; qemuDomainObjPrivate *priv; virDomainObj *vm; bool rtcSync = flags & VIR_DOMAIN_TIME_SYNC; @@ -17520,10 +17461,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, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17531,7 +17472,7 @@ 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); qemuDomainObjExitMonitor(vm); @@ -17556,7 +17497,6 @@ qemuDomainFSFreeze(virDomainPtr dom, unsigned int nmountpoints, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; @@ -17568,7 +17508,7 @@ qemuDomainFSFreeze(virDomainPtr dom, if (virDomainFSFreezeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17591,7 +17531,6 @@ qemuDomainFSThaw(virDomainPtr dom, unsigned int nmountpoints, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; int ret = -1; @@ -17609,7 +17548,7 @@ qemuDomainFSThaw(virDomainPtr dom, if (virDomainFSThawEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -18065,7 +18004,7 @@ qemuDomainGetStatsMemory(virQEMUDriver *driver, static int -qemuDomainGetStatsBalloon(virQEMUDriver *driver, +qemuDomainGetStatsBalloon(virQEMUDriver *driver G_GNUC_UNUSED, virDomainObj *dom, virTypedParamList *params, unsigned int privflags) @@ -18091,7 +18030,7 @@ qemuDomainGetStatsBalloon(virQEMUDriver *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; @@ -18123,7 +18062,7 @@ qemuDomainGetStatsBalloon(virQEMUDriver *driver, static int -qemuDomainGetStatsVcpu(virQEMUDriver *driver, +qemuDomainGetStatsVcpu(virQEMUDriver *driver G_GNUC_UNUSED, virDomainObj *dom, virTypedParamList *params, unsigned int privflags) @@ -18149,7 +18088,7 @@ qemuDomainGetStatsVcpu(virQEMUDriver *driver, cpudelay = g_new0(unsigned long long, virDomainDefGetVcpus(dom->def)); if (HAVE_JOB(privflags) && virDomainObjIsActive(dom) && - qemuDomainRefreshVcpuHalted(driver, dom, VIR_ASYNC_JOB_NONE) < 0) { + qemuDomainRefreshVcpuHalted(dom, VIR_ASYNC_JOB_NONE) < 0) { /* it's ok to be silent and go ahead, because halted vcpu info * wasn't here from the beginning */ virResetLastError(); @@ -18651,7 +18590,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, bool visitBacking = !!(privflags & QEMU_DOMAIN_STATS_BACKING); if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { - qemuDomainObjEnterMonitor(driver, dom); + qemuDomainObjEnterMonitor(dom); rc = qemuMonitorGetAllBlockStatsInfo(priv->mon, &stats); @@ -18698,7 +18637,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, static int -qemuDomainGetStatsIOThread(virQEMUDriver *driver, +qemuDomainGetStatsIOThread(virQEMUDriver *driver G_GNUC_UNUSED, virDomainObj *dom, virTypedParamList *params, unsigned int privflags) @@ -18711,7 +18650,7 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver, if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) return 0; - if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < 0) + if (qemuDomainGetIOThreadsMon(dom, &iothreads, &niothreads) < 0) return -1; /* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we must free @@ -18790,14 +18729,13 @@ qemuDomainGetStatsPerf(virQEMUDriver *driver G_GNUC_UNUSED, } static int -qemuDomainGetStatsDirtyRateMon(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetStatsDirtyRateMon(virDomainObj *vm, qemuMonitorDirtyRateInfo *info) { qemuDomainObjPrivate *priv = vm->privateData; int ret; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorQueryDirtyRate(priv->mon, info); qemuDomainObjExitMonitor(vm); @@ -18805,7 +18743,7 @@ qemuDomainGetStatsDirtyRateMon(virQEMUDriver *driver, } static int -qemuDomainGetStatsDirtyRate(virQEMUDriver *driver, +qemuDomainGetStatsDirtyRate(virQEMUDriver *driver G_GNUC_UNUSED, virDomainObj *dom, virTypedParamList *params, unsigned int privflags) @@ -18815,7 +18753,7 @@ qemuDomainGetStatsDirtyRate(virQEMUDriver *driver, if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom)) return 0; - if (qemuDomainGetStatsDirtyRateMon(driver, dom, &info) < 0) + if (qemuDomainGetStatsDirtyRateMon(dom, &info) < 0) return -1; if (virTypedParamListAddInt(params, info.status, @@ -19055,9 +18993,9 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, int rv; if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT) - rv = qemuDomainObjBeginJobNowait(driver, vm, VIR_JOB_QUERY); + rv = qemuDomainObjBeginJobNowait(vm, VIR_JOB_QUERY); else - rv = qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY); + rv = qemuDomainObjBeginJob(vm, VIR_JOB_QUERY); if (rv == 0) domflags |= QEMU_DOMAIN_STATS_HAVE_JOB; @@ -19121,14 +19059,13 @@ qemuNodeAllocPages(virConnectPtr conn, } static int -qemuDomainGetFSInfoAgent(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetFSInfoAgent(virDomainObj *vm, qemuAgentFSInfo ***info) { int ret = -1; qemuAgent *agent; - if (qemuDomainObjBeginAgentJob(driver, vm, + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) return ret; @@ -19222,7 +19159,6 @@ qemuDomainGetFSInfo(virDomainPtr dom, virDomainFSInfoPtr **info, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuAgentFSInfo **agentinfo = NULL; int ret = -1; @@ -19236,10 +19172,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, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19268,7 +19204,6 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, unsigned int source, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; int ret = -1; @@ -19290,7 +19225,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, break; case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT: - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19328,7 +19263,6 @@ qemuDomainSetUserPassword(virDomainPtr dom, const char *password, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm; qemuAgent *agent; int ret = -1; @@ -19342,7 +19276,7 @@ qemuDomainSetUserPassword(virDomainPtr dom, if (virDomainSetUserPasswordEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19529,7 +19463,7 @@ static int qemuDomainRename(virDomainPtr dom, if (virDomainRenameEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjIsActive(vm)) { @@ -19631,7 +19565,6 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, unsigned int *nparams, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; qemuAgentCPUInfo *info = NULL; @@ -19646,7 +19579,7 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, if (virDomainGetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19680,7 +19613,6 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, int state, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; g_autoptr(virBitmap) map = NULL; qemuAgentCPUInfo *info = NULL; @@ -19705,7 +19637,7 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, if (virDomainSetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19797,7 +19729,7 @@ qemuDomainSetVcpu(virDomainPtr dom, if (virDomainSetVcpuEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -19838,7 +19770,6 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, unsigned long long threshold, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; qemuDomainObjPrivate *priv; virDomainObj *vm = NULL; virStorageSource *src; @@ -19856,7 +19787,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (virDomainSetBlockThresholdEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19879,7 +19810,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && !src->nodestorage && - qemuBlockNodeNamesDetect(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + qemuBlockNodeNamesDetect(vm, VIR_ASYNC_JOB_NONE) < 0) goto endjob; if (!src->nodestorage) { @@ -19891,7 +19822,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, nodename = g_strdup(src->nodestorage); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetBlockThreshold(priv->mon, nodename, threshold); qemuDomainObjExitMonitor(vm); if (rc < 0) @@ -19970,7 +19901,6 @@ qemuDomainModifyLifecycleActionLive(virDomainObj *vm, { qemuMonitorActionReboot monReboot = QEMU_MONITOR_ACTION_REBOOT_KEEP; qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; int rc; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) @@ -20001,7 +19931,7 @@ qemuDomainModifyLifecycleActionLive(virDomainObj *vm, } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetAction(priv->mon, QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, @@ -20047,7 +19977,7 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, if (virDomainSetLifecycleActionEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -20183,8 +20113,7 @@ qemuNodeGetSEVInfo(virConnectPtr conn, static int -qemuDomainGetSEVInfo(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetSEVInfo(virDomainObj *vm, virTypedParameterPtr *params, int *nparams, unsigned int flags) @@ -20200,14 +20129,14 @@ qemuDomainGetSEVInfo(virQEMUDriver *driver, virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) { goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); tmp = qemuMonitorGetSEVMeasurement(QEMU_DOMAIN_PRIVATE(vm)->mon); @@ -20258,7 +20187,6 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, int *nparams, unsigned int flags) { - virQEMUDriver *driver = domain->conn->privateData; virDomainObj *vm; int ret = -1; @@ -20270,7 +20198,7 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, if (vm->def->sec && vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_SEV) { - if (qemuDomainGetSEVInfo(driver, vm, params, nparams, flags) < 0) + if (qemuDomainGetSEVInfo(vm, params, nparams, flags) < 0) goto cleanup; } @@ -20288,7 +20216,6 @@ qemuDomainSetLaunchSecurityState(virDomainPtr domain, int nparams, unsigned int flags) { - virQEMUDriver *driver = domain->conn->privateData; virDomainObj *vm; int ret = -1; int rc; @@ -20345,7 +20272,7 @@ qemuDomainSetLaunchSecurityState(virDomainPtr domain, else if (rc == 1) hasSetaddr = true; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20364,7 +20291,7 @@ qemuDomainSetLaunchSecurityState(virDomainPtr domain, goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSetLaunchSecurityState(QEMU_DOMAIN_PRIVATE(vm)->mon, secrethdr, secret, setaddr, hasSetaddr); qemuDomainObjExitMonitor(vm); @@ -20662,7 +20589,6 @@ qemuDomainGetGuestInfo(virDomainPtr dom, int *nparams, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; int ret = -1; @@ -20690,7 +20616,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, if (virDomainGetGuestInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; @@ -20752,7 +20678,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, qemuDomainObjEndAgentJob(vm); if (nfs > 0 || ndisks > 0) { - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_QUERY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20855,7 +20781,6 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom, char ***keys, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; int rv = -1; @@ -20868,7 +20793,7 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom, if (virDomainAuthorizedSshKeysGetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20893,7 +20818,6 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, unsigned int nkeys, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuAgent *agent; const bool append = flags & VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_APPEND; @@ -20909,7 +20833,7 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, if (virDomainAuthorizedSshKeysSetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_QUERY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20963,7 +20887,6 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, int seconds, unsigned int flags) { - virQEMUDriver *driver = dom->conn->privateData; virDomainObj *vm = NULL; qemuDomainObjPrivate *priv; qemuMonitorDirtyRateCalcMode mode = QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING; @@ -21018,7 +20941,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) { @@ -21027,7 +20950,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, VIR_DEBUG("Calculate dirty rate in next %d seconds", seconds); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorStartDirtyRateCalc(priv->mon, seconds, mode); qemuDomainObjExitMonitor(vm); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2c2c270eb9..f5f7d4bdf1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -99,10 +99,9 @@ qemuDomainDeleteDevice(virDomainObj *vm, const char *alias) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelDevice(priv->mon, alias); @@ -285,8 +284,7 @@ qemuHotplugWaitForTrayEject(virDomainObj *vm, * Returns 0 on success, -1 on error and reports libvirt error */ static int -qemuDomainChangeMediaLegacy(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainChangeMediaLegacy(virDomainObj *vm, virDomainDiskDef *disk, virStorageSource *newsrc, bool force) @@ -307,7 +305,7 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, if (!(driveAlias = qemuAliasDiskDriveFromDisk(disk))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, force); qemuDomainObjExitMonitor(vm); @@ -318,7 +316,7 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, return -1; /* re-issue ejection command to pop out the media */ - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, false); qemuDomainObjExitMonitor(vm); if (rc < 0) @@ -337,7 +335,7 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, if (virStorageSourceGetActualType(newsrc) != VIR_STORAGE_TYPE_DIR) format = virStorageFileFormatTypeToString(newsrc->format); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorChangeMedia(priv->mon, driveAlias, sourcestr, @@ -382,7 +380,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriver *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); @@ -408,8 +406,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriver *driver, * Returns: 0 on success, -1 on error. */ int -qemuHotplugRemoveDBusVMState(virQEMUDriver *driver, - virDomainObj *vm, +qemuHotplugRemoveDBusVMState(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -418,7 +415,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriver *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); @@ -445,8 +442,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriver *driver, * Returns: 0 on success, -1 on error. */ static int -qemuHotplugAttachManagedPR(virQEMUDriver *driver, - virDomainObj *vm, +qemuHotplugAttachManagedPR(virDomainObj *vm, virStorageSource *src, virDomainAsyncJob asyncJob) { @@ -468,7 +464,7 @@ qemuHotplugAttachManagedPR(virQEMUDriver *driver, daemonStarted = true; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorAddObject(priv->mon, &props, NULL); @@ -496,8 +492,7 @@ qemuHotplugAttachManagedPR(virQEMUDriver *driver, * it any more. */ static int -qemuHotplugRemoveManagedPR(virQEMUDriver *driver, - virDomainObj *vm, +qemuHotplugRemoveManagedPR(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -509,7 +504,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias(), false)); @@ -541,8 +536,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriver *driver, * Returns 0 on success, -1 on error and reports libvirt error */ static int -qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainChangeMediaBlockdev(virDomainObj *vm, virDomainDiskDef *disk, virStorageSource *oldsrc, virStorageSource *newsrc, @@ -568,7 +562,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, } if (diskPriv->tray && disk->tray_status != VIR_DOMAIN_DISK_TRAY_OPEN) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockdevTrayOpen(priv->mon, diskPriv->qomName, force); qemuDomainObjExitMonitor(vm); if (rc < 0) @@ -578,7 +572,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, return -1; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockdevMediumRemove(priv->mon, diskPriv->qomName); @@ -668,13 +662,13 @@ qemuDomainChangeEjectableMedia(virQEMUDriver *driver, if (qemuDomainStorageSourceChainAccessAllow(driver, vm, newsrc) < 0) goto cleanup; - if (qemuHotplugAttachManagedPR(driver, vm, newsrc, VIR_ASYNC_JOB_NONE) < 0) + if (qemuHotplugAttachManagedPR(vm, newsrc, VIR_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); @@ -696,7 +690,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriver *driver, /* remove PR manager object if unneeded */ if (managedpr) - ignore_value(qemuHotplugRemoveManagedPR(driver, vm, VIR_ASYNC_JOB_NONE)); + ignore_value(qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE)); /* revert old image do the disk definition */ if (oldsrc) @@ -734,8 +728,7 @@ qemuDomainAttachDiskGenericTransient(virDomainObj *vm, * Attaches disk to a VM. This function aggregates common code for all bus types. * In cases when the VM crashed while adding the disk, -2 is returned. */ int -qemuDomainAttachDiskGeneric(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAttachDiskGeneric(virDomainObj *vm, virDomainDiskDef *disk, virDomainAsyncJob asyncJob) { @@ -772,7 +765,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, disk->src->readonly = origReadonly; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuBlockStorageSourceChainAttach(priv->mon, data); @@ -804,7 +797,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, if (!(devprops = qemuBuildDiskDeviceProps(vm->def, disk, priv->qemuCaps))) goto rollback; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto rollback; if ((rc = qemuDomainAttachExtensionDevice(priv->mon, &disk->info)) == 0) @@ -835,7 +828,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, return 0; rollback: - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (extensionDeviceAttached) @@ -849,8 +842,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, } -int qemuDomainAttachControllerDevice(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachControllerDevice(virDomainObj *vm, virDomainControllerDef *controller) { int ret = -1; @@ -896,7 +888,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriver *driver, VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, &controller->info)) < 0) { @@ -920,8 +912,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriver *driver, } static virDomainControllerDef * -qemuDomainFindOrCreateSCSIDiskController(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainFindOrCreateSCSIDiskController(virDomainObj *vm, int controller) { size_t i; @@ -961,7 +952,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriver *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; } @@ -1055,7 +1046,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *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)) goto cleanup; } break; @@ -1087,10 +1078,10 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver, if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0) goto cleanup; - if (qemuHotplugAttachManagedPR(driver, vm, disk->src, VIR_ASYNC_JOB_NONE) < 0) + if (qemuHotplugAttachManagedPR(vm, disk->src, VIR_ASYNC_JOB_NONE) < 0) goto cleanup; - ret = qemuDomainAttachDiskGeneric(driver, vm, disk, VIR_ASYNC_JOB_NONE); + ret = qemuDomainAttachDiskGeneric(vm, disk, VIR_ASYNC_JOB_NONE); virDomainAuditDisk(vm, NULL, disk->src, "attach", ret == 0); @@ -1111,7 +1102,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver, ignore_value(qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src)); if (virStorageSourceChainHasManagedPR(disk->src)) - ignore_value(qemuHotplugRemoveManagedPR(driver, vm, VIR_ASYNC_JOB_NONE)); + ignore_value(qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE)); } qemuDomainSecretDiskDestroy(disk); @@ -1370,7 +1361,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, if (!(netprops = qemuBuildHostNetProps(net))) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); for (n = netpriv->tapfds; n; n = n->next) { if (qemuFDPassDirectTransferMonitor(n->data, priv->mon) < 0) { @@ -1413,7 +1404,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, if (!(nicprops = qemuBuildNicDevProps(vm->def, net, priv->qemuCaps))) goto try_remove; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &net->info) < 0) { qemuDomainObjExitMonitor(vm); @@ -1435,7 +1426,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *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) { qemuDomainObjExitMonitor(vm); @@ -1515,7 +1506,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *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); @@ -1632,7 +1623,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, if (!(devprops = qemuBuildPCIHostdevDevProps(vm->def, hostdev))) goto error; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)) < 0) goto exit_monitor; @@ -1674,8 +1665,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, void -qemuDomainDelTLSObjects(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainDelTLSObjects(virDomainObj *vm, virDomainAsyncJob asyncJob, const char *secAlias, const char *tlsAlias) @@ -1688,7 +1678,7 @@ qemuDomainDelTLSObjects(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; if (tlsAlias) @@ -1705,8 +1695,7 @@ qemuDomainDelTLSObjects(virQEMUDriver *driver, int -qemuDomainAddTLSObjects(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAddTLSObjects(virDomainObj *vm, virDomainAsyncJob asyncJob, virJSONValue **secProps, virJSONValue **tlsProps) @@ -1718,7 +1707,7 @@ qemuDomainAddTLSObjects(virQEMUDriver *driver, if (!tlsProps && !secProps) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; if (secProps && *secProps && @@ -1736,7 +1725,7 @@ qemuDomainAddTLSObjects(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); qemuDomainObjExitMonitor(vm); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, NULL); + qemuDomainDelTLSObjects(vm, asyncJob, secAlias, NULL); return -1; } @@ -1809,7 +1798,7 @@ qemuDomainAddChardevTLSObjects(virQEMUDriver *driver, dev->data.tcp.tlscreds = true; - if (qemuDomainAddTLSObjects(driver, vm, VIR_ASYNC_JOB_NONE, + if (qemuDomainAddTLSObjects(vm, VIR_ASYNC_JOB_NONE, &secProps, &tlsProps) < 0) return -1; @@ -1844,7 +1833,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriver *driver, !(secAlias = qemuAliasForSecret(inAlias, NULL))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias, false)); if (secAlias) @@ -1888,7 +1877,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver, &tlsAlias, &secAlias) < 0) goto audit; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuHotplugChardevAttach(priv->mon, charAlias, redirdev->source) < 0) goto exit_monitor; @@ -1915,7 +1904,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver, ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); qemuDomainObjExitMonitor(vm); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, VIR_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, VIR_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2152,7 +2141,7 @@ qemuDomainAttachChrDevice(virQEMUDriver *driver, &tlsAlias, &secAlias) < 0) goto audit; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuFDPassTransferMonitor(charpriv->sourcefd, priv->mon) < 0 || qemuFDPassTransferMonitor(charpriv->logfd, priv->mon) < 0 || @@ -2208,7 +2197,7 @@ qemuDomainAttachChrDevice(virQEMUDriver *driver, qemuDomainObjExitMonitor(vm); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, VIR_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, VIR_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2267,7 +2256,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver, goto audit; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && qemuHotplugChardevAttach(priv->mon, charAlias, rng->source.chardev) < 0) @@ -2314,7 +2303,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver, qemuDomainObjExitMonitor(vm); virErrorRestore(&orig_err); - qemuDomainDelTLSObjects(driver, vm, VIR_ASYNC_JOB_NONE, + qemuDomainDelTLSObjects(vm, VIR_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; } @@ -2396,7 +2385,7 @@ qemuDomainAttachMemory(virQEMUDriver *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; @@ -2410,13 +2399,13 @@ qemuDomainAttachMemory(virQEMUDriver *driver, virObjectEventStateQueue(driver->domainEventState, event); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, VIR_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm, VIR_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, + ignore_value(qemuDomainUpdateMemoryDeviceInfo(vm, VIR_ASYNC_JOB_NONE)); ret = 0; @@ -2506,7 +2495,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriver *driver, VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorAddDeviceProps(priv->mon, &devprops); qemuDomainObjExitMonitor(vm); virDomainAuditHostdev(vm, hostdev, "attach", ret == 0); @@ -2558,7 +2547,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *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; } @@ -2593,7 +2582,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver, VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuBlockStorageSourceAttachApply(priv->mon, data) < 0) goto exit_monitor; @@ -2703,7 +2692,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriver *driver, VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if ((ret = qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)) < 0) goto exit_monitor; @@ -2818,7 +2807,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver, goto cleanup; teardownmemlock = true; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorAddDeviceProps(priv->mon, &devprops); qemuDomainObjExitMonitor(vm); @@ -2903,8 +2892,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver, int -qemuDomainAttachShmemDevice(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAttachShmemDevice(virDomainObj *vm, virDomainShmemDef *shmem) { int ret = -1; @@ -2954,7 +2942,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (shmem->server.enabled) { if (qemuHotplugChardevAttach(priv->mon, charAlias, shmem->server.chr) < 0) @@ -3010,8 +2998,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, int -qemuDomainAttachWatchdog(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAttachWatchdog(virDomainObj *vm, virDomainWatchdogDef *watchdog) { int ret = -1; @@ -3043,7 +3030,7 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver, if (!(props = qemuBuildWatchdogDevProps(vm->def, watchdog))) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); /* QEMU doesn't have a 'dump' action; we tell qemu to 'pause', then libvirt listens for the watchdog event, and we perform the dump @@ -3117,8 +3104,7 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver, int -qemuDomainAttachInputDevice(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAttachInputDevice(virDomainObj *vm, virDomainInputDef *input) { int ret = -1; @@ -3177,7 +3163,7 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver, VIR_REALLOC_N(vm->def->inputs, vm->def->ninputs + 1); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &input->info) < 0) goto exit_monitor; @@ -3219,8 +3205,7 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver, int -qemuDomainAttachVsockDevice(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainAttachVsockDevice(virDomainObj *vm, virDomainVsockDef *vsock) { qemuDomainVsockPrivate *vsockPriv = (qemuDomainVsockPrivate *)vsock->privateData; @@ -3255,7 +3240,7 @@ qemuDomainAttachVsockDevice(virQEMUDriver *driver, if (!(devprops = qemuBuildVsockDevProps(vm->def, vsock, priv->qemuCaps, fdprefix))) goto cleanup; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuDomainAttachExtensionDevice(priv->mon, &vsock->info) < 0) goto exit_monitor; @@ -3345,7 +3330,7 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver, goto cleanup; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuHotplugChardevAttach(priv->mon, charAlias, chardev) < 0) goto exit_monitor; @@ -3527,8 +3512,7 @@ qemuDomainChangeNetFilter(virDomainObj *vm, return 0; } -int qemuDomainChangeNetLinkState(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainChangeNetLinkState(virDomainObj *vm, virDomainNetDef *dev, int linkstate) { @@ -3543,7 +3527,7 @@ int qemuDomainChangeNetLinkState(virQEMUDriver *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) @@ -4016,7 +4000,7 @@ qemuDomainChangeNet(virQEMUDriver *driver, } if (needLinkStateChange && - qemuDomainChangeNetLinkState(driver, vm, olddev, newdev->linkstate) < 0) { + qemuDomainChangeNetLinkState(vm, olddev, newdev->linkstate) < 0) { goto cleanup; } @@ -4107,8 +4091,7 @@ qemuDomainFindGraphicsIndex(virDomainDef *def, int -qemuDomainChangeGraphicsPasswords(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainChangeGraphicsPasswords(virDomainObj *vm, int type, virDomainGraphicsAuthDef *auth, const char *defaultPasswd, @@ -4130,7 +4113,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriver *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); @@ -4253,7 +4236,7 @@ qemuDomainChangeGraphics(virQEMUDriver *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, + if (qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC, &dev->data.vnc.auth, cfg->vncPassword, @@ -4300,7 +4283,7 @@ qemuDomainChangeGraphics(virQEMUDriver *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, + if (qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &dev->data.spice.auth, cfg->spicePassword, @@ -4421,7 +4404,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, } } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (diskBackend) qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); @@ -4437,7 +4420,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, qemuDomainStorageSourceChainAccessRevoke(driver, vm, disk->src); if (virStorageSourceChainHasManagedPR(disk->src) && - qemuHotplugRemoveManagedPR(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + qemuHotplugRemoveManagedPR(vm, VIR_ASYNC_JOB_NONE) < 0) goto cleanup; if (disk->transient) { @@ -4496,7 +4479,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriver *driver, backendAlias = g_strdup_printf("mem%s", mem->info.alias); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDelObject(priv->mon, backendAlias, true); qemuDomainObjExitMonitor(vm); @@ -4524,7 +4507,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriver *driver, virDomainMemoryDefFree(mem); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, VIR_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm, VIR_ASYNC_JOB_NONE)); /* decrease the mlock limit after memory unplug if necessary */ ignore_value(qemuDomainAdjustMaxMemLock(vm, false)); @@ -4595,7 +4578,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver, detachscsi = qemuBuildHostdevSCSIDetachPrepare(hostdev, priv->qemuCaps); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); qemuBlockStorageSourceAttachRollback(priv->mon, detachscsi); qemuDomainObjExitMonitor(vm); } @@ -4712,7 +4695,7 @@ qemuDomainRemoveNetDevice(virQEMUDriver *driver, */ ignore_value(qemuInterfaceStopDevice(net)); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) { qemuDomainObjExitMonitor(vm); virDomainAuditNet(vm, net, NULL, "detach", false); @@ -4803,7 +4786,7 @@ qemuDomainRemoveChrDevice(virQEMUDriver *driver, return -1; if (monitor) { - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorDetachCharDev(priv->mon, charAlias); qemuHotplugRemoveFDSet(priv->mon, chr->info.alias, NULL); qemuDomainObjExitMonitor(vm); @@ -4862,7 +4845,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriver *driver, if (!(charAlias = qemuAliasChardevFromDevAlias(rng->info.alias))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorDelObject(priv->mon, objAlias, true) < 0) rc = -1; @@ -4900,8 +4883,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriver *driver, static int -qemuDomainRemoveShmemDevice(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRemoveShmemDevice(virDomainObj *vm, virDomainShmemDef *shmem) { int rc; @@ -4919,7 +4901,7 @@ qemuDomainRemoveShmemDevice(virQEMUDriver *driver, memAlias = g_strdup_printf("shmmem-%s", shmem->info.alias); } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (shmem->server.enabled) rc = qemuMonitorDetachCharDev(priv->mon, charAlias); @@ -5012,7 +4994,7 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriver *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. */ @@ -5050,7 +5032,7 @@ qemuDomainRemoveFSDevice(virQEMUDriver *driver, if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { charAlias = qemuDomainGetVhostUserChrAlias(fs->info.alias); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); if (qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) rc = -1; @@ -5200,7 +5182,7 @@ qemuDomainRemoveDevice(virQEMUDriver *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: @@ -5800,7 +5782,7 @@ qemuDomainDetachDeviceChr(virQEMUDriver *driver, if (guestfwd) { int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorRemoveNetdev(priv->mon, tmpChr->info.alias); qemuDomainObjExitMonitor(vm); @@ -6195,8 +6177,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, static int -qemuDomainRemoveVcpu(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRemoveVcpu(virDomainObj *vm, unsigned int vcpu) { qemuDomainObjPrivate *priv = vm->privateData; @@ -6207,7 +6188,7 @@ qemuDomainRemoveVcpu(virQEMUDriver *driver, virErrorPtr save_error = NULL; size_t i; - if (qemuDomainRefreshVcpuInfo(driver, vm, VIR_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, VIR_ASYNC_JOB_NONE, false) < 0) return -1; /* validation requires us to set the expected state prior to calling it */ @@ -6241,8 +6222,7 @@ qemuDomainRemoveVcpu(virQEMUDriver *driver, void -qemuDomainRemoveVcpuAlias(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainRemoveVcpuAlias(virDomainObj *vm, const char *alias) { virDomainVcpuDef *vcpu; @@ -6254,7 +6234,7 @@ qemuDomainRemoveVcpuAlias(virQEMUDriver *driver, vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu); if (STREQ_NULLABLE(alias, vcpupriv->alias)) { - qemuDomainRemoveVcpu(driver, vm, i); + qemuDomainRemoveVcpu(vm, i); return; } } @@ -6297,7 +6277,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriver *driver, goto cleanup; } - if (qemuDomainRemoveVcpu(driver, vm, vcpu) < 0) + if (qemuDomainRemoveVcpu(vm, vcpu) < 0) goto cleanup; qemuDomainVcpuPersistOrder(vm->def); @@ -6338,7 +6318,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriver *driver, if (!(vcpuprops = qemuBuildHotpluggableCPUProps(vcpuinfo))) return -1; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops); @@ -6352,7 +6332,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriver *driver, /* start outputting of the new XML element to allow keeping unpluggability */ vm->def->individualvcpus = true; - if (qemuDomainRefreshVcpuInfo(driver, vm, VIR_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, VIR_ASYNC_JOB_NONE, false) < 0) return -1; /* validation requires us to set the expected state prior to calling it */ @@ -6814,15 +6794,14 @@ qemuDomainSetVcpuInternal(virQEMUDriver *driver, int -qemuDomainChangeMemoryRequestedSize(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainChangeMemoryRequestedSize(virDomainObj *vm, const char *alias, unsigned long long requestedsize) { qemuDomainObjPrivate *priv = vm->privateData; int rc; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorChangeMemoryRequestedSize(priv->mon, alias, requestedsize); qemuDomainObjExitMonitor(vm); diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index f769bf6477..cec1423ee0 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -30,14 +30,12 @@ int qemuDomainChangeEjectableMedia(virQEMUDriver *driver, virStorageSource *newsrc, bool force); -void qemuDomainDelTLSObjects(virQEMUDriver *driver, - virDomainObj *vm, +void qemuDomainDelTLSObjects(virDomainObj *vm, virDomainAsyncJob asyncJob, const char *secAlias, const char *tlsAlias); -int qemuDomainAddTLSObjects(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAddTLSObjects(virDomainObj *vm, virDomainAsyncJob asyncJob, virJSONValue **secProps, virJSONValue **tlsProps); @@ -50,15 +48,13 @@ int qemuDomainGetTLSObjects(qemuDomainSecretInfo *secinfo, virJSONValue **tlsProps, virJSONValue **secProps); -int qemuDomainAttachControllerDevice(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachControllerDevice(virDomainObj *vm, virDomainControllerDef *controller); int qemuDomainAttachDeviceDiskLive(virQEMUDriver *driver, virDomainObj *vm, virDomainDeviceDef *dev); -int qemuDomainAttachDiskGeneric(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachDiskGeneric(virDomainObj *vm, virDomainDiskDef *disk, virDomainAsyncJob asyncJob); @@ -71,11 +67,9 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver, int qemuDomainAttachHostDevice(virQEMUDriver *driver, virDomainObj *vm, virDomainHostdevDef *hostdev); -int qemuDomainAttachShmemDevice(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachShmemDevice(virDomainObj *vm, virDomainShmemDef *shmem); -int qemuDomainAttachWatchdog(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachWatchdog(virDomainObj *vm, virDomainWatchdogDef *watchdog); int qemuDomainFindGraphicsIndex(virDomainDef *def, virDomainGraphicsDef *dev); @@ -85,8 +79,7 @@ int qemuDomainAttachMemory(virQEMUDriver *driver, int qemuDomainChangeGraphics(virQEMUDriver *driver, virDomainObj *vm, virDomainGraphicsDef *dev); -int qemuDomainChangeGraphicsPasswords(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainChangeGraphicsPasswords(virDomainObj *vm, int type, virDomainGraphicsAuthDef *auth, const char *defaultPasswd, @@ -94,17 +87,14 @@ int qemuDomainChangeGraphicsPasswords(virQEMUDriver *driver, int qemuDomainChangeNet(virQEMUDriver *driver, virDomainObj *vm, virDomainDeviceDef *dev); -int qemuDomainChangeNetLinkState(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainChangeNetLinkState(virDomainObj *vm, virDomainNetDef *dev, int linkstate); -int qemuDomainAttachInputDevice(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachInputDevice(virDomainObj *vm, virDomainInputDef *input); -int qemuDomainAttachVsockDevice(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainAttachVsockDevice(virDomainObj *vm, virDomainVsockDef *vsock); int qemuDomainAttachFSDevice(virQEMUDriver *driver, @@ -126,8 +116,7 @@ int qemuDomainDetachDeviceLive(virDomainObj *vm, virQEMUDriver *driver, bool async); -void qemuDomainRemoveVcpuAlias(virQEMUDriver *driver, - virDomainObj *vm, +void qemuDomainRemoveVcpuAlias(virDomainObj *vm, const char *alias); int @@ -165,11 +154,9 @@ int qemuHotplugAttachDBusVMState(virQEMUDriver *driver, virDomainObj *vm, virDomainAsyncJob asyncJob); -int qemuHotplugRemoveDBusVMState(virQEMUDriver *driver, - virDomainObj *vm, +int qemuHotplugRemoveDBusVMState(virDomainObj *vm, virDomainAsyncJob asyncJob); -int qemuDomainChangeMemoryRequestedSize(virQEMUDriver *driver, - virDomainObj *vm, +int qemuDomainChangeMemoryRequestedSize(virDomainObj *vm, const char *alias, unsigned long long requestedsize); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9eda279a84..f846932857 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -101,8 +101,7 @@ qemuMigrationJobIsAllowed(virDomainObj *vm) static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT -qemuMigrationJobStart(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationJobStart(virDomainObj *vm, virDomainAsyncJob job, unsigned long apiFlags) { @@ -124,7 +123,7 @@ qemuMigrationJobStart(virQEMUDriver *driver, } mask |= JOB_MASK(VIR_JOB_MODIFY_MIGRATION_SAFE); - if (qemuDomainObjBeginAsyncJob(driver, vm, job, op, apiFlags) < 0) + if (qemuDomainObjBeginAsyncJob(vm, job, op, apiFlags) < 0) return -1; qemuDomainJobSetStatsType(priv->job.current, @@ -604,7 +603,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0) goto cleanup; @@ -636,8 +635,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver, static int -qemuMigrationDstStopNBDServer(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationDstStopNBDServer(virDomainObj *vm, qemuMigrationCookie *mig) { qemuDomainObjPrivate *priv = vm->privateData; @@ -645,7 +643,7 @@ qemuMigrationDstStopNBDServer(virQEMUDriver *driver, if (!mig->nbd) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0) return -1; @@ -821,8 +819,7 @@ qemuMigrationSrcNBDCopyCancelled(virDomainObj *vm, * -1 on error or when job failed and failNoJob is true. */ static int -qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcNBDCopyCancelOne(virDomainObj *vm, virDomainDiskDef *disk, qemuBlockJobData *job, bool abortMigration, @@ -844,7 +841,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, return 1; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; /* when we are aborting the migration we don't care about the data @@ -873,8 +870,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, * Returns 0 on success, -1 otherwise. */ static int -qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcNBDCopyCancel(virDomainObj *vm, bool abortMigration, virDomainAsyncJob asyncJob, virConnectPtr dconn) @@ -901,7 +897,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, continue; } - rv = qemuMigrationSrcNBDCopyCancelOne(driver, vm, disk, job, + rv = qemuMigrationSrcNBDCopyCancelOne(vm, disk, job, abortMigration, asyncJob); if (rv != 0) { if (rv < 0) { @@ -944,7 +940,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriver *driver, if (!diskPriv->migrSource) continue; - qemuBlockStorageSourceDetachOneBlockdev(driver, vm, asyncJob, + qemuBlockStorageSourceDetachOneBlockdev(vm, asyncJob, diskPriv->migrSource); g_clear_pointer(&diskPriv->migrSource, virObjectUnref); } @@ -962,14 +958,13 @@ qemuMigrationSrcCancelRemoveTempBitmaps(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; qemuDomainJobPrivate *jobPriv = priv->job.privateData; GSList *next; for (next = jobPriv->migTempBitmaps; next; next = next->next) { qemuDomainJobPrivateMigrateTempBitmap *t = next->data; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; qemuMonitorBitmapRemove(priv->mon, t->nodename, t->bitmapname); qemuDomainObjExitMonitor(vm); @@ -1022,8 +1017,7 @@ qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDef *disk, static int -qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcNBDStorageCopyBlockdev(virDomainObj *vm, virDomainDiskDef *disk, const char *jobname, const char *sourcename, @@ -1055,7 +1049,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, false))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; @@ -1081,8 +1075,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, static int -qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcNBDStorageCopyDriveMirror(virDomainObj *vm, const char *diskAlias, const char *host, int port, @@ -1104,7 +1097,7 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver *driver, diskAlias); } - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; @@ -1121,8 +1114,7 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver *driver, static int -qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcNBDStorageCopyOne(virDomainObj *vm, virDomainDiskDef *disk, const char *host, int port, @@ -1164,7 +1156,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, if (flags & VIR_MIGRATE_TLS || virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { - rc = qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, + rc = qemuMigrationSrcNBDStorageCopyBlockdev(vm, disk, jobname, sourcename, persistjob, host, port, socket, @@ -1174,7 +1166,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driver, tlsHostname, syncWrites); } else { - rc = qemuMigrationSrcNBDStorageCopyDriveMirror(driver, vm, diskAlias, + rc = qemuMigrationSrcNBDStorageCopyDriveMirror(vm, diskAlias, host, port, socket, mirror_speed, mirror_shallow); @@ -1291,7 +1283,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriver *driver, if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks)) continue; - if (qemuMigrationSrcNBDStorageCopyOne(driver, vm, disk, host, port, + if (qemuMigrationSrcNBDStorageCopyOne(vm, disk, host, port, socket, mirror_speed, mirror_shallow, tlsAlias, tlsHostname, flags) < 0) @@ -1325,7 +1317,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriver *driver, return -1; } - qemuMigrationSrcFetchMirrorStats(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationSrcFetchMirrorStats(vm, VIR_ASYNC_JOB_MIGRATION_OUT, priv->job.current); return 0; } @@ -1416,15 +1408,14 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def) static int -qemuDomainGetMigrationBlockers(virQEMUDriver *driver, - virDomainObj *vm, +qemuDomainGetMigrationBlockers(virDomainObj *vm, int asyncJob, char ***blockers) { qemuDomainObjPrivate *priv = vm->privateData; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers); @@ -1483,7 +1474,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, if (blockedReasonsCap) { g_auto(GStrv) blockers = NULL; - if (qemuDomainGetMigrationBlockers(driver, vm, + if (qemuDomainGetMigrationBlockers(vm, asyncJob, &blockers) < 0) { return false; @@ -1855,8 +1846,7 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData) int -qemuMigrationAnyFetchStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationAnyFetchStats(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobData *jobData, char **error) @@ -1866,7 +1856,7 @@ qemuMigrationAnyFetchStats(virQEMUDriver *driver, qemuDomainJobDataPrivate *privJob = jobData->privateData; int rv; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rv = qemuMonitorGetMigrationStats(priv->mon, &stats, error); @@ -1910,8 +1900,7 @@ qemuMigrationJobName(virDomainObj *vm) static int -qemuMigrationJobCheckStatus(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationJobCheckStatus(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -1920,7 +1909,7 @@ qemuMigrationJobCheckStatus(virQEMUDriver *driver, g_autofree char *error = NULL; if (privJob->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) { - if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, &error) < 0) + if (qemuMigrationAnyFetchStats(vm, asyncJob, jobData, &error) < 0) return -1; } @@ -1986,8 +1975,7 @@ enum qemuMigrationCompletedFlags { * -2 something else failed, we need to cancel migration. */ static int -qemuMigrationAnyCompleted(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationAnyCompleted(virDomainObj *vm, virDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) @@ -1996,7 +1984,7 @@ qemuMigrationAnyCompleted(virQEMUDriver *driver, virDomainJobData *jobData = priv->job.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 */ @@ -2079,8 +2067,7 @@ qemuMigrationAnyCompleted(virQEMUDriver *driver, * QEMU reports failed migration. */ static int -qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcWaitForCompletion(virDomainObj *vm, virDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) @@ -2091,7 +2078,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver, jobData->status = VIR_DOMAIN_JOB_STATUS_MIGRATING; - while ((rv = qemuMigrationAnyCompleted(driver, vm, asyncJob, + while ((rv = qemuMigrationAnyCompleted(vm, asyncJob, dconn, flags)) != 1) { if (rv < 0) return rv; @@ -2103,7 +2090,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver, } } - ignore_value(qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, NULL)); + ignore_value(qemuMigrationAnyFetchStats(vm, asyncJob, jobData, NULL)); qemuDomainJobDataUpdateTime(jobData); qemuDomainJobDataUpdateDowntime(jobData); @@ -2120,8 +2107,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver, static int -qemuMigrationDstWaitForCompletion(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationDstWaitForCompletion(virDomainObj *vm, virDomainAsyncJob asyncJob, bool postcopy) { @@ -2133,7 +2119,7 @@ qemuMigrationDstWaitForCompletion(virQEMUDriver *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; @@ -2144,8 +2130,7 @@ qemuMigrationDstWaitForCompletion(virQEMUDriver *driver, static int -qemuMigrationSrcGraphicsRelocate(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcGraphicsRelocate(virDomainObj *vm, qemuMigrationCookie *cookie, const char *graphicsuri) { @@ -2223,7 +2208,7 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *driver, if (port <= 0 && tlsPort <= 0) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) == 0) { qemuDomainJobPrivate *jobPriv = priv->job.privateData; @@ -2312,8 +2297,7 @@ qemuMigrationDstGetURI(const char *migrateFrom, int -qemuMigrationDstRun(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationDstRun(virDomainObj *vm, const char *uri, virDomainAsyncJob asyncJob) { @@ -2322,7 +2306,7 @@ qemuMigrationDstRun(virQEMUDriver *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, priv->dbusVMStateIds); @@ -2341,7 +2325,7 @@ qemuMigrationDstRun(virQEMUDriver *driver, return 0; } - if (qemuMigrationDstWaitForCompletion(driver, vm, asyncJob, false) < 0) + if (qemuMigrationDstWaitForCompletion(vm, asyncJob, false) < 0) return -1; return 0; @@ -2360,7 +2344,6 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm, virConnectPtr conn) { qemuDomainObjPrivate *priv = vm->privateData; - virQEMUDriver *driver = priv->driver; qemuDomainJobPrivate *jobPriv = priv->job.privateData; bool postcopy = false; int phase; @@ -2436,7 +2419,7 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm, qemuMigrationDstPostcopyFailed(vm); qemuMigrationJobContinue(vm, qemuProcessCleanupMigrationJob); } else { - qemuMigrationParamsReset(driver, vm, priv->job.asyncJob, + qemuMigrationParamsReset(vm, priv->job.asyncJob, jobPriv->migParams, priv->job.apiFlags); qemuMigrationJobFinish(vm); } @@ -2529,8 +2512,7 @@ qemuMigrationSrcBeginPhaseBlockDirtyBitmaps(qemuMigrationCookie *mig, int -qemuMigrationAnyRefreshStatus(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationAnyRefreshStatus(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobStatus *status) { @@ -2540,7 +2522,7 @@ qemuMigrationAnyRefreshStatus(virQEMUDriver *driver, jobData = virDomainJobDataInit(&qemuJobDataPrivateDataCallbacks); priv = jobData->privateData; - if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, NULL) < 0) + if (qemuMigrationAnyFetchStats(vm, asyncJob, jobData, NULL) < 0) return -1; qemuMigrationUpdateJobType(jobData); @@ -2820,8 +2802,7 @@ qemuMigrationAnyCanResume(virDomainObj *vm, static char * -qemuMigrationSrcBeginResume(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcBeginResume(virDomainObj *vm, const char *xmlin, char **cookieout, int *cookieoutlen, @@ -2829,7 +2810,7 @@ qemuMigrationSrcBeginResume(virQEMUDriver *driver, { virDomainJobStatus status; - if (qemuMigrationAnyRefreshStatus(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationAnyRefreshStatus(vm, VIR_ASYNC_JOB_MIGRATION_OUT, &status) < 0) return NULL; @@ -2868,7 +2849,7 @@ qemuMigrationSrcBeginResumePhase(virConnectPtr conn, qemuMigrationAnyConnectionClosed); qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob); - xml = qemuMigrationSrcBeginResume(driver, vm, xmlin, cookieout, cookieoutlen, flags); + xml = qemuMigrationSrcBeginResume(vm, xmlin, cookieout, cookieoutlen, flags); if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn, qemuMigrationAnyConnectionClosed) < 0) @@ -2914,7 +2895,7 @@ qemuMigrationSrcBegin(virConnectPtr conn, } if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) { - if (qemuMigrationJobStart(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationJobStart(vm, VIR_ASYNC_JOB_MIGRATION_OUT, flags) < 0) goto cleanup; asyncJob = VIR_ASYNC_JOB_MIGRATION_OUT; @@ -2922,7 +2903,7 @@ qemuMigrationSrcBegin(virConnectPtr conn, if (!qemuMigrationJobIsAllowed(vm)) goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; asyncJob = VIR_ASYNC_JOB_NONE; } @@ -2936,7 +2917,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, @@ -3241,7 +3222,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver, if (qemuMigrationDstPrepareAnyBlockDirtyBitmaps(vm, mig, migParams, flags) < 0) goto error; - if (qemuMigrationParamsCheck(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationParamsCheck(vm, VIR_ASYNC_JOB_MIGRATION_IN, migParams, mig->caps->automatic) < 0) goto error; @@ -3261,7 +3242,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver, goto error; } - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_MIGRATION_IN, migParams, flags) < 0) goto error; @@ -3296,7 +3277,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver, VIR_DEBUG("Received no lockstate"); } - if (qemuMigrationDstRun(driver, vm, incoming->uri, + if (qemuMigrationDstRun(vm, incoming->uri, VIR_ASYNC_JOB_MIGRATION_IN) < 0) goto error; @@ -3321,7 +3302,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver, error: virErrorPreserveLast(&origErr); - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_IN, jobPriv->migParams, priv->job.apiFlags); if (stopProcess) { @@ -3454,7 +3435,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, priv->hookRun = true; } - if (qemuMigrationJobStart(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationJobStart(vm, VIR_ASYNC_JOB_MIGRATION_IN, flags) < 0) goto cleanup; @@ -3568,7 +3549,7 @@ qemuMigrationDstPrepareResume(virQEMUDriver *driver, qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob); - if (qemuMigrationAnyRefreshStatus(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationAnyRefreshStatus(vm, VIR_ASYNC_JOB_MIGRATION_IN, &status) < 0) goto cleanup; @@ -3589,7 +3570,7 @@ qemuMigrationDstPrepareResume(virQEMUDriver *driver, listenAddress, port, -1))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_IN) < 0) goto cleanup; ret = qemuMonitorMigrateRecover(priv->mon, incoming->uri); @@ -3978,7 +3959,7 @@ qemuMigrationSrcComplete(virQEMUDriver *driver, if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED && reason == VIR_DOMAIN_PAUSED_POSTCOPY) { VIR_DEBUG("Refreshing migration statistics"); - if (qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationAnyFetchStats(vm, VIR_ASYNC_JOB_MIGRATION_OUT, jobData, NULL) < 0) VIR_WARN("Could not refresh migration statistics"); } @@ -4076,7 +4057,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); /* cancel any outstanding NBD jobs */ - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(vm, false, VIR_ASYNC_JOB_MIGRATION_OUT, NULL); virErrorRestore(&orig_err); @@ -4087,7 +4068,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, } else if (!virDomainObjIsFailedPostcopy(vm)) { qemuMigrationSrcRestoreDomainState(driver, vm); - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock); } @@ -4452,15 +4433,14 @@ qemuMigrationSrcConnect(virQEMUDriver *driver, static int -qemuMigrationSrcContinue(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcContinue(virDomainObj *vm, qemuMonitorMigrationStatus status, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorMigrateContinue(priv->mon, status); @@ -4483,7 +4463,7 @@ qemuMigrationSetDBusVMState(virQEMUDriver *driver, if (qemuHotplugAttachDBusVMState(driver, vm, VIR_ASYNC_JOB_NONE) < 0) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; rv = qemuMonitorSetDBusVMStateIdList(priv->mon, priv->dbusVMStateIds); @@ -4492,7 +4472,7 @@ qemuMigrationSetDBusVMState(virQEMUDriver *driver, return rv; } else { - if (qemuHotplugRemoveDBusVMState(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuHotplugRemoveDBusVMState(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; } @@ -4521,7 +4501,6 @@ qemuMigrationSrcRunPrepareBlockDirtyBitmapsMerge(virDomainObj *vm, g_autoslist(qemuDomainJobPrivateMigrateTempBitmap) tmpbitmaps = NULL; qemuDomainObjPrivate *priv = vm->privateData; qemuDomainJobPrivate *jobPriv = priv->job.privateData; - virQEMUDriver *driver = priv->driver; g_autoptr(virJSONValue) actions = virJSONValueNewArray(); g_autoptr(GHashTable) blockNamedNodeData = NULL; GSList *nextdisk; @@ -4583,7 +4562,7 @@ qemuMigrationSrcRunPrepareBlockDirtyBitmapsMerge(virDomainObj *vm, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; rc = qemuMonitorTransaction(priv->mon, &actions); @@ -4812,14 +4791,14 @@ qemuMigrationSrcRun(virQEMUDriver *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 (mig->blockDirtyBitmaps && qemuMigrationSrcRunPrepareBlockDirtyBitmaps(vm, mig, migParams, flags) < 0) goto error; - if (qemuMigrationParamsCheck(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationParamsCheck(vm, VIR_ASYNC_JOB_MIGRATION_OUT, migParams, mig->caps->automatic) < 0) goto error; @@ -4849,7 +4828,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, priv->migMaxBandwidth * 1024 * 1024) < 0) goto error; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_MIGRATION_OUT, migParams, flags) < 0) goto error; @@ -4924,7 +4903,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, goto error; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) goto error; @@ -4966,7 +4945,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, if (flags & VIR_MIGRATE_POSTCOPY) waitFlags |= QEMU_MIGRATION_COMPLETED_POSTCOPY; - rc = qemuMigrationSrcWaitForCompletion(driver, vm, + rc = qemuMigrationSrcWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_OUT, dconn, waitFlags); if (rc == -2) @@ -4990,7 +4969,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, } if (mig->nbd && - qemuMigrationSrcNBDCopyCancel(driver, vm, false, + qemuMigrationSrcNBDCopyCancel(vm, false, VIR_ASYNC_JOB_MIGRATION_OUT, dconn) < 0) goto error; @@ -5000,14 +4979,14 @@ qemuMigrationSrcRun(virQEMUDriver *driver, * end of the migration. */ if (priv->job.current->status == VIR_DOMAIN_JOB_STATUS_PAUSED) { - if (qemuMigrationSrcContinue(driver, vm, + if (qemuMigrationSrcContinue(vm, QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) goto error; waitFlags ^= QEMU_MIGRATION_COMPLETED_PRE_SWITCHOVER; - rc = qemuMigrationSrcWaitForCompletion(driver, vm, + rc = qemuMigrationSrcWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_OUT, dconn, waitFlags); if (rc == -2) @@ -5068,7 +5047,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, if (cancel && priv->job.current->status != VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED && - qemuDomainObjEnterMonitorAsync(driver, vm, + qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) == 0) { qemuMonitorMigrateCancel(priv->mon); qemuDomainObjExitMonitor(vm); @@ -5076,7 +5055,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, /* cancel any outstanding NBD jobs */ if (mig && mig->nbd) - qemuMigrationSrcNBDCopyCancel(driver, vm, true, + qemuMigrationSrcNBDCopyCancel(vm, true, VIR_ASYNC_JOB_MIGRATION_OUT, dconn); @@ -5122,11 +5101,11 @@ qemuMigrationSrcResume(virDomainObj *vm, if (!mig) return -1; - if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_MIGRATION_OUT, migParams, flags) < 0) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_MIGRATION_OUT) < 0) return -1; @@ -5518,7 +5497,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriver *driver, * a single job. */ if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { - dom_xml = qemuMigrationSrcBeginResume(driver, vm, xmlin, + dom_xml = qemuMigrationSrcBeginResume(vm, xmlin, &cookieout, &cookieoutlen, flags); } else { dom_xml = qemuMigrationSrcBeginPhase(driver, vm, xmlin, dname, @@ -6043,7 +6022,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver, qemuMigrationAnyConnectionClosed); qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob); } else { - if (qemuMigrationJobStart(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationJobStart(vm, VIR_ASYNC_JOB_MIGRATION_OUT, flags) < 0) goto cleanup; @@ -6106,7 +6085,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver, * here */ if (!v3proto && ret < 0) - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); qemuMigrationSrcRestoreDomainState(driver, vm); @@ -6207,7 +6186,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *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, VIR_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationJobStart(vm, VIR_ASYNC_JOB_MIGRATION_OUT, flags) < 0) return ret; } else if (!qemuMigrationJobIsActive(vm, VIR_ASYNC_JOB_MIGRATION_OUT)) { @@ -6236,7 +6215,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver, cleanup: if (ret < 0 && !virDomainObjIsFailedPostcopy(vm)) { qemuMigrationSrcRestoreDomainState(driver, vm); - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock); qemuMigrationJobFinish(vm); @@ -6492,7 +6471,7 @@ qemuMigrationDstComplete(virQEMUDriver *driver, if (inPostCopy) g_clear_pointer(&job->completed, virDomainJobDataFree); - qemuMigrationParamsReset(driver, vm, asyncJob, jobPriv->migParams, + qemuMigrationParamsReset(vm, asyncJob, jobPriv->migParams, job->apiFlags); virPortAllocatorRelease(priv->migrationPort); @@ -6558,7 +6537,7 @@ qemuMigrationDstFinishFresh(virQEMUDriver *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) return -1; if (qemuRefreshVirtioChannelState(driver, vm, @@ -6590,7 +6569,7 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver, /* We need to wait for QEMU to process all data sent by the source * before starting guest CPUs. */ - if (qemuMigrationDstWaitForCompletion(driver, vm, + if (qemuMigrationDstWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_IN, !!(flags & VIR_MIGRATE_POSTCOPY)) < 0) { /* There's not much we can do for v2 protocol since the @@ -6652,7 +6631,7 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver, } if (*inPostCopy && - qemuMigrationDstWaitForCompletion(driver, vm, + qemuMigrationDstWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_IN, false) < 0) { return -1; @@ -6670,12 +6649,11 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver, static int -qemuMigrationDstFinishResume(virQEMUDriver *driver, - virDomainObj *vm) +qemuMigrationDstFinishResume(virDomainObj *vm) { VIR_DEBUG("vm=%p", vm); - if (qemuMigrationDstWaitForCompletion(driver, vm, + if (qemuMigrationDstWaitForCompletion(vm, VIR_ASYNC_JOB_MIGRATION_IN, false) < 0) { return -1; @@ -6721,7 +6699,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *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, VIR_ASYNC_JOB_MIGRATION_IN); + qemuDomainCheckMonitor(vm, VIR_ASYNC_JOB_MIGRATION_IN); goto error; } @@ -6733,7 +6711,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, } if (flags & VIR_MIGRATE_POSTCOPY_RESUME) { - rc = qemuMigrationDstFinishResume(driver, vm); + rc = qemuMigrationDstFinishResume(vm); inPostCopy = true; } else { rc = qemuMigrationDstFinishFresh(driver, vm, mig, flags, v3proto, @@ -6780,7 +6758,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, qemuProcessAutoDestroyRemove(driver, vm); *finishJob = false; } else { - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_IN, jobPriv->migParams, priv->job.apiFlags); } @@ -6956,7 +6934,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024 * 1024) < 0) return -1; - if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams, 0) < 0) + if (qemuMigrationParamsApply(vm, asyncJob, migParams, 0) < 0) return -1; priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; @@ -6979,7 +6957,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, compressor ? pipeFD[1] : fd) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; if (!compressor) { @@ -7012,14 +6990,14 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, 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); qemuDomainObjExitMonitor(vm); } @@ -7042,7 +7020,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *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, 0)); priv->migMaxBandwidth = saveMigBandwidth; } @@ -7061,8 +7039,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, int -qemuMigrationSrcCancel(virQEMUDriver *driver, - virDomainObj *vm) +qemuMigrationSrcCancel(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; bool storage = false; @@ -7071,7 +7048,7 @@ qemuMigrationSrcCancel(virQEMUDriver *driver, VIR_DEBUG("Canceling unfinished outgoing migration of domain %s", vm->def->name); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); qemuDomainObjExitMonitor(vm); @@ -7093,7 +7070,7 @@ qemuMigrationSrcCancel(virQEMUDriver *driver, } if (storage && - qemuMigrationSrcNBDCopyCancel(driver, vm, true, + qemuMigrationSrcNBDCopyCancel(vm, true, VIR_ASYNC_JOB_NONE, NULL) < 0) return -1; @@ -7157,8 +7134,7 @@ qemuMigrationDstErrorReport(virQEMUDriver *driver, int -qemuMigrationSrcFetchMirrorStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcFetchMirrorStats(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobData *jobData) { @@ -7180,7 +7156,7 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriver *driver, if (!nbd) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; blockinfo = qemuMonitorGetAllBlockJobInfo(priv->mon, false); diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index a39f651659..d518889c19 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -241,12 +241,10 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; int -qemuMigrationSrcCancel(virQEMUDriver *driver, - virDomainObj *vm); +qemuMigrationSrcCancel(virDomainObj *vm); int -qemuMigrationAnyFetchStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationAnyFetchStats(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobData *jobData, char **error); @@ -272,8 +270,7 @@ qemuMigrationDstGetURI(const char *migrateFrom, int migrateFd); int -qemuMigrationDstRun(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationDstRun(virDomainObj *vm, const char *uri, virDomainAsyncJob asyncJob); @@ -284,13 +281,11 @@ void qemuMigrationDstPostcopyFailed(virDomainObj *vm); int -qemuMigrationSrcFetchMirrorStats(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationSrcFetchMirrorStats(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobData *jobData); int -qemuMigrationAnyRefreshStatus(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationAnyRefreshStatus(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainJobStatus *status); diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 0738ad430f..981f5fa66c 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -474,7 +474,6 @@ qemuMigrationCookieAddNetwork(qemuMigrationCookie *mig, static int qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, - virQEMUDriver *driver, virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; @@ -497,7 +496,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *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); @@ -1465,7 +1464,7 @@ qemuMigrationCookieFormat(qemuMigrationCookie *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 9da2fd6d98..c667be8520 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -916,8 +916,7 @@ qemuMigrationParamsApplyValues(virDomainObj *vm, * Returns 0 on success, -1 on failure. */ int -qemuMigrationParamsApply(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsApply(virDomainObj *vm, int asyncJob, qemuMigrationParams *migParams, unsigned long apiFlags) @@ -925,7 +924,7 @@ qemuMigrationParamsApply(virQEMUDriver *driver, bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME); int ret = -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; /* Changing capabilities is only allowed before migration starts, we need @@ -1047,9 +1046,9 @@ qemuMigrationParamsEnableTLS(virQEMUDriver *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, @@ -1116,8 +1115,7 @@ qemuMigrationParamsTLSHostnameIsSet(qemuMigrationParams *migParams) * security objects and free the secinfo */ static void -qemuMigrationParamsResetTLS(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsResetTLS(virDomainObj *vm, int asyncJob, qemuMigrationParams *origParams, unsigned long apiFlags) @@ -1134,14 +1132,13 @@ qemuMigrationParamsResetTLS(virQEMUDriver *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(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsFetch(virDomainObj *vm, int asyncJob, qemuMigrationParams **migParams) { @@ -1151,7 +1148,7 @@ qemuMigrationParamsFetch(virQEMUDriver *driver, *migParams = NULL; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMigrationParams(priv->mon, &jsonParams); @@ -1211,8 +1208,7 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migParams, * are unsupported by QEMU. */ int -qemuMigrationParamsCheck(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsCheck(virDomainObj *vm, int asyncJob, qemuMigrationParams *migParams, virBitmap *remoteCaps) @@ -1272,7 +1268,7 @@ qemuMigrationParamsCheck(virQEMUDriver *driver, * to ask QEMU for their current settings. */ - return qemuMigrationParamsFetch(driver, vm, asyncJob, &jobPriv->migParams); + return qemuMigrationParamsFetch(vm, asyncJob, &jobPriv->migParams); } @@ -1283,8 +1279,7 @@ qemuMigrationParamsCheck(virQEMUDriver *driver, * migration (save, managedsave, snapshots, dump) will not try to use them. */ void -qemuMigrationParamsReset(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsReset(virDomainObj *vm, int asyncJob, qemuMigrationParams *origParams, unsigned long apiFlags) @@ -1301,7 +1296,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver, if (!virDomainObjIsActive(vm) || !origParams) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; clearCaps = virBitmapNew(0); @@ -1315,7 +1310,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver, if (rc < 0) goto cleanup; - qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags); + qemuMigrationParamsResetTLS(vm, asyncJob, origParams, apiFlags); cleanup: virErrorRestore(&err); @@ -1453,8 +1448,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt, int -qemuMigrationCapsCheck(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationCapsCheck(virDomainObj *vm, int asyncJob, bool reconnect) { @@ -1464,7 +1458,7 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, char **capStr; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps); @@ -1497,7 +1491,7 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, if (!(json = qemuMigrationCapsToJSON(migEvent, migEvent))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorSetMigrationCapabilities(priv->mon, &json); diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h index 9e990e09bd..c58a933ab6 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -95,8 +95,7 @@ qemuMigrationParamsFree(qemuMigrationParams *migParams); G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMigrationParams, qemuMigrationParamsFree); int -qemuMigrationParamsApply(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsApply(virDomainObj *vm, int asyncJob, qemuMigrationParams *migParams, unsigned long apiFlags); @@ -118,8 +117,7 @@ bool qemuMigrationParamsTLSHostnameIsSet(qemuMigrationParams *migParams); int -qemuMigrationParamsFetch(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsFetch(virDomainObj *vm, int asyncJob, qemuMigrationParams **migParams); @@ -138,15 +136,13 @@ qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParams *migParams, virJSONValue **params); int -qemuMigrationParamsCheck(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsCheck(virDomainObj *vm, int asyncJob, qemuMigrationParams *migParams, virBitmap *remoteCaps); void -qemuMigrationParamsReset(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationParamsReset(virDomainObj *vm, int asyncJob, qemuMigrationParams *origParams, unsigned long apiFlags); @@ -160,8 +156,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt, qemuMigrationParams **migParams); int -qemuMigrationCapsCheck(virQEMUDriver *driver, - virDomainObj *vm, +qemuMigrationCapsCheck(virDomainObj *vm, int asyncJob, bool reconnect); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 478a46bff6..f45bfc7024 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -459,7 +459,7 @@ qemuProcessFakeReboot(void *opaque) VIR_DEBUG("vm=%p", vm); virObjectLock(vm); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -468,7 +468,7 @@ qemuProcessFakeReboot(void *opaque) goto endjob; } - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorSystemReset(priv->mon); qemuDomainObjExitMonitor(vm); @@ -1862,13 +1862,12 @@ qemuProcessMonitorLogFree(void *opaque) static int -qemuProcessInitMonitor(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessInitMonitor(virDomainObj *vm, virDomainAsyncJob asyncJob) { int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; ret = qemuMonitorSetCapabilities(QEMU_DOMAIN_PRIVATE(vm)->mon); @@ -1924,10 +1923,10 @@ qemuConnectMonitor(virQEMUDriver *driver, return -1; } - if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0) + if (qemuProcessInitMonitor(vm, asyncJob) < 0) return -1; - if (qemuMigrationCapsCheck(driver, vm, asyncJob, reconnect) < 0) + if (qemuMigrationCapsCheck(vm, asyncJob, reconnect) < 0) return -1; return 0; @@ -2156,7 +2155,7 @@ qemuRefreshVirtioChannelState(virQEMUDriver *driver, g_autoptr(GHashTable) info = NULL; int rc; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetChardevInfo(priv->mon, &info); @@ -2197,8 +2196,7 @@ qemuProcessRefreshPRManagerState(virDomainObj *vm, static int -qemuRefreshPRManagerState(virQEMUDriver *driver, - virDomainObj *vm) +qemuRefreshPRManagerState(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(GHashTable) info = NULL; @@ -2208,7 +2206,7 @@ qemuRefreshPRManagerState(virQEMUDriver *driver, !qemuDomainDefHasManagedPR(vm)) return 0; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetPRManagerInfo(priv->mon, &info); qemuDomainObjExitMonitor(vm); @@ -2232,7 +2230,7 @@ qemuProcessRefreshFdsetIndex(virDomainObj *vm) if (priv->fdsetindexParsed) return 0; - qemuDomainObjEnterMonitor(priv->driver, vm); + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorQueryFdsets(priv->mon, &fdsets); qemuDomainObjExitMonitor(vm); @@ -2249,8 +2247,7 @@ qemuProcessRefreshFdsetIndex(virDomainObj *vm) static void -qemuRefreshRTC(virQEMUDriver *driver, - virDomainObj *vm) +qemuRefreshRTC(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; time_t now, then; @@ -2262,7 +2259,7 @@ qemuRefreshRTC(virQEMUDriver *driver, return; memset(&thenbits, 0, sizeof(thenbits)); - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); now = time(NULL); rv = qemuMonitorGetRTCTime(priv->mon, &thenbits); qemuDomainObjExitMonitor(vm); @@ -2285,8 +2282,7 @@ qemuRefreshRTC(virQEMUDriver *driver, } int -qemuProcessRefreshBalloonState(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessRefreshBalloonState(virDomainObj *vm, int asyncJob) { unsigned long long balloon; @@ -2300,7 +2296,7 @@ qemuProcessRefreshBalloonState(virQEMUDriver *driver, return 0; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorGetBalloonInfo(qemuDomainGetMonitor(vm), &balloon); @@ -2345,7 +2341,7 @@ qemuProcessWaitForMonitor(virQEMUDriver *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); @@ -2370,8 +2366,7 @@ qemuProcessWaitForMonitor(virQEMUDriver *driver, static int -qemuProcessDetectIOThreadPIDs(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessDetectIOThreadPIDs(virDomainObj *vm, int asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -2386,7 +2381,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriver *driver, } /* Get the list of IOThreads from qemu */ - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorGetIOThreads(priv->mon, &iothreads, &niothreads); qemuDomainObjExitMonitor(vm); @@ -2526,8 +2521,7 @@ qemuProcessInitCpuAffinity(virDomainObj *vm G_GNUC_UNUSED) /* set link states to down on interfaces at qemu start */ static int -qemuProcessSetLinkStates(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessSetLinkStates(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -2536,7 +2530,7 @@ qemuProcessSetLinkStates(virQEMUDriver *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++) { @@ -2980,13 +2974,13 @@ qemuProcessInitPasswords(virQEMUDriver *driver, for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDef *graphics = vm->def->graphics[i]; if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - ret = qemuDomainChangeGraphicsPasswords(driver, vm, + 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, + ret = qemuDomainChangeGraphicsPasswords(vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &graphics->data.spice.auth, cfg->spicePassword, @@ -3036,7 +3030,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriver *driver, virDomainVideoDef *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++) { @@ -3216,7 +3210,7 @@ qemuProcessStartCPUs(virQEMUDriver *driver, virDomainObj *vm, priv->runningReason = reason; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto release; ret = qemuMonitorStartCPUs(priv->mon); @@ -3253,7 +3247,7 @@ int qemuProcessStopCPUs(virQEMUDriver *driver, priv->pausedReason = reason; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorStopCPUs(priv->mon); @@ -3355,7 +3349,7 @@ qemuProcessFiltersInstantiate(virDomainDef *def) } static int -qemuProcessUpdateState(virQEMUDriver *driver, virDomainObj *vm) +qemuProcessUpdateState(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; virDomainState state; @@ -3367,7 +3361,7 @@ qemuProcessUpdateState(virQEMUDriver *driver, virDomainObj *vm) g_autofree char *msg = NULL; int ret; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetStatus(priv->mon, &running, &reason); qemuDomainObjExitMonitor(vm); @@ -3592,7 +3586,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *driver, */ 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); } @@ -3674,7 +3668,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver, state = virDomainObjGetState(vm, &reason); - qemuMigrationAnyRefreshStatus(driver, vm, VIR_ASYNC_JOB_NONE, &migStatus); + qemuMigrationAnyRefreshStatus(vm, VIR_ASYNC_JOB_NONE, &migStatus); if (job->asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT) { rc = qemuProcessRecoverMigrationOut(driver, vm, job, migStatus, @@ -3715,7 +3709,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver, return 0; } - qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_NONE, + qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_NONE, jobPriv->migParams, job->apiFlags); qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock); @@ -3752,7 +3746,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver, case VIR_ASYNC_JOB_SAVE: case VIR_ASYNC_JOB_DUMP: case VIR_ASYNC_JOB_SNAPSHOT: - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); qemuDomainObjExitMonitor(vm); /* resume the domain but only if it was paused as a result of @@ -3853,7 +3847,7 @@ qemuProcessUpdateDevices(virQEMUDriver *driver, g_auto(GStrv) old = g_steal_pointer(&priv->qemuDevices); GStrv tmp; - if (qemuDomainUpdateDeviceList(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuDomainUpdateDeviceList(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; if (!old) @@ -4372,8 +4366,7 @@ qemuProcessGetVCPUQOMPath(virDomainObj *vm) static int -qemuProcessFetchGuestCPU(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessFetchGuestCPU(virDomainObj *vm, virDomainAsyncJob asyncJob, virCPUData **enabled, virCPUData **disabled) @@ -4393,7 +4386,7 @@ qemuProcessFetchGuestCPU(virQEMUDriver *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) { @@ -4480,14 +4473,13 @@ qemuProcessUpdateLiveGuestCPU(virDomainObj *vm, static int -qemuProcessUpdateAndVerifyCPU(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessUpdateAndVerifyCPU(virDomainObj *vm, virDomainAsyncJob asyncJob) { g_autoptr(virCPUData) cpu = NULL; g_autoptr(virCPUData) disabled = NULL; - if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) + if (qemuProcessFetchGuestCPU(vm, asyncJob, &cpu, &disabled) < 0) return -1; if (qemuProcessVerifyCPU(vm, cpu) < 0) @@ -4501,8 +4493,7 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriver *driver, static int -qemuProcessFetchCPUDefinitions(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessFetchCPUDefinitions(virDomainObj *vm, virDomainAsyncJob asyncJob, virDomainCapsCPUModels **cpuModels) { @@ -4510,7 +4501,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriver *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); @@ -4525,8 +4516,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriver *driver, static int -qemuProcessUpdateCPU(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessUpdateCPU(virDomainObj *vm, virDomainAsyncJob asyncJob) { g_autoptr(virCPUData) cpu = NULL; @@ -4538,13 +4528,13 @@ qemuProcessUpdateCPU(virQEMUDriver *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; @@ -4738,12 +4728,11 @@ qemuProcessIncomingDefNew(virQEMUCaps *qemuCaps, * parameter between qemuProcessBeginJob and qemuProcessEndJob. */ int -qemuProcessBeginJob(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessBeginJob(virDomainObj *vm, virDomainJobOperation operation, unsigned long apiFlags) { - if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_START, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_START, operation, apiFlags) < 0) return -1; @@ -5237,8 +5226,7 @@ qemuProcessSetupRawIO(virDomainObj *vm, static int -qemuProcessSetupBalloon(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessSetupBalloon(virDomainObj *vm, virDomainAsyncJob asyncJob) { unsigned long long balloon = vm->def->mem.cur_balloon; @@ -5248,7 +5236,7 @@ qemuProcessSetupBalloon(virQEMUDriver *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) @@ -6102,8 +6090,7 @@ qemuProcessVcpusSortOrder(const void *a, static int -qemuProcessSetupHotpluggableVcpus(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessSetupHotpluggableVcpus(virDomainObj *vm, virDomainAsyncJob asyncJob) { unsigned int maxvcpus = virDomainDefGetVcpusMax(vm->def); @@ -6146,7 +6133,7 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriver *driver, if (!(vcpuprops = qemuBuildHotpluggableCPUProps(vcpu))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) goto cleanup; rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops); @@ -7271,8 +7258,7 @@ qemuProcessGenID(virDomainObj *vm, * Same hack is done in qemuDomainAttachDiskGeneric. */ static int -qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessSetupDiskThrottlingBlockdev(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -7284,7 +7270,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *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++) { @@ -7414,7 +7400,7 @@ qemuProcessSetupDisksTransientHotplug(virDomainObj *vm, domdisk->transientShareBacking != VIR_TRISTATE_BOOL_YES) continue; - if (qemuDomainAttachDiskGeneric(priv->driver, vm, domdisk, asyncJob) < 0) + if (qemuDomainAttachDiskGeneric(vm, domdisk, asyncJob) < 0) return -1; hasHotpluggedDisk = true; @@ -7425,7 +7411,7 @@ qemuProcessSetupDisksTransientHotplug(virDomainObj *vm, if (hasHotpluggedDisk) { int rc; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorSystemReset(priv->mon); @@ -7473,7 +7459,7 @@ qemuProcessSetupLifecycleActions(virDomainObj *vm, if (vm->def->onReboot != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) return 0; - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuMonitorSetAction(priv->mon, @@ -7759,18 +7745,18 @@ qemuProcessLaunch(virConnectPtr conn, 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) @@ -7779,11 +7765,11 @@ qemuProcessLaunch(virConnectPtr conn, qemuDomainVcpuPersistOrder(vm->def); VIR_DEBUG("Verifying and updating provided guest CPU"); - if (qemuProcessUpdateAndVerifyCPU(driver, vm, asyncJob) < 0) + if (qemuProcessUpdateAndVerifyCPU(vm, asyncJob) < 0) goto cleanup; 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)"); @@ -7813,21 +7799,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 && @@ -7870,11 +7856,11 @@ qemuProcessRefreshState(virQEMUDriver *driver, qemuDomainObjPrivate *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"); @@ -7882,10 +7868,10 @@ qemuProcessRefreshState(virQEMUDriver *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; @@ -8004,7 +7990,7 @@ qemuProcessStart(virConnectPtr conn, relabel = true; if (incoming) { - if (qemuMigrationDstRun(driver, vm, incoming->uri, asyncJob) < 0) + if (qemuMigrationDstRun(vm, incoming->uri, asyncJob) < 0) goto stop; } else { /* Refresh state of devices from QEMU. During migration this happens @@ -8126,8 +8112,7 @@ qemuProcessKill(virDomainObj *vm, unsigned int flags) * qemuProcessStop. */ int -qemuProcessBeginStopJob(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessBeginStopJob(virDomainObj *vm, virDomainJob job, bool forceKill) { @@ -8147,7 +8132,7 @@ qemuProcessBeginStopJob(virQEMUDriver *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; @@ -8188,7 +8173,7 @@ void qemuProcessStop(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); if (asyncJob != VIR_ASYNC_JOB_NONE) { - if (qemuDomainObjBeginNestedJob(driver, vm, asyncJob) < 0) + if (qemuDomainObjBeginNestedJob(vm, asyncJob) < 0) goto cleanup; } else if (priv->job.asyncJob != VIR_ASYNC_JOB_NONE && priv->job.asyncOwner == virThreadSelfID() && @@ -8525,7 +8510,7 @@ qemuProcessAutoDestroy(virDomainObj *dom, VIR_DEBUG("Killing domain"); - if (qemuProcessBeginStopJob(driver, dom, VIR_JOB_DESTROY, true) < 0) + if (qemuProcessBeginStopJob(dom, VIR_JOB_DESTROY, true) < 0) return; qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, @@ -8571,8 +8556,7 @@ bool qemuProcessAutoDestroyActive(virQEMUDriver *driver, int -qemuProcessRefreshDisks(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessRefreshDisks(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -8580,7 +8564,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, g_autoptr(GHashTable) table = NULL; size_t i; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { table = qemuMonitorGetBlockInfo(priv->mon); qemuDomainObjExitMonitor(vm); } @@ -8622,8 +8606,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, static int -qemuProcessRefreshCPUMigratability(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessRefreshCPUMigratability(virDomainObj *vm, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv = vm->privateData; @@ -8644,7 +8627,7 @@ qemuProcessRefreshCPUMigratability(virQEMUDriver *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, cpuQOMPath, &migratable); @@ -8685,7 +8668,7 @@ qemuProcessRefreshCPU(virQEMUDriver *driver, if (!vm->def->cpu) return 0; - if (qemuProcessRefreshCPUMigratability(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshCPUMigratability(vm, VIR_ASYNC_JOB_NONE) < 0) return -1; if (!(host = virQEMUDriverGetHostCPU(driver))) { @@ -8720,7 +8703,7 @@ qemuProcessRefreshCPU(virQEMUDriver *driver, if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, cpu) < 0) return -1; - if (qemuProcessUpdateCPU(driver, vm, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessUpdateCPU(vm, VIR_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 @@ -8799,12 +8782,11 @@ qemuProcessRefreshLegacyBlockjob(void *payload, static int -qemuProcessRefreshLegacyBlockjobs(virQEMUDriver *driver, - virDomainObj *vm) +qemuProcessRefreshLegacyBlockjobs(virDomainObj *vm) { g_autoptr(GHashTable) blockJobs = NULL; - qemuDomainObjEnterMonitor(driver, vm); + qemuDomainObjEnterMonitor(vm); blockJobs = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true); qemuDomainObjExitMonitor(vm); @@ -8819,15 +8801,14 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriver *driver, static int -qemuProcessRefreshBlockjobs(virQEMUDriver *driver, - virDomainObj *vm) +qemuProcessRefreshBlockjobs(virDomainObj *vm) { qemuDomainObjPrivate *priv = vm->privateData; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) - return qemuBlockJobRefreshJobs(driver, vm); + return qemuBlockJobRefreshJobs(vm); - return qemuProcessRefreshLegacyBlockjobs(driver, vm); + return qemuProcessRefreshLegacyBlockjobs(vm); } @@ -8885,7 +8866,7 @@ qemuProcessReconnect(void *opaque) if (oldjob.asyncJob == VIR_ASYNC_JOB_BACKUP && priv->backup) priv->backup->apiFlags = oldjob.apiFlags; - if (qemuDomainObjBeginJob(driver, obj, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(obj, VIR_JOB_MODIFY) < 0) goto error; jobStarted = true; @@ -8956,7 +8937,7 @@ qemuProcessReconnect(void *opaque) goto error; } - if (qemuProcessUpdateState(driver, obj) < 0) + if (qemuProcessUpdateState(obj) < 0) goto error; state = virDomainObjGetState(obj, &reason); @@ -9004,7 +8985,7 @@ qemuProcessReconnect(void *opaque) ignore_value(qemuSecurityCheckAllLabel(driver->securityManager, obj->def)); - if (qemuDomainRefreshVcpuInfo(driver, obj, VIR_ASYNC_JOB_NONE, true) < 0) + if (qemuDomainRefreshVcpuInfo(obj, VIR_ASYNC_JOB_NONE, true) < 0) goto error; qemuDomainVcpuPersistOrder(obj->def); @@ -9012,10 +8993,10 @@ qemuProcessReconnect(void *opaque) if (qemuProcessRefreshCPU(driver, obj) < 0) goto error; - if (qemuDomainUpdateMemoryDeviceInfo(driver, obj, VIR_ASYNC_JOB_NONE) < 0) + if (qemuDomainUpdateMemoryDeviceInfo(obj, VIR_ASYNC_JOB_NONE) < 0) goto error; - if (qemuProcessDetectIOThreadPIDs(driver, obj, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessDetectIOThreadPIDs(obj, VIR_ASYNC_JOB_NONE) < 0) goto error; if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) @@ -9025,7 +9006,7 @@ qemuProcessReconnect(void *opaque) qemuProcessFiltersInstantiate(obj->def); - if (qemuProcessRefreshDisks(driver, obj, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshDisks(obj, VIR_ASYNC_JOB_NONE) < 0) goto error; /* At this point we've already checked that the startup of the VM was @@ -9039,28 +9020,28 @@ qemuProcessReconnect(void *opaque) } if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && - qemuBlockNodeNamesDetect(driver, obj, VIR_ASYNC_JOB_NONE) < 0) + qemuBlockNodeNamesDetect(obj, VIR_ASYNC_JOB_NONE) < 0) goto error; if (qemuRefreshVirtioChannelState(driver, obj, VIR_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, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshBalloonState(obj, VIR_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; if (qemuProcessRefreshFdsetIndex(obj) < 0) diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 55296e54e8..421efc6016 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -63,8 +63,7 @@ qemuProcessIncomingDef *qemuProcessIncomingDefNew(virQEMUCaps *qemuCaps, const char *path); void qemuProcessIncomingDefFree(qemuProcessIncomingDef *inc); -int qemuProcessBeginJob(virQEMUDriver *driver, - virDomainObj *vm, +int qemuProcessBeginJob(virDomainObj *vm, virDomainJobOperation operation, unsigned long apiFlags); void qemuProcessEndJob(virDomainObj *vm); @@ -148,8 +147,7 @@ typedef enum { VIR_QEMU_PROCESS_STOP_NO_RELABEL = 1 << 1, } qemuProcessStopFlags; -int qemuProcessBeginStopJob(virQEMUDriver *driver, - virDomainObj *vm, +int qemuProcessBeginStopJob(virDomainObj *vm, virDomainJob job, bool forceKill); void qemuProcessStop(virQEMUDriver *driver, @@ -197,12 +195,10 @@ int qemuRefreshVirtioChannelState(virQEMUDriver *driver, virDomainObj *vm, virDomainAsyncJob asyncJob); -int qemuProcessRefreshBalloonState(virQEMUDriver *driver, - virDomainObj *vm, +int qemuProcessRefreshBalloonState(virDomainObj *vm, int asyncJob); -int qemuProcessRefreshDisks(virQEMUDriver *driver, - virDomainObj *vm, +int qemuProcessRefreshDisks(virDomainObj *vm, virDomainAsyncJob asyncJob); int qemuProcessStartManagedPRDaemon(virDomainObj *vm) G_NO_INLINE; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 0733d44faa..4a3f4fa5e3 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -311,7 +311,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, + if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) { resume = false; goto cleanup; @@ -876,7 +876,7 @@ qemuSnapshotDiskCleanup(qemuSnapshotDiskData *data, * be set to NULL by qemuSnapshotDiskUpdateSource */ 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]); @@ -998,8 +998,7 @@ qemuSnapshotDiskBitmapsPropagate(qemuSnapshotDiskData *dd, static int -qemuSnapshotDiskPrepareOneBlockdev(virQEMUDriver *driver, - virDomainObj *vm, +qemuSnapshotDiskPrepareOneBlockdev(virDomainObj *vm, qemuSnapshotDiskData *dd, virQEMUDriverConfig *cfg, bool reuse, @@ -1023,7 +1022,7 @@ qemuSnapshotDiskPrepareOneBlockdev(virQEMUDriver *driver, return -1; if (reuse) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; rc = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), @@ -1132,7 +1131,7 @@ qemuSnapshotDiskPrepareOne(qemuSnapshotDiskContext *snapctxt, dd->prepared = true; if (blockdev) { - if (qemuSnapshotDiskPrepareOneBlockdev(driver, vm, dd, snapctxt->cfg, reuse, + if (qemuSnapshotDiskPrepareOneBlockdev(vm, dd, snapctxt->cfg, reuse, blockNamedNodeData, snapctxt->asyncJob) < 0) return -1; @@ -1281,7 +1280,7 @@ qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt) if (snapctxt->ndd == 0) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, snapctxt->vm, snapctxt->asyncJob) < 0) + if (qemuDomainObjEnterMonitorAsync(snapctxt->vm, snapctxt->asyncJob) < 0) return -1; rc = qemuMonitorTransaction(priv->mon, &snapctxt->actions); @@ -1367,7 +1366,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) { int frozen; - if (qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) < 0) + if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) { @@ -1513,7 +1512,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, } if (thaw && - qemuDomainObjBeginAgentJob(driver, vm, VIR_AGENT_JOB_MODIFY) >= 0 && + qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) >= 0 && virDomainObjIsActive(vm)) { /* report error only on an otherwise successful snapshot */ if (qemuSnapshotFSThaw(vm, ret == 0) < 0) @@ -1885,7 +1884,7 @@ qemuSnapshotCreateXML(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, VIR_ASYNC_JOB_SNAPSHOT, + if (qemuDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_SNAPSHOT, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT, flags) < 0) return NULL; @@ -2278,7 +2277,7 @@ qemuSnapshotRevert(virDomainObj *vm, return -1; } - if (qemuProcessBeginJob(driver, vm, + if (qemuProcessBeginJob(vm, VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT, flags) < 0) return -1; @@ -2390,7 +2389,7 @@ qemuSnapshotDelete(virDomainObj *vm, VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1); - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot))) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 133145a23a..7cbe363254 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -135,10 +135,10 @@ testQemuHotplugAttach(virDomainObj *vm, ret = qemuDomainAttachChrDevice(&driver, vm, dev); break; case VIR_DOMAIN_DEVICE_SHMEM: - ret = qemuDomainAttachShmemDevice(&driver, vm, dev->data.shmem); + ret = qemuDomainAttachShmemDevice(vm, dev->data.shmem); break; case VIR_DOMAIN_DEVICE_WATCHDOG: - ret = qemuDomainAttachWatchdog(&driver, vm, dev->data.watchdog); + ret = qemuDomainAttachWatchdog(vm, dev->data.watchdog); break; case VIR_DOMAIN_DEVICE_HOSTDEV: ret = qemuDomainAttachHostDevice(&driver, vm, dev->data.hostdev); @@ -459,7 +459,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.37.1