You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2014/01/09 23:44:48 UTC

git commit: updated refs/heads/master to 8b6e89c

Updated Branches:
  refs/heads/master 1e2e1ea05 -> 8b6e89c01


Merge from 4.3: CLOUDSTACK-4810: Enable hypervisor snapshots for CloudStack-managed storage (for XenServer and VMware)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8b6e89c0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b6e89c0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b6e89c0

Branch: refs/heads/master
Commit: 8b6e89c012a3ca4dfe4a4b25bd77b1b463a501a2
Parents: 1e2e1ea
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Jan 9 15:43:55 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Jan 9 15:44:02 2014 -0700

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java         |  10 +-
 .../xen/resource/CitrixResourceBase.java        |  81 +--------
 .../xen/resource/XenServerStorageProcessor.java | 173 ++++++++++++-------
 .../driver/SolidfirePrimaryDataStoreDriver.java |  17 +-
 .../SolidFirePrimaryDataStoreLifeCycle.java     |  17 --
 .../storage/datastore/util/SolidFireUtil.java   |   8 +-
 .../com/cloud/storage/VolumeApiServiceImpl.java |  31 +++-
 7 files changed, 156 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index ed98869..c1d8bac 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -4810,12 +4810,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         auth.setChapName(chapName);
         auth.setChapSecret(chapSecret);
 
-        if (StringUtils.isNotBlank(mutualChapName) && StringUtils.isNotBlank(mutualChapSecret)) {
-            auth.setMutualChapInherited(false);
-            auth.setMutualChapAuthenticationType(strAuthType);
-            auth.setMutualChapName(mutualChapName);
-            auth.setMutualChapSecret(mutualChapSecret);
-        }
+        auth.setMutualChapInherited(false);
+        auth.setMutualChapAuthenticationType(strAuthType);
+        auth.setMutualChapName(mutualChapName);
+        auth.setMutualChapSecret(mutualChapSecret);
 
         target.setAuthenticationProperties(auth);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 4309af3..2d7baa2 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -1262,14 +1262,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         }
     }
 
-    protected VBD createVbd(Connection conn, DiskTO volume, String vmName, VM vm, BootloaderType bootLoaderType, VDI vdi) throws XmlRpcException, XenAPIException {
+    protected VBD createVbd(Connection conn, DiskTO volume, String vmName, VM vm, BootloaderType bootLoaderType) throws XmlRpcException, XenAPIException {
         Volume.Type type = volume.getType();
 
-        if (vdi == null) {
-            vdi = mount(conn, vmName, volume);
-        }
+        VDI vdi = mount(conn, vmName, volume);
 
         if (vdi != null) {
+            if ("detached".equals(vdi.getNameLabel(conn))) {
+                vdi.setNameLabel(conn, vmName + "-DATA");
+            }
+
             Map<String, String> smConfig = vdi.getSmConfig(conn);
             for (String key : smConfig.keySet()) {
                 if (key.startsWith("host_")) {
@@ -1752,35 +1754,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             vm = createVmFromTemplate(conn, vmSpec, host);
 
             for (DiskTO disk : vmSpec.getDisks()) {
-                VDI vdi = null;
-
-                if (disk.getData() instanceof VolumeObjectTO) {
-                    Map<String, String> details = disk.getDetails();
-                    boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED));
-
-                    if (isManaged) {
-                        String iScsiName = details.get(DiskTO.IQN);
-                        String storageHost = details.get(DiskTO.STORAGE_HOST);
-                        String chapInitiatorUsername = disk.getDetails().get(DiskTO.CHAP_INITIATOR_USERNAME);
-                        String chapInitiatorSecret = disk.getDetails().get(DiskTO.CHAP_INITIATOR_SECRET);
-                        Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE));
-                        String vdiNameLabel = vmName + "-DATA";
-
-                        SR sr = getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, true);
-
-                        vdi = getVDIbyUuid(conn, disk.getPath(), false);
-
-                        if (vdi == null) {
-                            vdi = createVdi(sr, vdiNameLabel, volumeSize);
-
-                            iqnToPath.put(iScsiName, vdi.getUuid(conn));
-                        } else {
-                            vdi.setNameLabel(conn, vdiNameLabel);
-                        }
-                    }
-                }
-
-                createVbd(conn, disk, vmName, vm, vmSpec.getBootloader(), vdi);
+                createVbd(conn, disk, vmName, vm, vmSpec.getBootloader());
             }
 
             if (vmSpec.getType() != VirtualMachine.Type.User) {
@@ -1889,45 +1863,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                     s_logger.debug("The VM is in stopped state, detected problem during startup : " + vmName);
                 }
             }
