qemu: monitor: Remove unused qemuMonitorDiskNameLookup

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:
Peter Krempa 2022-07-20 12:42:14 +02:00
parent d926d7b4c9
commit 50d1c5715b
4 changed files with 0 additions and 104 deletions

View File

@ -2879,20 +2879,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
}
/* Determine the name that qemu is using for tracking the backing
* element TARGET within the chain starting at TOP. */
char *
qemuMonitorDiskNameLookup(qemuMonitor *mon,
const char *device,
virStorageSource *top,
virStorageSource *target)
{
QEMU_CHECK_MONITOR_NULL(mon);
return qemuMonitorJSONDiskNameLookup(mon, device, top, target);
}
/* Use the block-job-complete monitor command to pivot a block copy job. */
int
qemuMonitorDrivePivot(qemuMonitor *mon,

View File

@ -998,11 +998,6 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
const char *backingName,
unsigned long long bandwidth)
ATTRIBUTE_NONNULL(2);
char *qemuMonitorDiskNameLookup(qemuMonitor *mon,
const char *device,
virStorageSource *top,
virStorageSource *target)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
int qemuMonitorArbitraryCommand(qemuMonitor *mon,
const char *cmd,

View File

@ -4180,83 +4180,6 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
return 0;
}
static char *
qemuMonitorJSONDiskNameLookupOne(virJSONValue *image,
virStorageSource *top,
virStorageSource *target)
{
virJSONValue *backing;
char *ret;
/* The caller will report a generic message if we return NULL
* without an error; but in some cases we can improve by reporting
* a more specific message. */
if (!top || !image)
return NULL;
if (top != target) {
backing = virJSONValueObjectGetObject(image, "backing-image");
return qemuMonitorJSONDiskNameLookupOne(backing, top->backingStore,
target);
}
ret = g_strdup(virJSONValueObjectGetString(image, "filename"));
/* Sanity check - the name qemu gave us should resolve to the same
file tracked by our target description. */
if (virStorageSourceIsLocalStorage(target) &&
STRNEQ(ret, target->path) &&
!virFileLinkPointsTo(ret, target->path)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("qemu block name '%s' doesn't match expected '%s'"),
ret, target->path);
VIR_FREE(ret);
}
return ret;
}
char *
qemuMonitorJSONDiskNameLookup(qemuMonitor *mon,
const char *device,
virStorageSource *top,
virStorageSource *target)
{
g_autoptr(virJSONValue) devices = NULL;
size_t i;
if (!(devices = qemuMonitorJSONQueryBlock(mon)))
return NULL;
for (i = 0; i < virJSONValueArraySize(devices); i++) {
virJSONValue *dev;
virJSONValue *inserted;
virJSONValue *image;
const char *thisdev;
if (!(dev = qemuMonitorJSONGetBlockDev(devices, i)))
return NULL;
if (!(thisdev = qemuMonitorJSONGetBlockDevDevice(dev)))
return NULL;
if (STREQ(thisdev, device)) {
if ((inserted = virJSONValueObjectGetObject(dev, "inserted")) &&
(image = virJSONValueObjectGetObject(inserted, "image"))) {
return qemuMonitorJSONDiskNameLookupOne(image, top, target);
}
}
}
/* Guarantee an error when returning NULL, but don't override a
* more specific error if one was already generated. */
if (virGetLastErrorCode() == VIR_ERR_OK) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to find backing name for device %s"),
device);
}
return NULL;
}
int qemuMonitorJSONArbitraryCommand(qemuMonitor *mon,
const char *cmd_str,
int fd,

View File

@ -333,14 +333,6 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
unsigned long long bandwidth)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
char *
qemuMonitorJSONDiskNameLookup(qemuMonitor *mon,
const char *device,
virStorageSource *top,
virStorageSource *target)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4);
int
qemuMonitorJSONArbitraryCommand(qemuMonitor *mon,
const char *cmd_str,