[libvirt] need some help/asdive

Daniel P. Berrange berrange at redhat.com
Sun Jun 28 15:35:55 UTC 2009


On Sun, Jun 28, 2009 at 11:07:23AM -0400, Gene Czarcinski wrote:
> Questions/problems:
> 
> My first question:  it appears to me that a guest is defined by two things -- a 
> configuration file in /etc/libvirt/qemu and one or more disk images in 
> /var/lib/libvirt/images ... is this it or are there other files I need to 
> consider?

For most people, this is sufficient, just the guest config and the disk
image(s). You can have > 1 disk image, and can share disk image between
guests if you want to get advanced.

> My second question concerns the location of the disk images:  what is the 
> "best practical way" to move these out of the root partition?  I have come up 
> with these different approaches which could/may work:
> 
> 1. change the "path" value in /etc/libvirt/storage/default.xml to point to a 
> directory in a different partition.
> 
> 2. Use a /etc/fstab entry to "bind mount" a directory in a separate partition 
> onto /var/lib/libvirt/images
> 
> 3. Just use an /etc/fstab entry to mount a partition on 
> /var/lib/libvirt/images or, perhaps, on /var/lib/libvirt. [This could be done 
> during system installation]
> 
> OK, any comments on these??

There's no real 'right' answer here, but I'd recommend 1. really.

Historically (ie <= Fedora 10), we setup /var/lib/libvirt/images by default
since that matches the 'official' location defined by the SELinux policy
and libvirt did not ever touch SELinux labels.

In Fedora 11, we introduced sVirt, and libvirt now explicitly labels disk
images to allow SELinux access. Thus, it doesn't really matter where you
keep them anymore, within reaon. The only thing that will trip you up, is
if there's something in the SELinux that prevents the guest traversing the
parent directories. 

Worst case, you can use 'semanage' to define new locations in the policy
very easily and this works for all versions of Fedora. 

So there's not really any compelling reason to bind mount, or mount partitions
at /var/lib/libvirt//images. Just update the storage pool config to point to
whereever you desir. You can create multiple storage pools too, if you wish
to keep images in several different locations. The out of the box config you
see, is just a starting point for your own usage, not a hard restriction.


> Comment:  It sure would be nice if Fedora Virtualization put all files related 
> to a guest under a single directory the way VMware does.

We can't assume people are using file based disks in their guests, not
assume a single location. So having config files in same location as the
guest images is not an appropriate model to use by default.

> Comment:  It sure would be nice if there was some system-wide configuration 
> parameter that defined where virtualization files went.

We could possibly allow for customization of the config file location 
of each libvirt driver if someone wanted to submit patches todo so...


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list