migration: introduce a delete_snapshot wrapper

Make snapshot deletion consistent with the snapshot save
and load commands by using a wrapper around the blockdev
layer. The main difference is that we get upfront validation
of the passed in device list (if any).

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210204124834.774401-10-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:31 +00:00 committed by Dr. David Alan Gilbert
parent f1a9fcdd01
commit bef7e9e2c7
3 changed files with 28 additions and 1 deletions

View file

@ -48,4 +48,17 @@ bool load_snapshot(const char *name,
bool has_devices, strList *devices,
Error **errp);
/**
* delete_snapshot: Delete a snapshot.
* @name: path to snapshot
* @has_devices: whether to use explicit device list
* @devices: explicit device list to snapshot
* @errp: pointer to error object
* On success, return %true.
* On failure, store an error through @errp and return %false.
*/
bool delete_snapshot(const char *name,
bool has_devices, strList *devices,
Error **errp);
#endif