mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
qemu: monitor: Remove JSON impls of drive_add and drive_del
qemu won't ever add those functions directly to QMP. They will be replaced with 'blockdev-add' and 'blockdev-del' eventually. At this time there's no need to keep the stubs around. Additionally the drive_del stub in JSON contained dead code in the attempt to report errors. (VIR_ERR_OPERATION_UNSUPPORTED was never reported). Since the text impl does have the same message it is reported anyways.
This commit is contained in:
parent
552bf13f45
commit
9f7d9891f0
@ -2797,6 +2797,13 @@ qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuMonitorDriveDel:
|
||||
* @mon: monitor object
|
||||
* @drivestr: identifier of drive to delete.
|
||||
*
|
||||
* Attempts to remove a host drive.
|
||||
* Returns 1 if unsupported, 0 if ok, and -1 on other failure */
|
||||
int
|
||||
qemuMonitorDriveDel(qemuMonitorPtr mon,
|
||||
const char *drivestr)
|
||||
@ -2805,10 +2812,8 @@ qemuMonitorDriveDel(qemuMonitorPtr mon,
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
if (mon->json)
|
||||
return qemuMonitorJSONDriveDel(mon, drivestr);
|
||||
else
|
||||
return qemuMonitorTextDriveDel(mon, drivestr);
|
||||
/* there won't be a direct replacement for drive_del in QMP */
|
||||
return qemuMonitorTextDriveDel(mon, drivestr);
|
||||
}
|
||||
|
||||
|
||||
@ -2911,10 +2916,8 @@ qemuMonitorAddDrive(qemuMonitorPtr mon,
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
if (mon->json)
|
||||
return qemuMonitorJSONAddDrive(mon, drivestr);
|
||||
else
|
||||
return qemuMonitorTextAddDrive(mon, drivestr);
|
||||
/* there won't ever be a direct QMP replacement for this function */
|
||||
return qemuMonitorTextAddDrive(mon, drivestr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3583,35 +3583,6 @@ int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
/* XXX Update to use QMP, if QMP ever adds support for drive_add */
|
||||
VIR_DEBUG("drive_add command not found, trying HMP");
|
||||
return qemuMonitorTextAddDrive(mon, drivestr);
|
||||
}
|
||||
|
||||
|
||||
int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* XXX Update to use QMP, if QMP ever adds support for drive_del */
|
||||
VIR_DEBUG("drive_del command not found, trying HMP");
|
||||
if ((ret = qemuMonitorTextDriveDel(mon, drivestr)) < 0) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
if (err && err->code == VIR_ERR_OPERATION_UNSUPPORTED) {
|
||||
VIR_ERROR("%s",
|
||||
_("deleting disk is not supported. "
|
||||
"This may leak data if disk is reassigned"));
|
||||
ret = 1;
|
||||
virResetLastError();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
|
||||
const char *alias,
|
||||
const char *passphrase)
|
||||
|
@ -230,12 +230,6 @@ int qemuMonitorJSONAddObject(qemuMonitorPtr mon,
|
||||
int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
|
||||
const char *objalias);
|
||||
|
||||
int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
|
||||
const char *alias,
|
||||
const char *passphrase);
|
||||
|
@ -2454,8 +2454,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Attempts to remove a host drive.
|
||||
* Returns 1 if unsupported, 0 if ok, and -1 on other failure */
|
||||
|
||||
int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
@ -2463,7 +2462,6 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
|
||||
char *reply = NULL;
|
||||
char *safedev;
|
||||
int ret = -1;
|
||||
VIR_DEBUG("TextDriveDel drivestr=%s", drivestr);
|
||||
|
||||
if (!(safedev = qemuMonitorEscapeArg(drivestr)))
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user