[libvirt] [PATCH] Implement vol delete for disk pools

Cole Robinson crobinso at redhat.com
Sat Sep 6 03:17:27 UTC 2008

Daniel P. Berrange wrote:
> On Tue, Aug 12, 2008 at 11:58:07PM -0400, Cole Robinson wrote:
>> Daniel P. Berrange wrote:
>>> This isn't correct because the target path is not guarenteed to point to
>>> the master device name /dev/sda1.  The user could have configured it to
>>> use a stable path such as /dev/disk/by-uuid/4cb23887-0d02-4e4c-bc95-7599c85afc1a
>> Hmm, I couldn't actually get /dev/disk/by-uuid to work. Seems like the
>> vol populating code for disks doesn't take into account the the pools
>> target path, and just uses the real partition path.
> Yes it does - this is what the virStorageBackendStablePath() method call
> does.  What I expect is going on is that you merely created a bunch of
> partitions, but don't have any filesystems formatted in them. The UUID
> stuff is actually the UUID of the filesystem. If you try with a target
> path of /dev/disk/by-path  you'll probably have more luck. If it can't
> find a stable path under the target you give, it automatically falls
> back to the generic /dev/sdXX path.
> The following config should show it in action
> <pool type='disk'>
>   <name>mydisk</name>
>   <source>
>     <device path='/dev/sda'>
>     </device>
>   </source>
>   <target>
>     <path>/dev/disk/by-path</path>
>   </target>
> </pool>
> Daniel

Alright! I've managed to get this working. The attached
patch has no problem deleting disk volumes if using
by-path, by-uuid, or typical /dev.

One hiccup I ran into is that by-uuid symlinks point to
../../sdfoo, rather than explictly /dev/sdfoo, hence the
use of basename in this patch.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libvirt-delete-disk-vol-03-patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080905/bad108d1/attachment-0001.ksh>

More information about the libvir-list mailing list