block: add ability to specify list of blockdevs during snapshot

When running snapshot operations, there are various rules for which
blockdevs are included/excluded. While this provides reasonable default
behaviour, there are scenarios that are not well handled by the default
logic. Some of the conditions do not have a single correct answer.

Thus there needs to be a way for the mgmt app to provide an explicit
list of blockdevs to perform snapshots across. This can be achieved
by passing a list of node names that should be used.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210204124834.774401-5-berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-02-04 12:48:26 +00:00 committed by Dr. David Alan Gilbert
parent f61fe11aa6
commit cf3a74c94f
6 changed files with 159 additions and 63 deletions

View file

@ -25,7 +25,7 @@
#ifndef SNAPSHOT_H
#define SNAPSHOT_H
#include "qapi/qapi-builtin-types.h"
#define SNAPSHOT_OPT_BASE "snapshot."
#define SNAPSHOT_OPT_ID "snapshot.id"
@ -77,15 +77,25 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs,
* These functions will properly handle dataplane (take aio_context_acquire
* when appropriate for appropriate block drivers */
bool bdrv_all_can_snapshot(Error **errp);
int bdrv_all_delete_snapshot(const char *name, Error **errp);
int bdrv_all_goto_snapshot(const char *name, Error **errp);
int bdrv_all_find_snapshot(const char *name, Error **errp);
bool bdrv_all_can_snapshot(bool has_devices, strList *devices,
Error **errp);
int bdrv_all_delete_snapshot(const char *name,
bool has_devices, strList *devices,
Error **errp);
int bdrv_all_goto_snapshot(const char *name,
bool has_devices, strList *devices,
Error **errp);
int bdrv_all_find_snapshot(const char *name,
bool has_devices, strList *devices,
Error **errp);
int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn,
BlockDriverState *vm_state_bs,
uint64_t vm_state_size,
bool has_devices,
strList *devices,
Error **errp);
BlockDriverState *bdrv_all_find_vmstate_bs(Error **errp);
BlockDriverState *bdrv_all_find_vmstate_bs(bool has_devices, strList *devices,
Error **errp);
#endif