-
-            if (state != State.Running) {
-                disconnectManagedVolumes(conn, vm);
-            }
-        }
-    }
-
-    private void disconnectManagedVolumes(Connection conn, VM vm) {
-        try {
-            Set<VBD> vbds = vm.getVBDs(conn);
-
-            for (VBD vbd : vbds) {
-                VDI vdi = vbd.getVDI(conn);
-                SR sr = null;
-
-                try {
-                    sr = vdi.getSR(conn);
-                } catch (Exception ex) {
-                    continue;
-                }
-
-                if (sr.getNameLabel(conn).startsWith("/iqn.")) {
-                    VBD.Record vbdr = vbd.getRecord(conn);
-
-                    if (vbdr.currentlyAttached) {
-                        vbd.unplug(conn);
-                    }
-
-                    vbd.destroy(conn);
-
-                    vdi.setNameLabel(conn, "detached");
-
-                    umount(conn, vdi);
-
-                    handleSrAndVdiDetach(sr.getNameLabel(conn));
-                }
-            }
-        } catch (Exception ex) {
-            s_logger.debug(ex.getMessage());
         }
     }
 
@@ -4104,8 +4039,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
                     try {
                         if (vm.getPowerState(conn) == VmPowerState.HALTED) {
-                            disconnectManagedVolumes(conn, vm);
-
                             Set<VIF> vifs = vm.getVIFs(conn);
                             List<Network> networks = new ArrayList<Network>();
                             for (VIF vif : vifs) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index 73348f4..47f3955 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -30,6 +30,20 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.VMGuestMetrics;
+
 import org.apache.cloudstack.storage.command.AttachAnswer;
 import org.apache.cloudstack.storage.command.AttachCommand;
 import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer;
@@ -72,18 +86,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.storage.encoding.DecodedDataObject;
 import com.cloud.utils.storage.encoding.DecodedDataStore;
 import com.cloud.utils.storage.encoding.Decoder;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.VMGuestMetrics;
 
 public class XenServerStorageProcessor implements StorageProcessor {
     private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class);
@@ -161,19 +163,39 @@ public class XenServerStorageProcessor implements StorageProcessor {
 
     @Override
     public AttachAnswer attachVolume(AttachCommand cmd) {
-        String vmName = cmd.getVmName();
-        String vdiNameLabel = vmName + "-DATA";
         DiskTO disk = cmd.getDisk();
         DataTO data = disk.getData();
 
         try {
-            Connection conn = hypervisorResource.getConnection();
+            String vmName = cmd.getVmName();
+            String vdiNameLabel = vmName + "-DATA";
 
-            VDI vdi = null;
+            Connection conn = this.hypervisorResource.getConnection();
+            VM vm = null;
+
+            boolean vmNotRunning = true;
+
+            try {
+                vm = this.hypervisorResource.getVM(conn, vmName);
+
+                VM.Record vmr = vm.getRecord(conn);
+
+                vmNotRunning = vmr.powerState != VmPowerState.RUNNING;
+            }
+            catch (CloudRuntimeException ex) {
+            }
 
             Map<String, String> details = cmd.getDisk().getDetails();
             boolean isManaged = Boolean.parseBoolean(details.get(DiskTO.MANAGED));
 
+            // if the VM is not running and we're not dealing with managed storage, just return success (nothing to do here)
+            // this should probably never actually happen
+            if (vmNotRunning && !isManaged) {
+                return new AttachAnswer(disk);
+            }
+
+            VDI vdi = null;
+
             if (isManaged) {
                 String iScsiName = details.get(DiskTO.IQN);
                 String storageHost = details.get(DiskTO.STORAGE_HOST);
@@ -188,47 +210,57 @@ public class XenServerStorageProcessor implements StorageProcessor {
                 if (vdi == null) {
                     vdi = hypervisorResource.createVdi(sr, vdiNameLabel, volumeSize);
                 }
-            } else {
+
+                if (vmNotRunning) {
+                    DiskTO newDisk = new DiskTO(disk.getData(), disk.getDiskSeq(), vdi.getUuid(conn), disk.getType());
+
+                    return new AttachAnswer(newDisk);
+                }
+            }
+            else {
                 vdi = hypervisorResource.mount(conn, null, null, data.getPath());
             }
 
-            // Look up the VM
-            VM vm = hypervisorResource.getVM(conn, vmName);
             /* For HVM guest, if no pv driver installed, no attach/detach */
-            boolean isHVM;
-            if (vm.getPVBootloader(conn).equalsIgnoreCase("")) {
-                isHVM = true;
-            } else {
-                isHVM = false;
-            }
+            boolean isHVM = vm.getPVBootloader(conn).equalsIgnoreCase("");
+
             VMGuestMetrics vgm = vm.getGuestMetrics(conn);
             boolean pvDrvInstalled = false;
-            if (!hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
+
+            if (!this.hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
                 pvDrvInstalled = true;
             }
+
             if (isHVM && !pvDrvInstalled) {
                 s_logger.warn(": You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected");
+
                 return new AttachAnswer("You attempted an operation that requires PV drivers to be installed on the VM. Please install them by inserting xen-pv-drv.iso.");
             }
 
             // Figure out the disk number to attach the VM to
             String diskNumber = null;
             Long deviceId = disk.getDiskSeq();
+
             if (deviceId != null) {
                 if (deviceId.longValue() == 3) {
                     String msg = "Device 3 is reserved for CD-ROM, choose other device";
+
                     return new AttachAnswer(msg);
                 }
+
                 if (hypervisorResource.isDeviceUsed(conn, vm, deviceId)) {
                     String msg = "Device " + deviceId + " is used in VM " + vmName;
+
                     return new AttachAnswer(msg);
                 }
+
                 diskNumber = deviceId.toString();
             } else {
                 diskNumber = hypervisorResource.getUnusedDeviceNum(conn, vm);
             }
-            // Create a new VBD
+
             VBD.Record vbdr = new VBD.Record();
+
             vbdr.VM = vm;
             vbdr.VDI = vdi;
             vbdr.bootable = false;
@@ -236,6 +268,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
             vbdr.mode = Types.VbdMode.RW;
             vbdr.type = Types.VbdType.DISK;
             vbdr.unpluggable = true;
+
             VBD vbd = VBD.create(conn, vbdr);
 
             // Attach the VBD to the VM
@@ -243,9 +276,10 @@ public class XenServerStorageProcessor implements StorageProcessor {
 
             // Update the VDI's label to include the VM name
             vdi.setNameLabel(conn, vdiNameLabel);
+
             DiskTO newDisk = new DiskTO(disk.getData(), Long.parseLong(diskNumber), vdi.getUuid(conn), disk.getType());
-            return new AttachAnswer(newDisk);
 
+            return new AttachAnswer(newDisk);
         } catch (XenAPIException e) {
             String msg = "Failed to attach volume" + " for uuid: " + data.getPath() + "  due to " + e.toString();
             s_logger.warn(msg, e);
@@ -323,51 +357,70 @@ public class XenServerStorageProcessor implements StorageProcessor {
 
     @Override
     public Answer dettachVolume(DettachCommand cmd) {
-        String vmName = cmd.getVmName();
         DiskTO disk = cmd.getDisk();
         DataTO data = disk.getData();
+
         try {
-            Connection conn = hypervisorResource.getConnection();
-            // Look up the VDI
-            VDI vdi = hypervisorResource.mount(conn, null, null, data.getPath());
-            // Look up the VM
-            VM vm = hypervisorResource.getVM(conn, vmName);
-            /* For HVM guest, if no pv driver installed, no attach/detach */
-            boolean isHVM;
-            if (vm.getPVBootloader(conn).equalsIgnoreCase("")) {
-                isHVM = true;
-            } else {
-                isHVM = false;
+            Connection conn = this.hypervisorResource.getConnection();
+
+            String vmName = cmd.getVmName();
+            VM vm = null;
+
+            boolean vmNotRunning = true;
+
+            try {
+                vm = this.hypervisorResource.getVM(conn, vmName);
+
+                VM.Record vmr = vm.getRecord(conn);
+
+                vmNotRunning = vmr.powerState != VmPowerState.RUNNING;
             }
-            VMGuestMetrics vgm = vm.getGuestMetrics(conn);
-            boolean pvDrvInstalled = false;
-            if (!hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
-                pvDrvInstalled = true;
+            catch (CloudRuntimeException ex) {
             }
-            if (isHVM && !pvDrvInstalled) {
-                s_logger.warn(": You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected");
-                return new DettachAnswer(
-                    "You attempted an operation that requires PV drivers to be installed on the VM. Please install them by inserting xen-pv-drv.iso.");
+
+            // if the VM is not running and we're not dealing with managed storage, just return success (nothing to do here)
+            // this should probably never actually happen
+            if (vmNotRunning && !cmd.isManaged()) {
+                return new DettachAnswer(disk);
             }
 
-            // Look up all VBDs for this VDI
-            Set<VBD> vbds = vdi.getVBDs(conn);
+            if (!vmNotRunning) {
+                /* For HVM guest, if no pv driver installed, no attach/detach */
+                boolean isHVM = vm.getPVBootloader(conn).equalsIgnoreCase("");
 
-            // Detach each VBD from its VM, and then destroy it
-            for (VBD vbd : vbds) {
-                VBD.Record vbdr = vbd.getRecord(conn);
+                VMGuestMetrics vgm = vm.getGuestMetrics(conn);
+                boolean pvDrvInstalled = false;
 
-                if (vbdr.currentlyAttached) {
-                    vbd.unplug(conn);
+                if (!this.hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
+                    pvDrvInstalled = true;
                 }
 
-                vbd.destroy(conn);
-            }
+                if (isHVM && !pvDrvInstalled) {
+                    s_logger.warn(": You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected");
+                    return new DettachAnswer("You attempted an operation that requires PV drivers to be installed on the VM. Please install them by inserting xen-pv-drv.iso.");
+                }
 
-            // Update the VDI's label to be "detached"
-            vdi.setNameLabel(conn, "detached");
+                VDI vdi = this.hypervisorResource.mount(conn, null, null, data.getPath());
 
-            hypervisorResource.umount(conn, vdi);
+                // Look up all VBDs for this VDI
+                Set<VBD> vbds = vdi.getVBDs(conn);
+
+                // Detach each VBD from its VM, and then destroy it
+                for (VBD vbd : vbds) {
+                    VBD.Record vbdr = vbd.getRecord(conn);
+
+                    if (vbdr.currentlyAttached) {
+                        vbd.unplug(conn);
+                    }
+
+                    vbd.destroy(conn);
+                }
+
+                // Update the VDI's label to be "detached"
+                vdi.setNameLabel(conn, "detached");
+
+                this.hypervisorResource.umount(conn, vdi);
+            }
 
             if (cmd.isManaged()) {
                 hypervisorResource.handleSrAndVdiDetach(cmd.get_iScsiName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
index 460cb0d..7959af9 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
@@ -216,22 +216,13 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
 
         String chapInitiatorSecret = accountDetail.getValue();
 
-        StoragePoolDetailVO storagePoolDetail = _storagePoolDetailsDao.findDetail(volumeInfo.getPoolId(), SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE);
+        accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
 
-        boolean useMutualChapForVMware = new Boolean(storagePoolDetail.getValue());
+        String chapTargetUsername = accountDetail.getValue();
 
-        String chapTargetUsername = null;
-        String chapTargetSecret = null;
+        accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
 
-        if (useMutualChapForVMware) {
-            accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
-
-            chapTargetUsername = accountDetail.getValue();
-
-            accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
-
-            chapTargetSecret = accountDetail.getValue();
-        }
+        String chapTargetSecret = accountDetail.getValue();
 
         return new ChapInfoImpl(chapInitiatorUsername, chapInitiatorSecret, chapTargetUsername, chapTargetSecret);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java
index c6e486b..af6a77a 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java
@@ -171,23 +171,6 @@ public class SolidFirePrimaryDataStoreLifeCycle implements PrimaryDataStoreLifeC
         details.put(SolidFireUtil.CLUSTER_DEFAULT_MAX_IOPS, String.valueOf(lClusterDefaultMaxIops));
         details.put(SolidFireUtil.CLUSTER_DEFAULT_BURST_IOPS_PERCENT_OF_MAX_IOPS, String.valueOf(fClusterDefaultBurstIopsPercentOfMaxIops));
 
-        String useMutualChapForVMware = Boolean.TRUE.toString();
-
-        try {
-            useMutualChapForVMware = getValue(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, url);
-
-            if (useMutualChapForVMware == null || new Boolean(useMutualChapForVMware)) {
-                useMutualChapForVMware = Boolean.TRUE.toString();
-            }
-            else {
-                useMutualChapForVMware = Boolean.FALSE.toString();
-            }
-        }
-        catch (Exception ex) {
-        }
-
-        details.put(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, useMutualChapForVMware);
-
         // this adds a row in the cloud.storage_pool table for this SolidFire cluster
         return dataStoreHelper.createPrimaryDataStore(parameters);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java
index 131e088..3c96c09 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java
@@ -75,10 +75,10 @@ public class SolidFireUtil {
     public static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
     public static final String CHAP_TARGET_SECRET = "chapTargetSecret";
 
-    public static final String USE_MUTUAL_CHAP_FOR_VMWARE = "useMutualChapForVMware";
-
-    public static long createSolidFireVolume(String strSfMvip, int iSfPort, String strSfAdmin, String strSfPassword, String strSfVolumeName, long lSfAccountId,
-        long lTotalSize, boolean bEnable512e, final String strCloudStackVolumeSize, long lMinIops, long lMaxIops, long lBurstIops) {
+    public static long createSolidFireVolume(String strSfMvip, int iSfPort, String strSfAdmin, String strSfPassword,
+            String strSfVolumeName, long lSfAccountId, long lTotalSize, boolean bEnable512e, final String strCloudStackVolumeSize,
+            long lMinIops, long lMaxIops, long lBurstIops)
+    {
         final Gson gson = new GsonBuilder().create();
 
         VolumeToCreate volumeToCreate =

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e89c0/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 7ab5887..5f15cac 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1449,11 +1449,19 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             }
         }
 
+        StoragePoolVO volumePool = _storagePoolDao.findById(volume.getPoolId());
+
+        if (hostId != null) {
+            HostVO host = _hostDao.findById(hostId);
+
+            if (host != null && host.getHypervisorType() == HypervisorType.XenServer && volumePool.isManaged()) {
+                sendCommand = true;
+            }
+        }
+
         Answer answer = null;
 
         if (sendCommand) {
-            StoragePoolVO volumePool = _storagePoolDao.findById(volume.getPoolId());
-
             DataTO volTO = volFactory.getVolume(volume.getId()).getTO();
             DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType());
 
@@ -1920,22 +1928,31 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         boolean sendCommand = (vm.getState() == State.Running);
         AttachAnswer answer = null;
         Long hostId = vm.getHostId();
+
         if (hostId == null) {
             hostId = vm.getLastHostId();
             HostVO host = _hostDao.findById(hostId);
+
             if (host != null && host.getHypervisorType() == HypervisorType.VMware) {
                 sendCommand = true;
             }
         }
 
-        StoragePoolVO volumeToAttachStoragePool = null;
+        HostVO host = null;
+        StoragePoolVO volumeToAttachStoragePool = _storagePoolDao.findById(volumeToAttach.getPoolId());
 
-        if (sendCommand) {
-            volumeToAttachStoragePool = _storagePoolDao.findById(volumeToAttach.getPoolId());
+        if (hostId != null) {
+            host = _hostDao.findById(hostId);
 
-            HostVO host = _hostDao.findById(hostId);
+            if (host != null && host.getHypervisorType() == HypervisorType.XenServer && volumeToAttachStoragePool.isManaged()) {
+                sendCommand = true;
+            }
+        }
 
-            if (host.getHypervisorType() == HypervisorType.KVM && volumeToAttachStoragePool.isManaged() && volumeToAttach.getPath() == null) {
+        if (sendCommand) {
+            if (host.getHypervisorType() == HypervisorType.KVM &&
+                volumeToAttachStoragePool.isManaged() &&
+                volumeToAttach.getPath() == null) {
                 volumeToAttach.setPath(volumeToAttach.get_iScsiName());
 
                 _volsDao.update(volumeToAttach.getId(), volumeToAttach);