[libvirt] [PATCH] conf: snapshot: Don't default-snapshot empty floppy drives

Eric Blake eblake at redhat.com
Thu Sep 11 16:16:56 UTC 2014


On 09/11/2014 09:47 AM, Peter Krempa wrote:
> If a floppy drive isn't selected for snapshot explicitly and is empty
> don't try to snapshot it. For external snapshots this would fail as we
> can't generate a name for the snapshot from an empty drive.

Do we need the same for cdrom drives?

> 
> Reported-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/conf/snapshot_conf.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
> index c53a66b..cbaff74 100644
> --- a/src/conf/snapshot_conf.c
> +++ b/src/conf/snapshot_conf.c
> @@ -561,7 +561,14 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
>          if (VIR_STRDUP(disk->name, def->dom->disks[i]->dst) < 0)
>              goto cleanup;
>          disk->index = i;
> -        disk->snapshot = def->dom->disks[i]->snapshot;
> +
> +        /* Don't snapshot empty floppy drives */
> +        if (def->dom->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
> +            !virDomainDiskGetSource(def->dom->disks[i]))

If we are worried about ALL empty drives, it would be simpler to just
drop the left side of the &&, making it solely a test of whether there
is currently a defined host source.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140911/7356f90a/attachment-0001.sig>


More information about the libvir-list mailing list