[libvirt] [PATCH] Fix ejecting cdroms with latest qemu syntax

Cole Robinson crobinso at redhat.com
Wed Sep 3 16:20:56 UTC 2008


Cole Robinson wrote:
> Jim Meyering wrote:
>> Cole Robinson <crobinso at redhat.com> wrote:
>> ...
>>> Okay, second cut attached. I followed your recommendations:
>> ...
>>
>> With all of Dan's comments addressed, this should be fine.
>>
>>> diff --git a/src/domain_conf.c b/src/domain_conf.c
>> ...
>>> +int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
>> ...
>>> +    switch (disk->bus) {
>>> +        case VIR_DOMAIN_DISK_BUS_IDE:
>>> +            *busIdx = ((idx - (idx % 2)) / 2);
>>> +            *devIdx = (idx % 2);
>>> +            break;
>>> +        case VIR_DOMAIN_DISK_BUS_SCSI:
>>> +            *busIdx = ((idx - (idx % 7)) / 7);
>>> +            *devIdx = (idx % 7);
>>> +            break;
>> It doesn't affect correctness, but you can remove the
>> unnecessary "- (idx % 2)" and "- (idx % 7)" expressions:
>>
>>     switch (disk->bus) {
>>         case VIR_DOMAIN_DISK_BUS_IDE:
>>             *busIdx = idx / 2;
>>             *devIdx = idx % 2;
>>             break;
>>         case VIR_DOMAIN_DISK_BUS_SCSI:
>>             *busIdx = idx / 7;
>>             *devIdx = idx % 7;
>>             break;
> 
> Okay, latest cut. This addresses the above piece pointed out
> by Jim and all of Dan's comments.
> 
> Thanks,
> Cole
> 

I've committed this latest version.

Thanks,
Cole




More information about the libvir-list mailing list