http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index dd9a7d6..bf6464c 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -321,8 +321,8 @@ cloudStack.converters = {
   toBooleanText: function(booleanValue) {
     if(booleanValue == true)
       return "Yes";
-    else if(booleanValue == false)
-      return "No";
+
+    return "No";
   },
   convertHz: function(hz) {
     if (hz == null)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 2c03d39..ad0965a 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -132,6 +132,16 @@
                         else {
                           $diskSize.hide();
                         }
+                        var $minIops = $form.find('.form-item[rel=minIops]');
+                        var $maxIops = $form.find('.form-item[rel=maxIops]');
+                        if (selectedDiskOfferingObj.iscustomizediops == true) {
+                          $minIops.css('display', 'inline-block');
+                          $maxIops.css('display', 'inline-block');
+                        }
+                        else {
+                          $minIops.hide();
+                          $maxIops.hide();
+                        }
                       });
                     }
                   }
@@ -141,7 +151,19 @@
                     label: 'label.disk.size.gb',
                     validation: { required: true, number: true },
                     isHidden: true
-                  }
+                  },
+                  
+                  minIops: {
+                    label: 'label.disk.iops.min',
+                    validation: { required: false, number: true },
+                    isHidden: true
+                  },
+                  
+                  maxIops: {
+                    label: 'label.disk.iops.max',
+                    validation: { required: false, number: true },
+                    isHidden: true
+                  },
 
                 }
               },
@@ -159,6 +181,20 @@
                                                                          size: 
args.data.diskSize
                                                                        });
                 }
+                
+                if (selectedDiskOfferingObj.iscustomizediops == true) {
+                    if (args.data.minIops != "" && args.data.minIops > 0) {
+                                                                 
$.extend(data, {
+                                                                         
miniops: args.data.minIops
+                                                                       });
+                                       }
+                                   
+                                   if (args.data.maxIops != "" && 
args.data.maxIops > 0) {
+                                                                 
$.extend(data, {
+                                                                         
maxiops: args.data.maxIops
+                                                                       });
+                                       }
+                }
 
                 $.ajax({
                   url: createURL('createVolume'),
@@ -1228,6 +1264,24 @@
                           return cloudStack.converters.convertBytes(args);
                       }
                     },
+                    miniops: {
+                      label: 'label.disk.iops.min',
+                      converter: function(args) {
+                        if(args == null || args == 0)
+                          return "";
+                        else
+                          return args;
+                      }
+                    },
+                    maxiops: {
+                      label: 'label.disk.iops.max',
+                      converter: function(args) {
+                        if(args == null || args == 0)
+                          return "";
+                        else
+                          return args;
+                      }
+                    },
                     virtualmachineid: {
                       label: 'VM ID',
                       converter: function(args) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 92faf5e..135307b 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -12745,11 +12745,11 @@
                   {
                     id: { label: 'label.id' },
                     state: { label: 'label.state' },
-                                                                               
tags: {
-                                                                               
  label: 'label.storage.tags',
-                                                                               
        isEditable: true
-                                                                               
},
-                                                                               
podname: { label: 'label.pod' },
+                                       tags: {
+                                               label: 'label.storage.tags',
+                                               isEditable: true
+                                       },
+                                       podname: { label: 'label.pod' },
                     clustername: { label: 'label.cluster' },
                     type: { label: 'label.type' },
                     ipaddress: { label: 'label.ip.address' },
@@ -12771,6 +12771,15 @@
                         else
                           return cloudStack.converters.convertBytes(args);
                       }
+                    },
+                    capacityiops: {
+                      label: 'label.disk.iops.total',
+                      converter: function(args) {
+                        if (args == null || args == 0)
+                          return "";
+                        else
+                          return args;
+                      }
                     }
                   }
                 ],

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/utils/src/com/cloud/utils/StringUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/StringUtils.java 
b/utils/src/com/cloud/utils/StringUtils.java
index 359b169..db32dd4 100644
--- a/utils/src/com/cloud/utils/StringUtils.java
+++ b/utils/src/com/cloud/utils/StringUtils.java
@@ -49,6 +49,14 @@ public class StringUtils {
         return org.apache.commons.lang.StringUtils.join(components, delimiter);
     }
 
