[libvirt] [RFC] Add flag for virsh undefine to remove/wipe the disk devices

Osier Yang jyang at redhat.com
Wed Mar 30 15:25:15 UTC 2011


于 2011年03月30日 21:58, Dave Allan 写道:
> On Wed, Mar 30, 2011 at 09:39:14PM +0800, Osier Yang wrote:
>> Hi, All
>>
>> I'm thinking to introduce a new flag (something like --remove-disks,
>> --wipe-disks) for "virsh undefine", so that the user can choose
>> whether to remove/wipe the disk devices or not, have seen this
>> requirement in many places, @libvirt-users, public #virt, and also
>> we have a bug of this function. So, IMHO this is a reasonable
>> requirement, following is the rough thoughts:
>>
>> 1) General idea.
>>     As we don't have a API which can get all the disk devices of a
>>     domain, perhaps need to write functions to parse domain xml to
>>     extract the disks' path (this is annoyed, but seems don't other
>>     way), and then lookup them by storage volume API
>>     (virStorageVolLookupByPath), and then can remove or wipe
>>     the volume by (virStorageVolDelete/virStorageVolWipe).
>>
>>     And for the disk path which doesn't belong to any storage pool,
>>     simply remove it by "unlink()"?
>>
>> 2) Which type of devices can not be removed/wiped.
>
> Any device that's read/write by the guest should be wipeable.

Hum, make sense, :-)

>
>>     * Can't delete/wipe ISCSI/SCSI vol.
>>     * Vol doesn't exists (which will throw an warning when do
>>       virStorageVolLookupByPath).
>>     * Have no write permission on the parent directory of the
>>       disk path.
>>     * Can't delete/wipe the disk device which is passthrough'ed
>>       from host, (e.g. /dev/sr0 as a CDROM device for guest)
>>     * The storage pool which the disk device belongs to as a vol
>>       is marked as "share"
>>     * The storage pool which the disk device belongs as a vol is
>>       readonly
>>     * can't delete disk device of network type.
>>     * Any others?
>>
>>     For these situations, we need to do checking and throw
>>     straightforward warnings to tell user why it can't be
>>     removed/wiped.
>>
>>     Any idea is welcomed. Thanks.
>>
>>     CC'ed Eric, as I saw you talked about this somewhere. (#virt?), :-)
>>
>> Regards
>> Osier
>>
>> --
>> libvir-list mailing list
>> libvir-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list