mirror of https://gitee.com/openkylin/libvirt.git
qemu: monitor: Rename 'device' argument for block job control APIs
Starting from qemu 2.7 the 'device' argument is in fact a name of the job itself. Change our APIs accordingly and adjust the error message. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
29dd778d16
commit
ee06cd36e3
|
@ -3323,13 +3323,13 @@ qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
|
|||
/* Use the block-job-complete monitor command to pivot a block copy job. */
|
||||
int
|
||||
qemuMonitorDrivePivot(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
{
|
||||
VIR_DEBUG("device=%s", device);
|
||||
VIR_DEBUG("jobname=%s", jobname);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONDrivePivot(mon, device);
|
||||
return qemuMonitorJSONDrivePivot(mon, jobname);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3403,26 +3403,26 @@ qemuMonitorBlockStream(qemuMonitorPtr mon,
|
|||
|
||||
int
|
||||
qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
{
|
||||
VIR_DEBUG("device=%s", device);
|
||||
VIR_DEBUG("jobname=%s", jobname);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONBlockJobCancel(mon, device);
|
||||
return qemuMonitorJSONBlockJobCancel(mon, jobname);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
unsigned long long bandwidth)
|
||||
{
|
||||
VIR_DEBUG("device=%s, bandwidth=%lluB", device, bandwidth);
|
||||
VIR_DEBUG("jobname=%s, bandwidth=%lluB", jobname, bandwidth);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONBlockJobSetSpeed(mon, device, bandwidth);
|
||||
return qemuMonitorJSONBlockJobSetSpeed(mon, jobname, bandwidth);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ int qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
|
|||
unsigned int flags)
|
||||
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorBlockCommit(qemuMonitorPtr mon,
|
||||
|
@ -914,11 +914,11 @@ int qemuMonitorBlockStream(qemuMonitorPtr mon,
|
|||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
unsigned long long bandwidth);
|
||||
|
||||
typedef struct _qemuMonitorBlockJobInfo qemuMonitorBlockJobInfo;
|
||||
|
|
|
@ -4768,14 +4768,14 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon)
|
|||
static int
|
||||
qemuMonitorJSONBlockJobError(virJSONValuePtr cmd,
|
||||
virJSONValuePtr reply,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
{
|
||||
virJSONValuePtr error;
|
||||
|
||||
if ((error = virJSONValueObjectGet(reply, "error")) &&
|
||||
(qemuMonitorJSONErrorIsClass(error, "DeviceNotActive"))) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("No active operation on device: %s"), device);
|
||||
_("No active block job '%s'"), jobname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -4820,21 +4820,21 @@ qemuMonitorJSONBlockStream(qemuMonitorPtr mon,
|
|||
|
||||
int
|
||||
qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd = NULL;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-job-cancel",
|
||||
"s:device", device,
|
||||
"s:device", jobname,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0)
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
@ -4848,7 +4848,7 @@ qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon,
|
|||
|
||||
int
|
||||
qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
unsigned long long speed)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -4856,7 +4856,7 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
|
|||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-job-set-speed",
|
||||
"s:device", device,
|
||||
"s:device", jobname,
|
||||
"J:speed", speed,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
@ -4864,7 +4864,7 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
|
|||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0)
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
@ -4878,14 +4878,14 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
|
|||
|
||||
int
|
||||
qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
cmd = qemuMonitorJSONMakeCommand("block-job-complete",
|
||||
"s:device", device,
|
||||
"s:device", jobname,
|
||||
NULL);
|
||||
if (!cmd)
|
||||
return -1;
|
||||
|
@ -4893,7 +4893,7 @@ qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
|
|||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0)
|
||||
if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
|
|
@ -267,7 +267,7 @@ int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
|
|||
unsigned int flags)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon,
|
||||
|
@ -310,11 +310,11 @@ int qemuMonitorJSONBlockStream(qemuMonitorPtr mon,
|
|||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon,
|
||||
const char *device)
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
unsigned long long speed)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
|
|
Loading…
Reference in New Issue