<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">于 2014年06月09日 19:09, John Ferlan 写道:<br>
    </div>
    <blockquote cite="mid:539595D7.10401@redhat.com" type="cite">
      <pre wrap="">

On 05/27/2014 04:14 AM, Xu Wang wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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 <a class="moz-txt-link-rfc2396E" href="mailto:gesaint@linux.vnet.ibm.com"><gesaint@linux.vnet.ibm.com></a>
---
 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(-)
</pre>
      </blockquote>
      <pre wrap="">
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

</pre>
    </blockquote>
    Dear John,<br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <pre xml:space="preserve" style="border: 1px solid rgb(153, 153, 153); color: rgb(0, 0, 0); padding: 1em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background: rgb(238, 238, 238);"><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></pre>
    From <a class="moz-txt-link-freetext" href="http://libvirt.org/formatdomain.html">http://libvirt.org/formatdomain.html</a>, I think 'sda' is a better
    choice.<br>
    <br>
    Thanks,<br>
      Xu Wang<br>
    <blockquote cite="mid:539595D7.10401@redhat.com" type="cite">
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
index 9c387f0..f78d423 100644
--- a/schema/ResourceAllocationSettingData.mof
+++ b/schema/ResourceAllocationSettingData.mof
@@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData
       string VirtualDevice;
 
       [Description ("Device emulation type"),
-        ValueMap {"0", "1", "2"},
-        Values {"Disk", "CDROM", "floppy"}]
+        ValueMap {"0", "1", "2", "4"},
+        Values {"Disk", "CDROM", "floppy", "lun"}]
       uint16 EmulatedType;
 
       [Description ("Bus type of the device")]
@@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData
       string VirtualDevice;
 
       [Description ("Device emulation type"),
-        ValueMap {"0", "1", "2", "3"},
-        Values {"Disk", "CDROM", "floppy", "filesystem"}]
+        ValueMap {"0", "1", "2", "3", "4"},
+        Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}]
       uint16 EmulatedType;
 
       [Description ("Bus type of the device")]
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index 3c62c2d..761d053 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
         else if ((dev->dev.disk.device != NULL) &&
                 STREQ(dev->dev.disk.device, "floppy"))
                 type = VIRT_DISK_TYPE_FLOPPY;
+        else if ((dev->dev.disk.device != NULL) &&
+                STREQ(dev->dev.disk.device, "lun"))
+                type = VIRT_DISK_TYPE_LUN;
         else
                 type = VIRT_DISK_TYPE_DISK;
 
diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h
index 400143f..49d7195 100644
--- a/src/Virt_RASD.h
+++ b/src/Virt_RASD.h
@@ -27,6 +27,7 @@
 #define VIRT_DISK_TYPE_CDROM 1
 #define VIRT_DISK_TYPE_FLOPPY 2
 #define VIRT_DISK_TYPE_FS 3
+#define VIRT_DISK_TYPE_LUN 4
 
 char *rasd_to_xml(CMPIInstance *rasd);
 
diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c
index 756e46b..49986ff 100644
--- a/src/Virt_SettingsDefineCapabilities.c
+++ b/src/Virt_SettingsDefineCapabilities.c
@@ -1071,7 +1071,8 @@ 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) {
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
index f673c38..c640360 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1114,7 +1114,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst,
                 type = VIRT_DISK_TYPE_DISK;
 
         if ((type == VIRT_DISK_TYPE_DISK) ||
-            (type == VIRT_DISK_TYPE_FS)){
+            (type == VIRT_DISK_TYPE_FS) ||
+            (type == VIRT_DISK_TYPE_LUN)){
             if (dev->dev.disk.disk_type == DISK_UNKNOWN) {
                 /* on success or fail caller should try free it */
                 rc = asprintf(p_error, "Device %s, Address %s, "
@@ -1149,6 +1150,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst,
                 dev->dev.disk.device = strdup("floppy");
         else if (type == VIRT_DISK_TYPE_FS) 
                 dev->dev.disk.device = strdup("filesystem");
+        else if (type == VIRT_DISK_TYPE_LUN)
+                dev->dev.disk.device = strdup("lun");
         else
                 return "Invalid value for EmulatedType";
 

</pre>
      </blockquote>
      <pre wrap="">
_______________________________________________
Libvirt-cim mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libvirt-cim@redhat.com">Libvirt-cim@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvirt-cim">https://www.redhat.com/mailman/listinfo/libvirt-cim</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>