[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 1/2] block: Don't allow snapshots if the overlay has
From: |
Alberto Garcia |
Subject: |
[Qemu-block] [PATCH 1/2] block: Don't allow snapshots if the overlay has parent nodes |
Date: |
Thu, 29 Oct 2015 15:00:48 +0200 |
This addresses scenarios where the overlay node of the
'blockdev-snapshot' parameter is a child of an existing node,
such as this one:
{ 'execute': 'blockdev-add', 'arguments':
{ 'options': { 'driver': 'qcow2',
'node-name': 'new0',
'file': { 'driver': 'file',
'filename': 'new.qcow2',
'node-name': 'file0' } } } }
{ 'execute': 'blockdev-snapshot', 'arguments':
{ 'node': 'virtio0',
'overlay': 'file0' } }
Signed-off-by: Alberto Garcia <address@hidden>
---
blockdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index a567a05..fcddb07 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1667,6 +1667,11 @@ static void
external_snapshot_prepare(BlkTransactionState *common,
if (state->new_bs->backing != NULL) {
error_setg(errp, "The snapshot already has a backing image");
+ return;
+ }
+
+ if (!QLIST_EMPTY(&state->new_bs->parents)) {
+ error_setg(errp, "The snapshot is already being used");
}
}
--
2.6.1