[libvirt] [PATCH 1/4] virsh: Only return active domain names for detach-device-alias

Lin Ma lma at suse.com
Wed Mar 6 06:42:50 UTC 2019


On 3/5/19 4:13 PM, Michal Privoznik wrote:
> On 3/5/19 4:17 AM, Lin Ma wrote:
>> Signed-off-by: Lin Ma <lma at suse.com>
>> ---
>>   tools/virsh-domain.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>> index 5699018dcc..c8c4db1b2b 100644
>> --- a/tools/virsh-domain.c
>> +++ b/tools/virsh-domain.c
>> @@ -11939,7 +11939,7 @@ static const vshCmdInfo 
>> info_detach_device_alias[] = {
>>   };
>>     static const vshCmdOptDef opts_detach_device_alias[] = {
>> -    VIRSH_COMMON_OPT_DOMAIN_FULL(0),
>> + VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
>>       {.name = "alias",
>>        .type = VSH_OT_DATA,
>>        .flags = VSH_OFLAG_REQ,
>>
>
> Not quite. With user aliases one can detach a device from inactive XML:
>
> 1) virsh dumpxml --inactive fedora | grep -B4 -A2 ua-
> <disk type='volume' device='disk'>
>   <driver name='qemu' type='raw'/>
>   <source pool='iscsi-secret-pool' volume='unit:0:0:1' mode='host'/>
>   <target dev='vdc' bus='virtio'/>
>   <alias name='ua-disk1'/>
>   <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
> function='0x0'/>
> </disk>
>
> 2) virsh detach-device-alias --config --domain fedora --alias ua-disk1
> Device detach request sent successfully
>
> 3) virsh dumpxml --inactive fedora | grep -B4 -A2 ua- | wc -l
> 0
>
> Another sign that this is not correct is that this command has 
> --config option.
>
> Is there a bug perhaps that you're trying to fix?

Oh, My bad. Thanks for your reviewing and the correction, Please drop 
this patch.

Thanks,
Lin




More information about the libvir-list mailing list