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

[libvirt] [PATCH v2] esx: Allow 'vmpvscsi' as SCSI controller model



---

v2:
- rename 'pvscsi' to 'vmpvscsi'
- add esxVMX_SCSIControllerModelType{to,from}String to handle the difference
  between VMX and XML name of the controller model

 docs/drvesx.html.in                       |   13 ++++++++++++-
 docs/schemas/domain.rng                   |    1 +
 src/conf/domain_conf.c                    |    3 ++-
 src/conf/domain_conf.h                    |    1 +
 src/esx/esx_vmx.c                         |   25 ++++++++++++++++++-------
 tests/vmx2xmldata/vmx2xml-scsi-driver.vmx |    5 +++++
 tests/vmx2xmldata/vmx2xml-scsi-driver.xml |    6 ++++++
 tests/xml2vmxdata/xml2vmx-scsi-driver.vmx |    5 +++++
 tests/xml2vmxdata/xml2vmx-scsi-driver.xml |    5 +++++
 9 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index bc7e1a0..88c70bc 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -302,7 +302,13 @@ ethernet0.checkMACAddress = "false"
         </dd>
         <dt><code>lsisas1068</code></dt>
         <dd>
-            LSI Logic SAS 1068 controller.
+            LSI Logic SAS 1068 controller. <span class="since">Since 0.8.0</span>
+        </dd>
+        <dt><code>vmpvscsi</code></dt>
+        <dd>
+            Special VMware Paravirtual SCSI controller, requires VMware tools inside
+            the guest. See <a href="http://kb.vmware.com/kb/1010398";>VMware KB1010398</a>
+            for details. <span class="since">Since 0.8.3</span>
         </dd>
     </dl>
     <p>
@@ -642,5 +648,10 @@ Enter administrator password for example-vcenter.com:
                 VMware VMX config parameters
             </a>
         </li>
+        <li>
+            <a href="http://www.vmware.com/pdf/vsp_4_pvscsi_perf.pdf";>
+                VMware ESX 4.0 PVSCSI Storage Performance
+            </a>
+        </li>
     </ul>
 </body></html>
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 1d56f5b..6240518 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -676,6 +676,7 @@
             <value>buslogic</value>
             <value>lsilogic</value>
             <value>lsisas1068</value>
+            <value>vmpvscsi</value>
           </choice>
         </attribute>
       </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 378c06e..6ebf982 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -142,7 +142,8 @@ VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
 VIR_ENUM_IMPL(virDomainControllerModel, VIR_DOMAIN_CONTROLLER_MODEL_LAST,
               "buslogic",
               "lsilogic",
-              "lsisas1068")
+              "lsisas1068",
+              "vmpvscsi")
 
 VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "mount",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 01da17e..4abe376 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -199,6 +199,7 @@ enum virDomainControllerModel {
     VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC,
     VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC,
     VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068,
+    VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI,
 
     VIR_DOMAIN_CONTROLLER_MODEL_LAST
 };
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index e10e745..c69e116 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -428,6 +428,15 @@ def->parallels[0]...
 #define ESX_BUILD_VMX_NAME(_suffix)                                           \
     snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."#_suffix, prefix);
 
+/* directly map the virDomainControllerModel to esxVMX_SCSIControllerModel,
+ * this is good enough for now because all virDomainControllerModel values
+ * are actually SCSI controller models in the ESX case */
+VIR_ENUM_DECL(esxVMX_SCSIControllerModel)
+VIR_ENUM_IMPL(esxVMX_SCSIControllerModel, VIR_DOMAIN_CONTROLLER_MODEL_LAST,
+              "buslogic",
+              "lsilogic",
+              "lsisas1068",
+              "pvscsi");
 
 
 int
@@ -740,11 +749,12 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, int virtualDev[4],
         if (controller->model != -1 &&
             controller->model != VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC &&
             controller->model != VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC &&
-            controller->model != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068) {
+            controller->model != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068 &&
+            controller->model != VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       _("Expecting domain XML attribute 'model' of entry "
                         "'controller' to be 'buslogic' or 'lsilogic' or "
-                        "'lsisas1068' but found '%s'"),
+                        "'lsisas1068' or 'vmpvscsi' but found '%s'"),
                       virDomainControllerModelTypeToString(controller->model));
             return -1;
         }
@@ -1478,16 +1488,17 @@ esxVMX_ParseSCSIController(virConfPtr conf, int controller, bool *present,
             *tmp = c_tolower(*tmp);
         }
 
