Disable external snapshot of readonly disk for inactive domains
as this operation is not very useful. As to active domains
such snapshot was not possible before already but error message was
not helpful so now it will be better.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
Diff from v1 [1]
================
- move check to qemuDomainSnapshotPrepareDiskExternal
- disable such snapshot for inactive domain as well
[1] [PATCH] qemu: snapshot: better error for active external readonly disk
https://www.redhat.com/archives/libvir-list/2018-October/msg01322.html
continues in
https://www.redhat.com/archives/libvir-list/2018-November/msg00265.html
src/qemu/qemu_driver.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e249..e747a5b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14514,6 +14514,13 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
int ret = -1;
struct stat st;
+ if (disk->src->readonly) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external snapshot for readonly disk %s "
+ "is not supported"), disk->dst);
+ return -1;
+ }
+
if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0)
return -1;
--
1.8.3.1