+    public static boolean isNotBlank(String str) {
+        if (str != null && str.trim().length() > 0) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * @param tags
      * @return List of tags

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java
----------------------------------------------------------------------
diff --git 
a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java 
b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java
index 3dcd724..7c548ff 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostDatastoreSystemMO.java
@@ -26,14 +26,16 @@ import com.vmware.vim25.CustomFieldStringValue;
 import com.vmware.vim25.DatastoreInfo;
 import com.vmware.vim25.DynamicProperty;
 import com.vmware.vim25.HostNasVolumeSpec;
+import com.vmware.vim25.HostScsiDisk;
 import com.vmware.vim25.ManagedObjectReference;
 import com.vmware.vim25.NasDatastoreInfo;
 import com.vmware.vim25.ObjectContent;
 import com.vmware.vim25.ObjectSpec;
 import com.vmware.vim25.PropertyFilterSpec;
 import com.vmware.vim25.PropertySpec;
-import com.vmware.vim25.SelectionSpec;
 import com.vmware.vim25.TraversalSpec;
+import com.vmware.vim25.VmfsDatastoreCreateSpec;
+import com.vmware.vim25.VmfsDatastoreOption;
 
 public class HostDatastoreSystemMO extends BaseMO {
 
@@ -122,6 +124,22 @@ public class HostDatastoreSystemMO extends BaseMO {
                return null;
        }
 
+       public List<HostScsiDisk> queryAvailableDisksForVmfs() throws Exception 
{
+               return _context.getService().queryAvailableDisksForVmfs(_mor, 
null);
+       }
+
+       public ManagedObjectReference createVmfsDatastore(String datastoreName, 
HostScsiDisk hostScsiDisk) throws Exception {
+               // just grab the first instance of VmfsDatastoreOption
+               VmfsDatastoreOption vmfsDatastoreOption = 
_context.getService().queryVmfsDatastoreCreateOptions(_mor, 
hostScsiDisk.getDevicePath(), 4).get(0);
+
+               VmfsDatastoreCreateSpec vmfsDatastoreCreateSpec = 
(VmfsDatastoreCreateSpec)vmfsDatastoreOption.getSpec();
+
+               // set the name of the datastore to be created
+               vmfsDatastoreCreateSpec.getVmfs().setVolumeName(datastoreName);
+
+               return _context.getService().createVmfsDatastore(_mor, 
vmfsDatastoreCreateSpec);
+       }
+
        public boolean deleteDatastore(String name) throws Exception {
                ManagedObjectReference morDatastore = findDatastore(name);
                if(morDatastore != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java 
b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
index a866fdc..e7fd922 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
@@ -149,6 +149,13 @@ public class HostMO extends BaseMO implements 
VmwareHypervisorHost {
                throw new Exception("Could not find host default gateway, host 
is not properly configured?");
        }
 
+       public HostStorageSystemMO getHostStorageSystemMO() throws Exception {
+               return new HostStorageSystemMO(_context,
+                       
(ManagedObjectReference)_context.getVimClient().getDynamicProperty(
+                               _mor, "configManager.storageSystem")
+               );
+       }
+
        public HostDatastoreSystemMO getHostDatastoreSystemMO() throws 
Exception {
                return new HostDatastoreSystemMO(_context,
                        
(ManagedObjectReference)_context.getVimClient().getDynamicProperty(
@@ -797,14 +804,14 @@ public class HostMO extends BaseMO implements 
VmwareHypervisorHost {
        }
 
        @Override
-       public void unmountDatastore(String poolUuid) throws Exception {
+       public void unmountDatastore(String uuid) throws Exception {
 
            if(s_logger.isTraceEnabled())
-                       s_logger.trace("vCenter API trace - unmountDatastore(). 
target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid);
+                       s_logger.trace("vCenter API trace - unmountDatastore(). 
target MOR: " + _mor.getValue() + ", uuid: " + uuid);
 
        HostDatastoreSystemMO hostDatastoreSystemMo = 
getHostDatastoreSystemMO();
-       if(!hostDatastoreSystemMo.deleteDatastore(poolUuid)) {
-               String msg = "Unable to unmount datastore. uuid: " + poolUuid;
+       if(!hostDatastoreSystemMo.deleteDatastore(uuid)) {
+               String msg = "Unable to unmount datastore. uuid: " + uuid;
                s_logger.error(msg);
 
                if(s_logger.isTraceEnabled())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99227f7b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostStorageSystemMO.java
----------------------------------------------------------------------
diff --git 
a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostStorageSystemMO.java 
b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostStorageSystemMO.java
new file mode 100644
index 0000000..d400185
--- /dev/null
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostStorageSystemMO.java
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.hypervisor.vmware.mo;
+
+import java.util.List;
+
+import com.cloud.hypervisor.vmware.util.VmwareContext;
+
+import com.vmware.vim25.HostInternetScsiHbaStaticTarget;
+import com.vmware.vim25.HostStorageDeviceInfo;
+import com.vmware.vim25.ManagedObjectReference;
+
+public class HostStorageSystemMO extends BaseMO {
+       public HostStorageSystemMO(VmwareContext context, 
ManagedObjectReference morHostDatastore) {
+               super(context, morHostDatastore);
+       }
+
+       public HostStorageSystemMO(VmwareContext context, String morType, 
String morValue) {
+               super(context, morType, morValue);
+       }
+       
+       public HostStorageDeviceInfo getStorageDeviceInfo() throws Exception {
+               return 
(HostStorageDeviceInfo)_context.getVimClient().getDynamicProperty(_mor, 
"storageDeviceInfo");
+       }
+       
+       public void addInternetScsiStaticTargets(String iScsiHbaDevice, 
List<HostInternetScsiHbaStaticTarget> lstTargets) throws Exception {
+               _context.getService().addInternetScsiStaticTargets(_mor, 
iScsiHbaDevice, lstTargets);
+       }
+       
+       public void removeInternetScsiStaticTargets(String iScsiHbaDevice, 
List<HostInternetScsiHbaStaticTarget> lstTargets) throws Exception {
+               _context.getService().removeInternetScsiStaticTargets(_mor, 
iScsiHbaDevice, lstTargets);
+       }
+       
+       public void rescanHba(String iScsiHbaDevice) throws Exception {
+               _context.getService().rescanHba(_mor, iScsiHbaDevice);
+       }
+}

Reply via email to