-        *virtualDev = virDomainControllerModelTypeFromString(virtualDev_string);
+        *virtualDev = esxVMX_SCSIControllerModelTypeFromString(virtualDev_string);
 
         if (*virtualDev == -1 ||
             (*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC &&
              *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC &&
-             *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068)) {
+             *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068 &&
+             *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI)) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
-                        "or 'lsisas1068' but found '%s'"), virtualDev_name,
-                        virtualDev_string);
+                        "or 'lsisas1068' or 'pvscsi' but found '%s'"),
+                       virtualDev_name, virtualDev_string);
             goto failure;
         }
     }
@@ -2619,7 +2630,7 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
 
             if (scsi_virtualDev[i] != -1) {
                 virBufferVSprintf(&buffer, "scsi%d.virtualDev = \"%s\"\n", i,
-                                  virDomainControllerModelTypeToString
+                                  esxVMX_SCSIControllerModelTypeToString
                                     (scsi_virtualDev[i]));
             }
         }
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx b/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
index cb055f6..64d7c99 100644
--- a/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
+++ b/tests/vmx2xmldata/vmx2xml-scsi-driver.vmx
@@ -6,6 +6,8 @@ scsi1.present = "true"
 scsi1.virtualDev = "lsilogic"
 scsi2.present = "true"
 scsi2.virtualDev = "lsisas1068"
+scsi3.present = "true"
+scsi3.virtualDev = "pvscsi"
 scsi0:0.present = "true"
 scsi0:0.deviceType = "scsi-hardDisk"
 scsi0:0.fileName = "harddisk1.vmdk"
@@ -15,3 +17,6 @@ scsi1:0.fileName = "harddisk2.vmdk"
 scsi2:0.present = "true"
 scsi2:0.deviceType = "scsi-hardDisk"
 scsi2:0.fileName = "harddisk3.vmdk"
+scsi3:0.present = "true"
+scsi3:0.deviceType = "scsi-hardDisk"
+scsi3:0.fileName = "harddisk4.vmdk"
diff --git a/tests/vmx2xmldata/vmx2xml-scsi-driver.xml b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
index d39415d..553783b 100644
--- a/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
+++ b/tests/vmx2xmldata/vmx2xml-scsi-driver.xml
@@ -26,8 +26,14 @@
       <target dev='sdae' bus='scsi'/>
       <address type='drive' controller='2' bus='0' unit='0'/>
     </disk>
+    <disk type='file' device='disk'>
+      <source file='[datastore] directory/harddisk4.vmdk'/>
+      <target dev='sdat' bus='scsi'/>
+      <address type='drive' controller='3' bus='0' unit='0'/>
+    </disk>
     <controller type='scsi' index='0' model='buslogic'/>
     <controller type='scsi' index='1' model='lsilogic'/>
     <controller type='scsi' index='2' model='lsisas1068'/>
+    <controller type='scsi' index='3' model='vmpvscsi'/>
   </devices>
 </domain>
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx b/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
index 7cceca0..a92d7fc 100644
--- a/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
+++ b/tests/xml2vmxdata/xml2vmx-scsi-driver.vmx
@@ -11,6 +11,8 @@ scsi1.present = "true"
 scsi1.virtualDev = "lsilogic"
 scsi2.present = "true"
 scsi2.virtualDev = "lsisas1068"
+scsi3.present = "true"
+scsi3.virtualDev = "pvscsi"
 scsi0:0.present = "true"
 scsi0:0.deviceType = "scsi-hardDisk"
 scsi0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk1.vmdk"
@@ -20,3 +22,6 @@ scsi1:0.fileName = "/vmfs/volumes/datastore/directory/harddisk2.vmdk"
 scsi2:0.present = "true"
 scsi2:0.deviceType = "scsi-hardDisk"
 scsi2:0.fileName = "/vmfs/volumes/datastore/directory/harddisk3.vmdk"
+scsi3:0.present = "true"
+scsi3:0.deviceType = "scsi-hardDisk"
+scsi3:0.fileName = "/vmfs/volumes/datastore/directory/harddisk4.vmdk"
diff --git a/tests/xml2vmxdata/xml2vmx-scsi-driver.xml b/tests/xml2vmxdata/xml2vmx-scsi-driver.xml
index 797a26e..ac630ee 100644
--- a/tests/xml2vmxdata/xml2vmx-scsi-driver.xml
+++ b/tests/xml2vmxdata/xml2vmx-scsi-driver.xml
@@ -21,5 +21,10 @@
       <source file='[datastore] directory/harddisk3.vmdk'/>
       <target dev='sdae' bus='scsi'/>
     </disk>
+    <disk type='file' device='disk'>
+      <driver name='vmpvscsi'/>
+      <source file='[datastore] directory/harddisk4.vmdk'/>
+      <target dev='sdat' bus='scsi'/>
+    </disk>
   </devices>
 </domain>
-- 
1.7.0.4


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