[libvirt] [PATCH] virsh: Add VSH_OFLAG_EMPTY_OK for attach-disk command

Osier Yang jyang at redhat.com
Wed Nov 9 03:05:19 UTC 2011


On 11/09/2011 10:34 AM, Xu He Jie wrote:
> 于 2011年11月09日 07:08, Eric Blake 写道:
>> On 11/08/2011 12:16 AM, Xu He Jie wrote:
>>> As the description of removing CDROM media from
>>> http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV
>>
>> Hmm.
>> virsh attach-disk --type cdrom --mode readonly myguest "" hdc
>> might look a bit nicer as:
>> virsh attach-disk --type cdrom --mode readonly myguest --target hdc
>> except that we marked --source as a required argument, so we have to 
>> provide something even when there is no real source. So I agree that 
>> we need your patch at a bare minimum to support this documented 
>> command line for adding a cdrom drive without a disk.
> Is there any other method of removing media from cdrom? I try with:
> detach-disk myguest hdc

This will detach the CD drive from guest, for just removing the media,
"update-device $domain xml" with the source path removed in the xml
will work.

We planned to add some new virsh commands such as "insert-media",
"eject-media" before to do the work, as "update-device" is not quite
visiable, and question like this are frequent in upstream, but 
unfortunately,
it's not implemented yet.

> It told me: 'unsupported configuration: device type 'disk' cannot be 
> detached'

Is this the exact error you saw, it's weried if a device of type disk 
can't be
detached. The error expected should be something like:

"unsupported configuration: device type of 'cdrom' cannot be detached"

Regards
Osier





More information about the libvir-list mailing list