mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Remove special case for virDomainBlockStats
Like other query commands, this can now be called directly during migration.
This commit is contained in:
parent
fb3cada0a0
commit
90feb02dd0
@ -76,15 +76,11 @@ enum qemuDomainJobSignals {
|
||||
QEMU_JOB_SIGNAL_SUSPEND = 1 << 1, /* Request VM suspend to finish live migration offline */
|
||||
QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME = 1 << 2, /* Request migration downtime change */
|
||||
QEMU_JOB_SIGNAL_MIGRATE_SPEED = 1 << 3, /* Request migration speed change */
|
||||
QEMU_JOB_SIGNAL_BLKSTAT = 1 << 4, /* Request blkstat during migration */
|
||||
};
|
||||
|
||||
struct qemuDomainJobSignalsData {
|
||||
unsigned long long migrateDowntime; /* Data for QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME */
|
||||
unsigned long migrateBandwidth; /* Data for QEMU_JOB_SIGNAL_MIGRATE_SPEED */
|
||||
char *statDevName; /* Device name used by blkstat calls */
|
||||
virDomainBlockStatsPtr blockStat; /* Block statistics for QEMU_JOB_SIGNAL_BLKSTAT */
|
||||
int *statRetCode; /* Return code for the blkstat calls */
|
||||
};
|
||||
|
||||
struct qemuDomainJobObj {
|
||||
|
@ -6634,46 +6634,28 @@ qemudDomainBlockStats (virDomainPtr dom,
|
||||
}
|
||||
|
||||
priv = vm->privateData;
|
||||
if ((priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
|
||||
|| (priv->job.asyncJob == QEMU_ASYNC_JOB_SAVE)) {
|
||||
virDomainObjRef(vm);
|
||||
while (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT)
|
||||
ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
priv->job.signalsData.statDevName = disk->info.alias;
|
||||
priv->job.signalsData.blockStat = stats;
|
||||
priv->job.signalsData.statRetCode = &ret;
|
||||
priv->job.signals |= QEMU_JOB_SIGNAL_BLKSTAT;
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
while (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT)
|
||||
ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
|
||||
|
||||
if (virDomainObjUnref(vm) == 0)
|
||||
vm = NULL;
|
||||
} else {
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
ignore_value(qemuDomainObjEnterMonitor(driver, vm));
|
||||
ret = qemuMonitorGetBlockStatsInfo(priv->mon,
|
||||
disk->info.alias,
|
||||
&stats->rd_req,
|
||||
&stats->rd_bytes,
|
||||
&stats->wr_req,
|
||||
&stats->wr_bytes,
|
||||
&stats->errs);
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
ignore_value(qemuDomainObjEnterMonitor(driver, vm));
|
||||
ret = qemuMonitorGetBlockStatsInfo(priv->mon,
|
||||
disk->info.alias,
|
||||
&stats->rd_req,
|
||||
&stats->rd_bytes,
|
||||
&stats->wr_req,
|
||||
&stats->wr_bytes,
|
||||
&stats->errs);
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
|
||||
endjob:
|
||||
if (qemuDomainObjEndJob(driver, vm) == 0)
|
||||
vm = NULL;
|
||||
}
|
||||
if (qemuDomainObjEndJob(driver, vm) == 0)
|
||||
vm = NULL;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
|
@ -801,24 +801,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
|
||||
}
|
||||
if (ret < 0)
|
||||
VIR_WARN("Unable to set migration speed");
|
||||
} else if (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT) {
|
||||
ret = qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorGetBlockStatsInfo(priv->mon,
|
||||
priv->job.signalsData.statDevName,
|
||||
&priv->job.signalsData.blockStat->rd_req,
|
||||
&priv->job.signalsData.blockStat->rd_bytes,
|
||||
&priv->job.signalsData.blockStat->wr_req,
|
||||
&priv->job.signalsData.blockStat->wr_bytes,
|
||||
&priv->job.signalsData.blockStat->errs);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
}
|
||||
|
||||
*priv->job.signalsData.statRetCode = ret;
|
||||
priv->job.signals ^= QEMU_JOB_SIGNAL_BLKSTAT;
|
||||
|
||||
if (ret < 0)
|
||||
VIR_WARN("Unable to get block statistics");
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user