mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:03:48 +03:00
qemu: monitor: Remove qemuMonitorSupportsActiveCommit
Modern code uses QMP schema to query for active commit support. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
5c455694ab
commit
318fab456d
@ -3280,17 +3280,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Probe whether active commits are supported by a given qemu binary. */
|
|
||||||
bool
|
|
||||||
qemuMonitorSupportsActiveCommit(qemuMonitor *mon)
|
|
||||||
{
|
|
||||||
if (!mon)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return qemuMonitorJSONSupportsActiveCommit(mon);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Determine the name that qemu is using for tracking the backing
|
/* Determine the name that qemu is using for tracking the backing
|
||||||
* element TARGET within the chain starting at TOP. */
|
* element TARGET within the chain starting at TOP. */
|
||||||
char *
|
char *
|
||||||
|
@ -1046,7 +1046,6 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
|
|||||||
const char *backingName,
|
const char *backingName,
|
||||||
unsigned long long bandwidth)
|
unsigned long long bandwidth)
|
||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
bool qemuMonitorSupportsActiveCommit(qemuMonitor *mon);
|
|
||||||
char *qemuMonitorDiskNameLookup(qemuMonitor *mon,
|
char *qemuMonitorDiskNameLookup(qemuMonitor *mon,
|
||||||
const char *device,
|
const char *device,
|
||||||
virStorageSource *top,
|
virStorageSource *top,
|
||||||
|
@ -4726,39 +4726,6 @@ qemuMonitorJSONTransaction(qemuMonitor *mon, virJSONValue **actions)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Probe if active commit is supported: pass in a bogus device and NULL top
|
|
||||||
* and base. The probe return is true if active commit is detected or false
|
|
||||||
* if not supported or on any error */
|
|
||||||
bool
|
|
||||||
qemuMonitorJSONSupportsActiveCommit(qemuMonitor *mon)
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
virJSONValue *cmd;
|
|
||||||
virJSONValue *reply = NULL;
|
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-commit", "s:device",
|
|
||||||
"bogus", NULL)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
|
|
||||||
VIR_DEBUG("block-commit supports active commit");
|
|
||||||
ret = true;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is a false negative for qemu 2.0; but probably not
|
|
||||||
* worth the additional complexity to worry about it */
|
|
||||||
VIR_DEBUG("block-commit requires 'top' parameter, "
|
|
||||||
"assuming it lacks active commit");
|
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(cmd);
|
|
||||||
virJSONValueFree(reply);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* speed is in bytes/sec. Returns 0 on success, -1 with error message
|
/* speed is in bytes/sec. Returns 0 on success, -1 with error message
|
||||||
* emitted on failure. */
|
* emitted on failure. */
|
||||||
|
@ -276,9 +276,6 @@ int qemuMonitorJSONDrivePivot(qemuMonitor *mon,
|
|||||||
const char *jobname)
|
const char *jobname)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
bool qemuMonitorJSONSupportsActiveCommit(qemuMonitor *mon)
|
|
||||||
ATTRIBUTE_NONNULL(1);
|
|
||||||
|
|
||||||
int qemuMonitorJSONBlockCommit(qemuMonitor *mon,
|
int qemuMonitorJSONBlockCommit(qemuMonitor *mon,
|
||||||
const char *device,
|
const char *device,
|
||||||
const char *jobname,
|
const char *jobname,
|
||||||
|
@ -2145,49 +2145,6 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
|
|
||||||
{
|
|
||||||
const testGenericData *data = opaque;
|
|
||||||
virDomainXMLOption *xmlopt = data->xmlopt;
|
|
||||||
const char *error1 =
|
|
||||||
"{"
|
|
||||||
" \"error\": {"
|
|
||||||
" \"class\": \"DeviceNotFound\","
|
|
||||||
" \"desc\": \"Device 'bogus' not found\""
|
|
||||||
" }"
|
|
||||||
"}";
|
|
||||||
const char *error2 =
|
|
||||||
"{"
|
|
||||||
" \"error\": {"
|
|
||||||
" \"class\": \"GenericError\","
|
|
||||||
" \"desc\": \"Parameter 'top' is missing\""
|
|
||||||
" }"
|
|
||||||
"}";
|
|
||||||
g_autoptr(qemuMonitorTest) test = NULL;
|
|
||||||
|
|
||||||
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (qemuMonitorTestAddItemParams(test, "block-commit", error1,
|
|
||||||
"device", "\"bogus\"",
|
|
||||||
NULL, NULL) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (qemuMonitorTestAddItemParams(test, "block-commit", error2,
|
|
||||||
"device", "\"bogus\"",
|
|
||||||
NULL, NULL) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaque)
|
testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaque)
|
||||||
{
|
{
|
||||||
@ -3136,7 +3093,6 @@ mymain(void)
|
|||||||
DO_TEST(qemuMonitorJSONSendKey);
|
DO_TEST(qemuMonitorJSONSendKey);
|
||||||
DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability);
|
DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability);
|
||||||
DO_TEST(qemuMonitorJSONSendKeyHoldtime);
|
DO_TEST(qemuMonitorJSONSendKeyHoldtime);
|
||||||
DO_TEST(qemuMonitorSupportsActiveCommit);
|
|
||||||
DO_TEST(qemuMonitorJSONNBDServerStart);
|
DO_TEST(qemuMonitorJSONNBDServerStart);
|
||||||
|
|
||||||
DO_TEST_CPU_DATA("host");
|
DO_TEST_CPU_DATA("host");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user