qemu: block: Add helper for generating snapshot transaction for -blockdev

For the modern use cases we are going to use 'blockdev-snapshot' instead
of 'blockdev-snapshot-sync'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-09-07 11:33:54 +02:00
parent dfc980ab97
commit 08f23b8ffa
2 changed files with 20 additions and 0 deletions

View File

@ -1886,6 +1886,21 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
}
int
qemuBlockSnapshotAddBlockdev(virJSONValuePtr actions,
virDomainDiskDefPtr disk,
virStorageSourcePtr newsrc)
{
if (qemuMonitorJSONTransactionAdd(actions, "blockdev-snapshot",
"s:node", disk->src->nodeformat,
"s:overlay", newsrc->nodeformat,
NULL) < 0)
return -1;
return 0;
}
/**
* qemuBlockStorageGetCopyOnReadProps:
* @disk: disk with copy-on-read enabled

View File

@ -163,6 +163,11 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
virStorageSourcePtr newsrc,
bool reuse);
int
qemuBlockSnapshotAddBlockdev(virJSONValuePtr actions,
virDomainDiskDefPtr disk,
virStorageSourcePtr newsrc);
int
qemuBlockStorageSourceCreateGetFormatProps(virStorageSourcePtr src,
virStorageSourcePtr backing,