On Wed, Jun 26, 2019 at 14:05:41 +0800, Liu Dayu wrote: > virsh snapshot-create-as supports 'file' storage type in --diskspec by default. > It doesn't support 'block' storage type in the process of virshParseSnapshotDiskspec(). > So if a snapshot on a block device (e.g. LV) was created, the type of current running > storage source in dumpxml is inconsistent with the actual backend storage source. > It will check file-system type mismatch failed and return an error message of > 'Migration without shared storage is unsafe' when VM performs a live migration > after this snapshot. > > Signed-off-by: Liu Dayu <liu.dayu@xxxxxxxxxx> > --- > tools/virsh-snapshot.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c > index f6bb38b..f9c55e0 100644 > --- a/tools/virsh-snapshot.c > +++ b/tools/virsh-snapshot.c > @@ -255,6 +255,8 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str) > char **array = NULL; > int narray; > size_t i; > + struct stat st; > + int stor_type = VIR_STORAGE_TYPE_NONE; > > narray = vshStringToArray(str, &array); > if (narray <= 0) > @@ -272,16 +274,29 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str) > goto cleanup; > } > > + /* possibly update storage type */ > + if (file && STRPREFIX(file, "/dev/") && stat(file, &st) == 0 && S_ISBLK(st.st_mode)) virsh has to be able to work remotely so this code will definitely not be acceptable here. I think we can only go with adding a "type" field for the diskspec string which will be either "file" or "block" and do this in that case. e.g. --diskspec vda,snapshot=external,driver=qcow2,type=block,file=/dev/whatever
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list