mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-10 07:20:02 +00:00
qemu: monitor: Use 'backing-mask-protocol' for blockjobs when available
Store whether qemu supports the appropriate option for block-stream and block-commit commands and always use it if available. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c38b4e34c8
commit
abdcb46012
@ -624,6 +624,7 @@ qemuMonitorOpenInternal(virDomainObj *vm,
|
||||
if (priv) {
|
||||
mon->objectAddNoWrap = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_JSON);
|
||||
mon->queryNamedBlockNodesFlat = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
|
||||
mon->blockjobMaskProtocol = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL);
|
||||
}
|
||||
|
||||
if (virSetCloseExec(mon->fd) < 0) {
|
||||
|
@ -4036,6 +4036,10 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO;
|
||||
virTristateBool backingProtocol = VIR_TRISTATE_BOOL_ABSENT;
|
||||
|
||||
if (mon->blockjobMaskProtocol)
|
||||
backingProtocol = VIR_TRISTATE_BOOL_YES;
|
||||
|
||||
cmd = qemuMonitorJSONMakeCommand("block-commit",
|
||||
"s:device", device,
|
||||
@ -4046,6 +4050,7 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
|
||||
"S:backing-file", backingName,
|
||||
"T:auto-finalize", autofinalize,
|
||||
"T:auto-dismiss", autodismiss,
|
||||
"T:backing-mask-protocol", backingProtocol,
|
||||
NULL);
|
||||
if (!cmd)
|
||||
return -1;
|
||||
@ -4315,6 +4320,10 @@ qemuMonitorJSONBlockStream(qemuMonitor *mon,
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
virTristateBool autofinalize = VIR_TRISTATE_BOOL_YES;
|
||||
virTristateBool autodismiss = VIR_TRISTATE_BOOL_NO;
|
||||
virTristateBool backingProtocol = VIR_TRISTATE_BOOL_ABSENT;
|
||||
|
||||
if (mon->blockjobMaskProtocol)
|
||||
backingProtocol = VIR_TRISTATE_BOOL_YES;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-stream",
|
||||
"s:device", device,
|
||||
@ -4324,6 +4333,7 @@ qemuMonitorJSONBlockStream(qemuMonitor *mon,
|
||||
"S:backing-file", backingName,
|
||||
"T:auto-finalize", autofinalize,
|
||||
"T:auto-dismiss", autodismiss,
|
||||
"T:backing-mask-protocol", backingProtocol,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
|
@ -92,6 +92,8 @@ struct _qemuMonitor {
|
||||
bool objectAddNoWrap;
|
||||
/* query-named-block-nodes supports the 'flat' option */
|
||||
bool queryNamedBlockNodesFlat;
|
||||
/* use the backing-mask-protocol flag of block-commit/stream */
|
||||
bool blockjobMaskProtocol;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user