mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: monitor: Remove unused qemuMonitorAddDrive/qemuMonitorDriveDel
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f933745a49
commit
8c8cce7188
@ -2555,26 +2555,6 @@ qemuMonitorGetChardevInfo(qemuMonitor *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(qemuMonitor *mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
VIR_DEBUG("drivestr=%s", drivestr);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
/* there won't be a direct replacement for drive_del in QMP */
|
||||
return qemuMonitorTextDriveDel(mon, drivestr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @mon: monitor object
|
||||
* @devalias: alias of the device to detach
|
||||
@ -2746,19 +2726,6 @@ qemuMonitorDelObject(qemuMonitor *mon,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorAddDrive(qemuMonitor *mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
VIR_DEBUG("drive=%s", drivestr);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
/* there won't ever be a direct QMP replacement for this function */
|
||||
return qemuMonitorTextAddDrive(mon, drivestr);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name)
|
||||
{
|
||||
|
@ -951,12 +951,6 @@ int qemuMonitorDelObject(qemuMonitor *mon,
|
||||
const char *objalias,
|
||||
bool report_error);
|
||||
|
||||
int qemuMonitorAddDrive(qemuMonitor *mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorDriveDel(qemuMonitor *mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name);
|
||||
int qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name);
|
||||
|
||||
|
@ -31,88 +31,6 @@
|
||||
|
||||
VIR_LOG_INIT("qemu.qemu_monitor_text");
|
||||
|
||||
int qemuMonitorTextAddDrive(qemuMonitor *mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
g_autofree char *cmd = NULL;
|
||||
g_autofree char *reply = NULL;
|
||||
|
||||
/* 'dummy' here is just a placeholder since there is no PCI
|
||||
* address required when attaching drives to a controller */
|
||||
cmd = g_strdup_printf("drive_add dummy %s", drivestr);
|
||||
|
||||
if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0)
|
||||
return -1;
|
||||
|
||||
if (strstr(reply, "unknown command:")) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("drive hotplug is not supported"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strstr(reply, "could not open disk image")) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("open disk image file failed"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strstr(reply, "Could not open")) {
|
||||
size_t len = strlen(reply);
|
||||
if (reply[len - 1] == '\n')
|
||||
reply[len - 1] = '\0';
|
||||
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
reply);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strstr(reply, "Image is not in")) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Incorrect disk format"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strstr(reply, "IOMMU") ||
|
||||
strstr(reply, "VFIO")) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
reply);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int qemuMonitorTextDriveDel(qemuMonitor *mon,
|
||||
const char *drivestr)
|
||||
{
|
||||
g_autofree char *cmd = NULL;
|
||||
g_autofree char *reply = NULL;
|
||||
|
||||
cmd = g_strdup_printf("drive_del %s", drivestr);
|
||||
|
||||
if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0)
|
||||
return -1;
|
||||
|
||||
if (strstr(reply, "unknown command:")) {
|
||||
VIR_ERROR(_("deleting drive is not supported. "
|
||||
"This may leak data if disk is reassigned"));
|
||||
return 1;
|
||||
|
||||
/* (qemu) drive_del wark
|
||||
* Device 'wark' not found */
|
||||
} else if (strstr(reply, "Device '") && strstr(reply, "not found")) {
|
||||
/* NB: device not found errors mean the drive was auto-deleted and we
|
||||
* ignore the error */
|
||||
} else if (STRNEQ(reply, "")) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("deleting %s drive failed: %s"), drivestr, reply);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorTextCreateSnapshot(qemuMonitor *mon,
|
||||
const char *name)
|
||||
|
@ -25,11 +25,5 @@
|
||||
|
||||
#include "qemu_monitor.h"
|
||||
|
||||
int qemuMonitorTextAddDrive(qemuMonitor *mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorTextDriveDel(qemuMonitor *mon,
|
||||
const char *drivestr);
|
||||
|
||||
int qemuMonitorTextCreateSnapshot(qemuMonitor *mon, const char *name);
|
||||
int qemuMonitorTextDeleteSnapshot(qemuMonitor *mon, const char *name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user