mirror of https://github.com/xemu-project/xemu.git
block: after creating a live snapshot, make old image read-only
Currently, after a live snapshot of a drive, the image that has been 'demoted' to be below the new active layer remains r/w. This patch reopens it read-only. Note that we do not check for error on the reopen(), because we will not abort the snapshots if the reopen fails. This patch depends on the bdrv_reopen() series. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
946d58be15
commit
870f5681c9
|
@ -805,6 +805,11 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
|
||||||
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
|
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
|
||||||
/* This removes our old bs from the bdrv_states, and adds the new bs */
|
/* This removes our old bs from the bdrv_states, and adds the new bs */
|
||||||
bdrv_append(states->new_bs, states->old_bs);
|
bdrv_append(states->new_bs, states->old_bs);
|
||||||
|
/* We don't need (or want) to use the transactional
|
||||||
|
* bdrv_reopen_multiple() across all the entries at once, because we
|
||||||
|
* don't want to abort all of them if one of them fails the reopen */
|
||||||
|
bdrv_reopen(states->new_bs, states->new_bs->open_flags & ~BDRV_O_RDWR,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
|
|
Loading…
Reference in New Issue