qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 10/10] qemu-iotests/118: Test media


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 10/10] qemu-iotests/118: Test media change with qdev name
Date: Thu, 15 Sep 2016 11:33:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 09/15/2016 11:28 AM, Sascha Silbe wrote:
> Dear Eric,
> 
> Sascha Silbe <address@hidden> writes:
> 
>>         result = self.vm.qmp('blockdev-change-medium',
>>                              id=self.device_name or 'drive0', 
>> filename=new_img,
>>                              format=iotests.imgfmt)
> 
> Sorry, my eyes deceived me. I thought the original code was setting the
> "id" parameter in both cases. QEMUMachine.qmp() and
> QEMUMonitorProtocol.cmd() together translate the keyword arguments
> directly into QMP arguments, so passing None is different from not
> passing anything at all. The if/else is probably the best approach in
> that case; everything else I can think of would just be more
> complicated.

If there were some way to do:

arglist = (all other parameters)
if self.device_name:
    arglist.append(id=self.device_name)
else:
    arglist.append(device='drive0')
invoke(self.vm.qmp, arglist)

that might be a little cleaner (no repetition on all the other
parameters); but I don't know enough python to know if there is some
sort of invoke() mechanism for pairing a method object and an arbitrary
list as though it were a normal method call (I suspect there is, and I
just don't know it).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]