[libvirt] [PATCH v4 0/4] Add startupPolicy attribute support for hard disks

Guannan Ren gren at redhat.com
Mon Jul 15 13:30:12 UTC 2013


On 07/02/2013 05:35 PM, Guannan Ren wrote:
> v3: https://www.redhat.com/archives/libvir-list/2013-June/thread.html
>
> v3 to v4: Rebase
>
> v2 to v3: Not only check disk source, startupPolicy should work if any
>            backing file is missing. The commit 039a3283 break the limition
>            of contiguous device boot orders, so I remove my previous patch
>            about it.
>
> v1 to v2: Added relax schema for disk of block and dir type
>            Removed original patch 3/5.
>
> The set of patches is trying to add 'startupPolicy' attribute support
> to the source element of hard disks. Policy levels are using the
> mandatory, requisite, optional levels as originally documented.
>
> For the 'optional' policy, there is a little difference from CDROM and
> Floppy which only drop its source path, for disks, if missing, the
> checking function will drop their definitions, because qemu doesn't
> allow missing source path for hard disk.
>

Are we going to support this feature. I think this is a good feature for 
two reasons:

1, currently, we only check the disk presence for floppy and CDROM 
device which is not enough.
For disks with backing files, if one of its backing file is missing,  
libvirt doesn't check anything, the qemu
will throw an unclear error message as follows:

A guest with a  disk image /var/lib/libvirt/images/snapshot/snap2.qcow

# qemu-img info --backing-chain /var/lib/libvirt/images/snapshot/snap2.qcow
image: /var/lib/libvirt/images/snapshot/snap2.qcow
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 19M
cluster_size: 65536
backing file: /var/lib/libvirt/images/snapshot/snap1.qcow
backing file format: qcow2

image: /var/lib/libvirt/images/snapshot/snap1.qcow
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 196K
cluster_size: 65536
backing file: /var/lib/libvirt/images/fedora18.img
backing file format: raw

if we change snap1.qcow  to  *snap1.qcow.back* , then bootup the guest
The qemu will throw an error:
qemu-system-x86_64: -drive 
file=/var/lib/libvirt/images/snapshot/snap2.qcow,if=none,id=drive-virtio-disk0,format=qcow2: 
could not open disk image /var/lib/libvirt/images/snapshot/snap2.qcow: 
No such file or directory

Actually, snap2.qcow is there, one of its backing file snap1.qcow is 
missing. So we need to check the presence of all files in disk chains.
With this patch, libvirt will throw an error:
error: Backing file '/var/lib/libvirt/images/snapshot/snap1.qcow' does 
not exist: No such file or directory

2, Adding 'startupPolicy' attribute for guest disk is useful for guests 
which use the disk from storage-centric production environment.
Guest uses the the block disk assigned by Fibre channel or FCoE or ISCSI 
storage. The storage administrator can adjust the disk assignment
between guests, if guest disk with startupPolicy value of optional, 
guest still can boot up after its assigned disks are missing.

So I think it is good to add this flexibility to disk configuration for 
guests. Any thoughts?

Guannan





More information about the libvir-list mailing list