mirror of https://gitee.com/openkylin/libvirt.git
qemuDomainAttachDiskGenericTransient: Add NULL check in case the overlay disk already exists
When <transient shareBacking='yes'> is set to a disk and the overlay
disk already exists because of something abnormal, libvirt is terminated
by Segmentation fault.
# virsh start Test0
error: Disconnected from qemu:///system due to end of file
error: Failed to start domain 'Test0'
error: End of file while reading data: Input/output error
Add NULL check for snapdiskdef so that the rollback can work correctly.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Fixes: 2e94002d2a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b1164a8e68
commit
e2373bd27f
|
@ -695,7 +695,9 @@ qemuDomainAttachDiskGenericTransient(virDomainObj *vm,
|
|||
g_autoptr(qemuSnapshotDiskContext) snapctxt = NULL;
|
||||
g_autoptr(virDomainSnapshotDiskDef) snapdiskdef = NULL;
|
||||
|
||||
snapdiskdef = qemuSnapshotGetTransientDiskDef(disk, vm->def->name);
|
||||
if (!(snapdiskdef = qemuSnapshotGetTransientDiskDef(disk, vm->def->name)))
|
||||
return NULL;
|
||||
|
||||
snapctxt = qemuSnapshotDiskContextNew(1, vm, asyncJob);
|
||||
|
||||
if (qemuSnapshotDiskPrepareOne(snapctxt, disk, snapdiskdef,
|
||||
|
|
Loading…
Reference in New Issue