[Libvirt-cim] [PATCH V2] Add disk device='lun' support

John Ferlan jferlan at redhat.com
Wed Jun 11 18:20:42 UTC 2014



On 06/10/2014 11:26 PM, Xu Wang wrote:
> 
> 于 2014年06月09日 19:09, John Ferlan 写道:
>>
>> On 05/27/2014 04:14 AM, Xu Wang wrote:
>>> Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one
>>> more value 'lun' should be supported by value of device field in
>>> the disk device. So this patch adds it into libvirt-cim. Now device
>>> like <disk type='block' device='lun'> could be operated by class.
>>>
>>> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
>>> ---
>>>  schema/ResourceAllocationSettingData.mof  |    8 ++++----
>>>  src/Virt_RASD.c                           |    3 +++
>>>  src/Virt_RASD.h                           |    1 +
>>>  src/Virt_SettingsDefineCapabilities.c     |    3 ++-
>>>  src/Virt_VirtualSystemManagementService.c |    5 ++++-
>>>  5 files changed, 14 insertions(+), 6 deletions(-)
>> A difference between this and your prior patch:
>>
>> --- a/src/Virt_SettingsDefineCapabilities.c
>> +++ b/src/Virt_SettingsDefineCapabilities.c
>> @@ -1071,15 +1071,14 @@ static CMPIStatus set_disk_props(int type,
>>                                        (CMPIValue *)"FV disk", CMPI_chars);
>>                  }
>>
>> -                if (emu_type == VIRT_DISK_TYPE_DISK) {
>> +                if (emu_type == VIRT_DISK_TYPE_DISK ||
>> +                    emu_type == VIRT_DISK_TYPE_LUN) {
>>                          CMSetProperty(inst, "VirtualQuantity",
>>                                        (CMPIValue *)&disk_size,
>> CMPI_uint64);
>>                  } else if (emu_type == VIRT_DISK_TYPE_CDROM) {
>>                          dev = "hdc";
>>                  } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) {
>>                          dev = "fda";
>> -                } else if (emu_type == VIRT_DISK_TYPE_LUN) {
>> -                        dev = "sda";
>>                  }
>>
>>
>>
>> leaves me with one question -
>>
>> Are you expecting the LUN type to have a dev of "hda" or "sda"?  If
>> "sda", I can fix the code and push... If "hda", I will just push...
>>
>> I actually assume you meant "sda"...
>>
>> John
>>
> Dear John,
> 
> <disk type='block' device='lun'>
>       <driver name='qemu' type='raw'/>
>       <source dev='/dev/sda'/>
>       <target dev='sda' bus='scsi'/>
>       <address type='drive' controller='0' bus='0' target='3' unit='0'/>
>     </disk>
> 
> From http://libvirt.org/formatdomain.html, I think 'sda' is a better choice.
> 
> Thanks,
>   Xu Wang

OK - the following was squashed in and pushed:

diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapa
index 49986ff..85cb27a 100644
--- a/src/Virt_SettingsDefineCapabilities.c
+++ b/src/Virt_SettingsDefineCapabilities.c
@@ -1075,6 +1075,8 @@ static CMPIStatus set_disk_props(int type,
                     emu_type == VIRT_DISK_TYPE_LUN) {
                         CMSetProperty(inst, "VirtualQuantity",
                                       (CMPIValue *)&disk_size, CMPI_uint64);
+                    if (emu_type == VIRT_DISK_TYPE_LUN)
+                        dev = "sda";
                 } else if (emu_type == VIRT_DISK_TYPE_CDROM) {
                         dev = "hdc";
                 } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) {





More information about the Libvirt-cim mailing list