mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: monitor: Avoid ternary operators in helpers for drive/blockdev-mirror
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b3bff3df78
commit
6fbf8873c0
@ -4262,6 +4262,14 @@ qemuMonitorJSONDriveMirror(qemuMonitor *mon,
|
|||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) cmd = NULL;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
g_autoptr(virJSONValue) reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
|
const char *syncmode = "full";
|
||||||
|
const char *mode = "absolute-paths";
|
||||||
|
|
||||||
|
if (shallow)
|
||||||
|
syncmode = "top";
|
||||||
|
|
||||||
|
if (reuse)
|
||||||
|
mode = "existing";
|
||||||
|
|
||||||
cmd = qemuMonitorJSONMakeCommand("drive-mirror",
|
cmd = qemuMonitorJSONMakeCommand("drive-mirror",
|
||||||
"s:device", device,
|
"s:device", device,
|
||||||
@ -4269,8 +4277,8 @@ qemuMonitorJSONDriveMirror(qemuMonitor *mon,
|
|||||||
"Y:speed", speed,
|
"Y:speed", speed,
|
||||||
"z:granularity", granularity,
|
"z:granularity", granularity,
|
||||||
"P:buf-size", buf_size,
|
"P:buf-size", buf_size,
|
||||||
"s:sync", shallow ? "top" : "full",
|
"s:sync", syncmode,
|
||||||
"s:mode", reuse ? "existing" : "absolute-paths",
|
"s:mode", mode,
|
||||||
"S:format", format,
|
"S:format", format,
|
||||||
NULL);
|
NULL);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
@ -4298,6 +4306,10 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon,
|
|||||||
g_autoptr(virJSONValue) reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT;
|
virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT;
|
||||||
virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT;
|
virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT;
|
||||||
|
const char *syncmode = "full";
|
||||||
|
|
||||||
|
if (shallow)
|
||||||
|
syncmode = "top";
|
||||||
|
|
||||||
if (persistjob) {
|
if (persistjob) {
|
||||||
autofinalize = VIR_TRISTATE_BOOL_YES;
|
autofinalize = VIR_TRISTATE_BOOL_YES;
|
||||||
@ -4311,7 +4323,7 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon,
|
|||||||
"Y:speed", speed,
|
"Y:speed", speed,
|
||||||
"z:granularity", granularity,
|
"z:granularity", granularity,
|
||||||
"P:buf-size", buf_size,
|
"P:buf-size", buf_size,
|
||||||
"s:sync", shallow ? "top" : "full",
|
"s:sync", syncmode,
|
||||||
"T:auto-finalize", autofinalize,
|
"T:auto-finalize", autofinalize,
|
||||||
"T:auto-dismiss", autodismiss,
|
"T:auto-dismiss", autodismiss,
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user