You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/11/01 16:12:34 UTC

[2/4] git commit: updated refs/heads/master to f71aadb

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3475ef29/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 a9c1227..2caca72 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
@@ -16,53 +16,21 @@
 // under the License.
 package org.apache.cloudstack.storage.datastore.util;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
 
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.BasicClientConnectionManager;
 import org.apache.log4j.Logger;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-import org.apache.cloudstack.utils.security.SSLUtils;
 
 import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterDetailsVO;
@@ -76,8 +44,38 @@ import com.cloud.user.AccountDetailsDao;
 import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.exception.CloudRuntimeException;
 
+import com.google.common.primitives.Longs;
+
+import com.solidfire.client.ElementFactory;
+import com.solidfire.element.api.Account;
+import com.solidfire.element.api.AddAccountRequest;
+import com.solidfire.element.api.CloneVolumeRequest;
+import com.solidfire.element.api.CloneVolumeResult;
+import com.solidfire.element.api.CreateSnapshotRequest;
+import com.solidfire.element.api.CreateVolumeAccessGroupRequest;
+import com.solidfire.element.api.CreateVolumeRequest;
+import com.solidfire.element.api.DeleteSnapshotRequest;
+import com.solidfire.element.api.DeleteVolumeRequest;
+import com.solidfire.element.api.GetAccountByIDRequest;
+import com.solidfire.element.api.GetAccountByNameRequest;
+import com.solidfire.element.api.GetAsyncResultRequest;
+import com.solidfire.element.api.ListSnapshotsRequest;
+import com.solidfire.element.api.ListVolumeAccessGroupsRequest;
+import com.solidfire.element.api.ListVolumesRequest;
+import com.solidfire.element.api.ModifyVolumeAccessGroupRequest;
+import com.solidfire.element.api.ModifyVolumeRequest;
+import com.solidfire.element.api.QoS;
+import com.solidfire.element.api.Snapshot;
+import com.solidfire.element.api.SolidFireElement;
+import com.solidfire.element.api.Volume;
+import com.solidfire.element.api.VolumeAccessGroup;
+import com.solidfire.jsvcgen.javautil.Optional;
+
+import static org.apache.commons.lang.ArrayUtils.toPrimitive;
+
 public class SolidFireUtil {
     private static final Logger s_logger = Logger.getLogger(SolidFireUtil.class);
+
     public static final String PROVIDER_NAME = "SolidFire";
     public static final String SHARED_PROVIDER_NAME = "SolidFireShared";
 
@@ -104,7 +102,8 @@ public class SolidFireUtil {
     public static final String MAX_IOPS = "maxIops";
     public static final String BURST_IOPS = "burstIops";
 
-    public static final String ACCOUNT_ID = "accountId";
+    private static final String ACCOUNT_ID = "accountId";
+
     public static final String VOLUME_ID = "volumeId";
     public static final String TEMP_VOLUME_ID = "tempVolumeId";
     public static final String SNAPSHOT_ID = "snapshotId";
@@ -120,12 +119,6 @@ public class SolidFireUtil {
 
     public static final String STORAGE_POOL_ID = "sfStoragePoolId";
 
-    public static final String CHAP_INITIATOR_USERNAME = "chapInitiatorUsername";
-    public static final String CHAP_INITIATOR_SECRET = "chapInitiatorSecret";
-
-    public static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
-    public static final String CHAP_TARGET_SECRET = "chapTargetSecret";
-
     public static final String DATACENTER = "datacenter";
 
     public static final String DATASTORE_NAME = "datastoreName";
@@ -165,19 +158,19 @@ public class SolidFireUtil {
             _clusterAdminPassword = clusterAdminPassword;
         }
 
-        public String getManagementVip() {
+        String getManagementVip() {
             return _managementVip;
         }
 
-        public int getManagementPort() {
+        int getManagementPort() {
             return _managementPort;
         }
 
-        public String getClusterAdminUsername() {
+        String getClusterAdminUsername() {
             return _clusterAdminUsername;
         }
 
-        public String getClusterAdminPassword() {
+        private String getClusterAdminPassword() {
             return _clusterAdminPassword;
         }
 
@@ -218,16 +211,97 @@ public class SolidFireUtil {
         return new SolidFireConnection(mVip, mPort, clusterAdminUsername, clusterAdminPassword);
     }
 
+    private static SolidFireElement getSolidFireElement(SolidFireConnection sfConnection) {
+        return ElementFactory.create(sfConnection.getManagementVip(), sfConnection.getClusterAdminUsername(), sfConnection.getClusterAdminPassword());
+    }
+
+    // used to parse the "url" parameter when creating primary storage that's based on the SolidFire plug-in with the
+    // name SolidFireUtil.PROVIDER_NAME (as opposed to the SolidFire plug-in with the name SolidFireUtil.SHARED_PROVIDER_NAME)
+    // return a String instance that contains at most the MVIP and SVIP info
+    public static String getModifiedUrl(String originalUrl) {
+        StringBuilder sb = new StringBuilder();
+
+        String delimiter = ";";
+
+        StringTokenizer st = new StringTokenizer(originalUrl, delimiter);
+
+        while (st.hasMoreElements()) {
+            String token = st.nextElement().toString().toUpperCase();
+
+            if (token.startsWith(SolidFireUtil.MANAGEMENT_VIP.toUpperCase()) || token.startsWith(SolidFireUtil.STORAGE_VIP.toUpperCase())) {
+                sb.append(token).append(delimiter);
+            }
+        }
+
+        String modifiedUrl = sb.toString();
+        int lastIndexOf = modifiedUrl.lastIndexOf(delimiter);
+
+        if (lastIndexOf == (modifiedUrl.length() - delimiter.length())) {
+            return modifiedUrl.substring(0, lastIndexOf);
+        }
+
+        return modifiedUrl;
+    }
+
+    public static String getManagementVip(String url) {
+        return getVip(SolidFireUtil.MANAGEMENT_VIP, url);
+    }
+
+    public static String getStorageVip(String url) {
+        return getVip(SolidFireUtil.STORAGE_VIP, url);
+    }
+
+    public static int getManagementPort(String url) {
+        return getPort(SolidFireUtil.MANAGEMENT_VIP, url, DEFAULT_MANAGEMENT_PORT);
+    }
+
+    public static int getStoragePort(String url) {
+        return getPort(SolidFireUtil.STORAGE_VIP, url, DEFAULT_STORAGE_PORT);
+    }
+
+    public static String getValue(String keyToMatch, String url) {
+        return getValue(keyToMatch, url, true);
+    }
+
+    public static String getValue(String keyToMatch, String url, boolean throwExceptionIfNotFound) {
+        String delimiter1 = ";";
+        String delimiter2 = "=";
+
+        StringTokenizer st = new StringTokenizer(url, delimiter1);
+
+        while (st.hasMoreElements()) {
+            String token = st.nextElement().toString();
+
+            int index = token.indexOf(delimiter2);
+
+            if (index == -1) {
+                throw new RuntimeException("Invalid URL format");
+            }
+
+            String key = token.substring(0, index);
+
+            if (key.equalsIgnoreCase(keyToMatch)) {
+                return token.substring(index + delimiter2.length());
+            }
+        }
+
+        if (throwExceptionIfNotFound) {
+            throw new RuntimeException("Key not found in URL");
+        }
+
+        return null;
+    }
+
     public static String getSolidFireAccountName(String csAccountUuid, long csAccountId) {
         return "CloudStack_" + csAccountUuid + "_" + csAccountId;
     }
 
-    public static void updateCsDbWithSolidFireIopsInfo(long storagePoolId, PrimaryDataStoreDao primaryDataStoreDao, StoragePoolDetailsDao storagePoolDetailsDao,
-            long minIops, long maxIops, long burstIops) {
+    public static void updateCsDbWithSolidFireIopsInfo(long storagePoolId, PrimaryDataStoreDao primaryDataStoreDao,
+                                                       StoragePoolDetailsDao storagePoolDetailsDao, long minIops, long maxIops, long burstIops) {
         Map<String, String> existingDetails = storagePoolDetailsDao.listDetailsKeyPairs(storagePoolId);
         Set<String> existingKeys = existingDetails.keySet();
 
-        Map<String, String> existingDetailsToKeep = new HashMap<String, String>();
+        Map<String, String> existingDetailsToKeep = new HashMap<>();
 
         for (String existingKey : existingKeys) {
             String existingValue = existingDetails.get(existingKey);
@@ -247,50 +321,25 @@ public class SolidFireUtil {
     }
 
     public static void updateCsDbWithSolidFireAccountInfo(long csAccountId, SolidFireUtil.SolidFireAccount sfAccount,
-            long storagePoolId, AccountDetailsDao accountDetailsDao) {
+                                                          long storagePoolId, AccountDetailsDao accountDetailsDao) {
         AccountDetailVO accountDetail = new AccountDetailVO(csAccountId,
                 SolidFireUtil.getAccountKey(storagePoolId),
                 String.valueOf(sfAccount.getId()));
 
         accountDetailsDao.persist(accountDetail);
-
-        /*
-        accountDetail = new AccountDetailVO(csAccountId,
-                SolidFireUtil.CHAP_INITIATOR_USERNAME,
-                String.valueOf(sfAccount.getName()));
-
-        accountDetailsDao.persist(accountDetail);
-
-        accountDetail = new AccountDetailVO(csAccountId,
-                SolidFireUtil.CHAP_INITIATOR_SECRET,
-                String.valueOf(sfAccount.getInitiatorSecret()));
-
-        accountDetailsDao.persist(accountDetail);
-
-        accountDetail = new AccountDetailVO(csAccountId,
-                SolidFireUtil.CHAP_TARGET_USERNAME,
-                sfAccount.getName());
-
-        accountDetailsDao.persist(accountDetail);
-
-        accountDetail = new AccountDetailVO(csAccountId,
-                SolidFireUtil.CHAP_TARGET_SECRET,
-                sfAccount.getTargetSecret());
-
-        accountDetailsDao.persist(accountDetail);
-        */
     }
 
-    public static SolidFireAccount getSolidFireAccount(SolidFireConnection sfConnection, String sfAccountName) {
+    public static SolidFireAccount getAccount(SolidFireConnection sfConnection, String sfAccountName) {
         try {
-            return getSolidFireAccountByName(sfConnection, sfAccountName);
+            return getAccountByName(sfConnection, sfAccountName);
         } catch (Exception ex) {
             return null;
         }
     }
 
     public static void hostAddedToOrRemovedFromCluster(long hostId, long clusterId, boolean added, String storageProvider,
-            ClusterDao clusterDao, ClusterDetailsDao clusterDetailsDao, PrimaryDataStoreDao storagePoolDao, StoragePoolDetailsDao storagePoolDetailsDao, HostDao hostDao) {
+            ClusterDao clusterDao, ClusterDetailsDao clusterDetailsDao, PrimaryDataStoreDao storagePoolDao,
+            StoragePoolDetailsDao storagePoolDetailsDao, HostDao hostDao) {
         ClusterVO cluster = clusterDao.findById(clusterId);
 
         GlobalLock lock = GlobalLock.getInternLock(cluster.getUuid());
@@ -307,7 +356,7 @@ public class SolidFireUtil {
             List<StoragePoolVO> storagePools = storagePoolDao.findPoolsByProvider(storageProvider);
 
             if (storagePools != null && storagePools.size() > 0) {
-                List<SolidFireUtil.SolidFireConnection> sfConnections = new ArrayList<SolidFireUtil.SolidFireConnection>();
+                List<SolidFireUtil.SolidFireConnection> sfConnections = new ArrayList<>();
 
                 for (StoragePoolVO storagePool : storagePools) {
                     ClusterDetailsVO clusterDetail = clusterDetailsDao.findDetail(clusterId, SolidFireUtil.getVagKey(storagePool.getId()));
@@ -320,7 +369,7 @@ public class SolidFireUtil {
                         if (!sfConnections.contains(sfConnection)) {
                             sfConnections.add(sfConnection);
 
-                            SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getSolidFireVag(sfConnection, Long.parseLong(vagId));
+                            SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getVag(sfConnection, Long.parseLong(vagId));
 
                             List<HostVO> hostsToAddOrRemove = new ArrayList<>();
                             HostVO hostToAddOrRemove = hostDao.findByIdIncludingRemoved(hostId);
@@ -329,7 +378,7 @@ public class SolidFireUtil {
 
                             String[] hostIqns = SolidFireUtil.getNewHostIqns(sfVag.getInitiators(), SolidFireUtil.getIqnsFromHosts(hostsToAddOrRemove), added);
 
-                            SolidFireUtil.modifySolidFireVag(sfConnection, sfVag.getId(), hostIqns, sfVag.getVolumeIds());
+                            SolidFireUtil.modifyVag(sfConnection, sfVag.getId(), hostIqns, sfVag.getVolumeIds());
                         }
                     }
                 }
@@ -342,7 +391,7 @@ public class SolidFireUtil {
     }
 
     public static long placeVolumeInVolumeAccessGroup(SolidFireConnection sfConnection, long sfVolumeId, long storagePoolId,
-            String vagUuid, List<HostVO> hosts, ClusterDetailsDao clusterDetailsDao) {
+                                                      String vagUuid, List<HostVO> hosts, ClusterDetailsDao clusterDetailsDao) {
         if (hosts == null || hosts.isEmpty()) {
             throw new CloudRuntimeException("There must be at least one host in the cluster.");
         }
@@ -350,7 +399,7 @@ public class SolidFireUtil {
         long lVagId;
 
         try {
-            lVagId = SolidFireUtil.createSolidFireVag(sfConnection, "CloudStack-" + vagUuid,
+            lVagId = SolidFireUtil.createVag(sfConnection, "CloudStack-" + vagUuid,
                 SolidFireUtil.getIqnsFromHosts(hosts), new long[] { sfVolumeId });
         }
         catch (Exception ex) {
@@ -367,7 +416,7 @@ public class SolidFireUtil {
 
             long[] volumeIds = getNewVolumeIds(sfVag.getVolumeIds(), sfVolumeId, true);
 
-            SolidFireUtil.modifySolidFireVag(sfConnection, lVagId, sfVag.getInitiators(), volumeIds);
+            SolidFireUtil.modifyVag(sfConnection, lVagId, sfVag.getInitiators(), volumeIds);
         }
 
         ClusterDetailsVO clusterDetail = new ClusterDetailsVO(hosts.get(0).getClusterId(), getVagKey(storagePoolId), String.valueOf(lVagId));
@@ -391,40 +440,6 @@ public class SolidFireUtil {
         return true;
     }
 
-    public static String[] getNewHostIqns(String[] iqns, String[] iqnsToAddOrRemove, boolean add) {
-        if (add) {
-            return getNewHostIqnsAdd(iqns, iqnsToAddOrRemove);
-        }
-
-        return getNewHostIqnsRemove(iqns, iqnsToAddOrRemove);
-    }
-
-    private static String[] getNewHostIqnsAdd(String[] iqns, String[] iqnsToAdd) {
-        List<String> lstIqns = iqns != null ? new ArrayList<>(Arrays.asList(iqns)) : new ArrayList<String>();
-
-        if (iqnsToAdd != null) {
-            for (String iqnToAdd : iqnsToAdd) {
-                if (!lstIqns.contains(iqnToAdd)) {
-                    lstIqns.add(iqnToAdd);
-                }
-            }
-        }
-
-        return lstIqns.toArray(new String[0]);
-    }
-
-    private static String[] getNewHostIqnsRemove(String[] iqns, String[] iqnsToRemove) {
-        List<String> lstIqns = iqns != null ? new ArrayList<>(Arrays.asList(iqns)) : new ArrayList<String>();
-
-        if (iqnsToRemove != null) {
-            for (String iqnToRemove : iqnsToRemove) {
-                lstIqns.remove(iqnToRemove);
-            }
-        }
-
-        return lstIqns.toArray(new String[0]);
-    }
-
     public static long[] getNewVolumeIds(long[] volumeIds, long volumeIdToAddOrRemove, boolean add) {
         if (add) {
             return getNewVolumeIdsAdd(volumeIds, volumeIdToAddOrRemove);
@@ -433,54 +448,6 @@ public class SolidFireUtil {
         return getNewVolumeIdsRemove(volumeIds, volumeIdToAddOrRemove);
     }
 
-    private static long[] getNewVolumeIdsAdd(long[] volumeIds, long volumeIdToAdd) {
-        List<Long> lstVolumeIds = new ArrayList<Long>();
-
-        if (volumeIds != null) {
-            for (long volumeId : volumeIds) {
-                lstVolumeIds.add(volumeId);
-            }
-        }
-
-        if (lstVolumeIds.contains(volumeIdToAdd)) {
-            return volumeIds;
-        }
-
-        lstVolumeIds.add(volumeIdToAdd);
-
-        return convertArray(lstVolumeIds);
-    }
-
-    private static long[] getNewVolumeIdsRemove(long[] volumeIds, long volumeIdToRemove) {
-        List<Long> lstVolumeIds = new ArrayList<Long>();
-
-        if (volumeIds != null) {
-            for (long volumeId : volumeIds) {
-                lstVolumeIds.add(volumeId);
-            }
-        }
-
-        lstVolumeIds.remove(volumeIdToRemove);
-
-        return convertArray(lstVolumeIds);
-    }
-
-    private static long[] convertArray(List<Long> items) {
-        if (items == null) {
-            return new long[0];
-        }
-
-        long[] outArray = new long[items.size()];
-
-        for (int i = 0; i < items.size(); i++) {
-            Long value = items.get(i);
-
-            outArray[i] = value;
-        }
-
-        return outArray;
-    }
-
     public static String getVagKey(long storagePoolId) {
         return "sfVolumeAccessGroup_" + storagePoolId;
     }
@@ -499,61 +466,6 @@ public class SolidFireUtil {
         return accountDetail;
     }
 
-    public static String[] getIqnsFromHosts(List<? extends Host> hosts) {
-        if (hosts == null || hosts.size() == 0) {
-            throw new CloudRuntimeException("There do not appear to be any hosts in this cluster.");
-        }
-
-        List<String> lstIqns = new ArrayList<String>();
-
-        for (Host host : hosts) {
-            lstIqns.add(host.getStorageUrl());
-        }
-
-        return lstIqns.toArray(new String[0]);
-    }
-
-    // this method takes in a collection of hosts and tries to find an existing VAG that has all of them in it
-    // if successful, the VAG is returned; else, a CloudRuntimeException is thrown and this issue should be corrected by an admin
-    private static SolidFireUtil.SolidFireVag getCompatibleVag(SolidFireConnection sfConnection, List<HostVO> hosts) {
-        List<SolidFireUtil.SolidFireVag> sfVags = SolidFireUtil.getAllSolidFireVags(sfConnection);
-
-        if (sfVags != null) {
-            List<String> hostIqns = new ArrayList<String>();
-
-            // where the method we're in is called, hosts should not be null
-            for (HostVO host : hosts) {
-                // where the method we're in is called, host.getStorageUrl() should not be null (it actually should start with "iqn")
-                hostIqns.add(host.getStorageUrl().toLowerCase());
-            }
-
-            for (SolidFireUtil.SolidFireVag sfVag : sfVags) {
-                List<String> lstInitiators = getStringArrayAsLowerCaseStringList(sfVag.getInitiators());
-
-                // lstInitiators should not be returned from getStringArrayAsLowerCaseStringList as null
-                if (lstInitiators.containsAll(hostIqns)) {
-                    return sfVag;
-                }
-            }
-        }
-
-        throw new CloudRuntimeException("Unable to locate the appropriate SolidFire Volume Access Group");
-    }
-
-    private static List<String> getStringArrayAsLowerCaseStringList(String[] aString) {
-        List<String> lstLowerCaseString = new ArrayList<String>();
-
-        if (aString != null) {
-            for (String str : aString) {
-                if (str != null) {
-                    lstLowerCaseString.add(str.toLowerCase());
-                }
-            }
-        }
-
-        return lstLowerCaseString;
-    }
-
     public static String getSolidFireVolumeName(String strCloudStackVolumeName) {
         final String specialChar = "-";
 
@@ -572,251 +484,95 @@ public class SolidFireUtil {
         return strSolidFireVolumeName.toString();
     }
 
-    public static long createSolidFireVolume(SolidFireConnection sfConnection, String strSfVolumeName, long lSfAccountId, long lTotalSize,
-            boolean bEnable512e, Map<String, String> mapAttributes, long minIops, long maxIops, long burstIops)
-    {
-        JsonObject volumeToCreate = new JsonObject();
+    public static long createVolume(SolidFireConnection sfConnection, String volumeName, long accountId, long totalSize,
+                                    boolean enable512e, Map<String, String> mapAttributes, long minIops, long maxIops, long burstIops) {
+        CreateVolumeRequest request = CreateVolumeRequest.builder()
+                .name(volumeName)
+                .accountID(accountId)
+                .totalSize(totalSize)
+                .enable512e(enable512e)
+                .optionalAttributes(convertMap(mapAttributes))
+                .optionalQos(new QoS(Optional.of(minIops), Optional.of(maxIops), Optional.of(burstIops), Optional.EMPTY_LONG))
+                .build();
 
-        volumeToCreate.addProperty("method", "CreateVolume");
+        return getSolidFireElement(sfConnection).createVolume(request).getVolumeID();
+    }
 
-        JsonObject params = new JsonObject();
+    public static void modifyVolume(SolidFireConnection sfConnection, long volumeId, Long totalSize, Map<String, String> mapAttributes,
+                                    long minIops, long maxIops, long burstIops) {
+        ModifyVolumeRequest request = ModifyVolumeRequest.builder()
+                .volumeID(volumeId)
+                .optionalTotalSize(totalSize)
+                .optionalAttributes(convertMap(mapAttributes))
+                .optionalQos(new QoS(Optional.of(minIops), Optional.of(maxIops), Optional.of(burstIops), Optional.EMPTY_LONG))
+                .build();
 
-        volumeToCreate.add("params", params);
+        getSolidFireElement(sfConnection).modifyVolume(request);
+    }
 
-        params.addProperty("name", strSfVolumeName);
-        params.addProperty("accountID", lSfAccountId);
-        params.addProperty("totalSize", lTotalSize);
-        params.addProperty("enable512e", bEnable512e);
+    public static SolidFireVolume getVolume(SolidFireConnection sfConnection, long volumeId) {
+        ListVolumesRequest request = ListVolumesRequest.builder()
+                .optionalStartVolumeID(volumeId)
+                .optionalLimit(1L)
+                .build();
 
-        JsonObject qos = new JsonObject();
+        Volume volume = getSolidFireElement(sfConnection).listVolumes(request).getVolumes()[0];
 
-        params.add("qos", qos);
+        return new SolidFireVolume(volume.getVolumeID(), volume.getName(), volume.getIqn(), volume.getAccountID(), volume.getStatus(),
+                volume.getEnable512e(), volume.getQos().getMinIOPS(), volume.getQos().getMaxIOPS(), volume.getQos().getBurstIOPS(), volume.getTotalSize());
+    }
 
-        qos.addProperty("minIOPS", minIops);
-        qos.addProperty("maxIOPS", maxIops);
-        qos.addProperty("burstIOPS", burstIops);
+    public static void deleteVolume(SolidFireConnection sfConnection, long volumeId) {
+        DeleteVolumeRequest request = DeleteVolumeRequest.builder()
+                .volumeID(volumeId)
+                .build();
 
-        if (mapAttributes != null && mapAttributes.size() > 0) {
-            JsonObject attributes = new JsonObject();
+        getSolidFireElement(sfConnection).deleteVolume(request);
+    }
 
-            params.add("attributes", attributes);
+    private static final String ACTIVE = "active";
 
-            Iterator<Map.Entry<String, String>> itr = mapAttributes.entrySet().iterator();
+    public static class SolidFireVolume {
+        private final long _id;
+        private final String _name;
+        private final String _iqn;
+        private final long _accountId;
+        private final String _status;
+        private final boolean _enable512e;
+        private final long _minIops;
+        private final long _maxIops;
+        private final long _burstIops;
+        private final long _totalSize;
 
-            while (itr.hasNext()) {
-                Map.Entry<String, String> pair = itr.next();
+        SolidFireVolume(long id, String name, String iqn, long accountId, String status, boolean enable512e,
+                        long minIops, long maxIops, long burstIops, long totalSize) {
+            _id = id;
+            _name = name;
+            _iqn = "/" + iqn + "/0";
+            _accountId = accountId;
+            _status = status;
+            _enable512e = enable512e;
+            _minIops = minIops;
+            _maxIops = maxIops;
+            _burstIops = burstIops;
+            _totalSize = totalSize;
+        }
 
-                attributes.addProperty(pair.getKey(), pair.getValue());
-            }
+        public long getId() {
+            return _id;
         }
 
-        final Gson gson = new GsonBuilder().create();
+        public String getName() {
+            return _name;
+        }
 
-        String strVolumeToCreateJson = gson.toJson(volumeToCreate);
+        public String getIqn() {
+            return _iqn;
+        }
 
-        String strVolumeCreateResultJson = executeJsonRpc(sfConnection, strVolumeToCreateJson);
-
-        VolumeCreateResult volumeCreateResult = gson.fromJson(strVolumeCreateResultJson, VolumeCreateResult.class);
-
-        verifyResult(volumeCreateResult.result, strVolumeCreateResultJson, gson);
-
-        return volumeCreateResult.result.volumeID;
-    }
-
-    public static void modifySolidFireVolume(SolidFireConnection sfConnection, long volumeId, Long totalSize, Map<String, String> mapAttributes,
-            long minIops, long maxIops, long burstIops)
-    {
-        JsonObject volumeToModify = new JsonObject();
-
-        volumeToModify.addProperty("method", "ModifyVolume");
-
-        JsonObject params = new JsonObject();
-
-        volumeToModify.add("params", params);
-
-        params.addProperty("volumeID", volumeId);
-
-        if (totalSize != null) {
-            params.addProperty("totalSize", totalSize);
-        }
-
-        JsonObject qos = new JsonObject();
-
-        params.add("qos", qos);
-
-        qos.addProperty("minIOPS", minIops);
-        qos.addProperty("maxIOPS", maxIops);
-        qos.addProperty("burstIOPS", burstIops);
-
-        if (mapAttributes != null && mapAttributes.size() > 0) {
-            JsonObject attributes = new JsonObject();
-
-            params.add("attributes", attributes);
-
-            Iterator<Map.Entry<String, String>> itr = mapAttributes.entrySet().iterator();
-
-            while (itr.hasNext()) {
-                Map.Entry<String, String> pair = itr.next();
-
-                attributes.addProperty(pair.getKey(), pair.getValue());
-            }
-        }
-
-        final Gson gson = new GsonBuilder().create();
-
-        String strVolumeToModifyJson = gson.toJson(volumeToModify);
-
-        String strVolumeModifyResultJson = executeJsonRpc(sfConnection, strVolumeToModifyJson);
-
-        JsonError jsonError = gson.fromJson(strVolumeModifyResultJson, JsonError.class);
-
-        if (jsonError.error != null) {
-            throw new IllegalStateException(jsonError.error.message);
-        }
-    }
-
-    public static SolidFireVolume getSolidFireVolume(SolidFireConnection sfConnection, long lVolumeId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VolumeToGet volumeToGet = new VolumeToGet(lVolumeId);
-
-        String strVolumeToGetJson = gson.toJson(volumeToGet);
-
-        String strVolumeGetResultJson = executeJsonRpc(sfConnection, strVolumeToGetJson);
-
-        VolumeGetResult volumeGetResult = gson.fromJson(strVolumeGetResultJson, VolumeGetResult.class);
-
-        verifyResult(volumeGetResult.result, strVolumeGetResultJson, gson);
-
-        String strVolumeName = getVolumeName(volumeGetResult, lVolumeId);
-        String strVolumeIqn = getVolumeIqn(volumeGetResult, lVolumeId);
-        long lAccountId = getVolumeAccountId(volumeGetResult, lVolumeId);
-        String strVolumeStatus = getVolumeStatus(volumeGetResult, lVolumeId);
-        boolean enable512e = getVolumeEnable512e(volumeGetResult, lVolumeId);
-        long lMinIops = getVolumeMinIops(volumeGetResult, lVolumeId);
-        long lMaxIops = getVolumeMaxIops(volumeGetResult, lVolumeId);
-        long lBurstIops = getVolumeBurstIops(volumeGetResult, lVolumeId);
-        long lTotalSize = getVolumeTotalSize(volumeGetResult, lVolumeId);
-
-        return new SolidFireVolume(lVolumeId, strVolumeName, strVolumeIqn, lAccountId, strVolumeStatus, enable512e,
-                lMinIops, lMaxIops, lBurstIops, lTotalSize);
-    }
-
-    public static List<SolidFireVolume> getSolidFireVolumesForAccountId(SolidFireConnection sfConnection, long lAccountId) {
-        final Gson gson = new GsonBuilder().create();
-
-        VolumesToGetForAccount volumesToGetForAccount = new VolumesToGetForAccount(lAccountId);
-
-        String strVolumesToGetForAccountJson = gson.toJson(volumesToGetForAccount);
-
-        String strVolumesGetForAccountResultJson = executeJsonRpc(sfConnection, strVolumesToGetForAccountJson);
-
-        VolumeGetResult volumeGetResult = gson.fromJson(strVolumesGetForAccountResultJson, VolumeGetResult.class);
-
-        verifyResult(volumeGetResult.result, strVolumesGetForAccountResultJson, gson);
-
-        List<SolidFireVolume> sfVolumes = new ArrayList<SolidFireVolume>();
-
-        for (VolumeGetResult.Result.Volume volume : volumeGetResult.result.volumes) {
-            sfVolumes.add(new SolidFireVolume(volume.volumeID, volume.name, volume.iqn, volume.accountID, volume.status, volume.enable512e,
-                    volume.qos.minIOPS, volume.qos.maxIOPS, volume.qos.burstIOPS, volume.totalSize));
-        }
-
-        return sfVolumes;
-    }
-
-    public static List<SolidFireVolume> getDeletedVolumes(SolidFireConnection sfConnection)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        ListDeletedVolumes listDeletedVolumes = new ListDeletedVolumes();
-
-        String strListDeletedVolumesJson = gson.toJson(listDeletedVolumes);
-
-        String strListDeletedVolumesResultJson = executeJsonRpc(sfConnection, strListDeletedVolumesJson);
-
-        VolumeGetResult volumeGetResult = gson.fromJson(strListDeletedVolumesResultJson, VolumeGetResult.class);
-
-        verifyResult(volumeGetResult.result, strListDeletedVolumesResultJson, gson);
-
-        List<SolidFireVolume> deletedVolumes = new ArrayList<SolidFireVolume> ();
-
-        for (VolumeGetResult.Result.Volume volume : volumeGetResult.result.volumes) {
-            deletedVolumes.add(new SolidFireVolume(volume.volumeID, volume.name, volume.iqn, volume.accountID, volume.status, volume.enable512e,
-                    volume.qos.minIOPS, volume.qos.maxIOPS, volume.qos.burstIOPS, volume.totalSize));
-        }
-
-        return deletedVolumes;
-    }
-
-    public static void deleteSolidFireVolume(SolidFireConnection sfConnection, long lVolumeId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VolumeToDelete volumeToDelete = new VolumeToDelete(lVolumeId);
-
-        String strVolumeToDeleteJson = gson.toJson(volumeToDelete);
-
-        executeJsonRpc(sfConnection, strVolumeToDeleteJson);
-    }
-
-    public static void purgeSolidFireVolume(SolidFireConnection sfConnection, long lVolumeId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VolumeToPurge volumeToPurge = new VolumeToPurge(lVolumeId);
-
-        String strVolumeToPurgeJson = gson.toJson(volumeToPurge);
-
-        executeJsonRpc(sfConnection, strVolumeToPurgeJson);
-    }
-
-    private static final String ACTIVE = "active";
-
-    public static class SolidFireVolume {
-        private final long _id;
-        private final String _name;
-        private final String _iqn;
-        private final long _accountId;
-        private final String _status;
-        private final boolean _enable512e;
-        private final long _minIops;
-        private final long _maxIops;
-        private final long _burstIops;
-        private final long _totalSize;
-
-        public SolidFireVolume(long id, String name, String iqn,
-                long accountId, String status, boolean enable512e,
-                long minIops, long maxIops, long burstIops, long totalSize)
-        {
-            _id = id;
-            _name = name;
-            _iqn = "/" + iqn + "/0";
-            _accountId = accountId;
-            _status = status;
-            _enable512e = enable512e;
-            _minIops = minIops;
-            _maxIops = maxIops;
-            _burstIops = burstIops;
-            _totalSize = totalSize;
-        }
-
-        public long getId() {
-            return _id;
-        }
-
-        public String getName() {
-            return _name;
-        }
-
-        public String getIqn() {
-            return _iqn;
-        }
-
-        public long getAccountId() {
-            return _accountId;
-        }
+        public long getAccountId() {
+            return _accountId;
+        }
 
         public boolean isActive() {
             return ACTIVE.equalsIgnoreCase(_status);
@@ -864,92 +620,34 @@ public class SolidFireUtil {
 
             SolidFireVolume sfv = (SolidFireVolume)obj;
 
-            if (_id == sfv._id && _name.equals(sfv._name) &&
-                _iqn.equals(sfv._iqn) && _accountId == sfv._accountId &&
-                isActive() == sfv.isActive() && getTotalSize() == sfv.getTotalSize()) {
-                return true;
-            }
-
-            return false;
-        }
-    }
-
-    public static class SolidFireSnapshot {
-        private final long _id;
-        private final String _name;
-
-        public SolidFireSnapshot(long id, String name) {
-            _id = id;
-            _name = name;
-        }
-
-        public long getId() {
-            return _id;
-        }
-
-        public String getName() {
-            return _name;
+            return _id == sfv._id && _name.equals(sfv._name) && _iqn.equals(sfv._iqn) && _accountId == sfv._accountId &&
+                    isActive() == sfv.isActive() && getTotalSize() == sfv.getTotalSize();
         }
     }
 
-    public static long createSolidFireSnapshot(SolidFireConnection sfConnection, long lVolumeId, String snapshotName, Map<String, String> mapAttributes) {
-        JsonObject snapshotToCreate = new JsonObject();
-
-        snapshotToCreate.addProperty("method", "CreateSnapshot");
-
-        JsonObject params = new JsonObject();
-
-        snapshotToCreate.add("params", params);
-
-        params.addProperty("volumeID", lVolumeId);
-        params.addProperty("name", snapshotName);
-
-        if (mapAttributes != null && mapAttributes.size() > 0) {
-            JsonObject attributes = new JsonObject();
-
-            params.add("attributes", attributes);
-
-            Iterator<Map.Entry<String, String>> itr = mapAttributes.entrySet().iterator();
-
-            while (itr.hasNext()) {
-                Map.Entry<String, String> pair = itr.next();
+    public static long createSnapshot(SolidFireConnection sfConnection, long volumeId, String snapshotName, Map<String, String> mapAttributes) {
+        CreateSnapshotRequest request = CreateSnapshotRequest.builder()
+                .volumeID(volumeId)
+                .optionalName(snapshotName)
+                .optionalAttributes(convertMap(mapAttributes))
+                .build();
 
-                attributes.addProperty(pair.getKey(), pair.getValue());
-            }
-        }
-
-        final Gson gson = new GsonBuilder().create();
-
-        String strSnapshotToCreateJson = gson.toJson(snapshotToCreate);
-
-        String strSnapshotCreateResultJson = executeJsonRpc(sfConnection, strSnapshotToCreateJson);
-
-        SnapshotCreateResult snapshotCreateResult = gson.fromJson(strSnapshotCreateResultJson, SnapshotCreateResult.class);
-
-        verifyResult(snapshotCreateResult.result, strSnapshotCreateResultJson, gson);
-
-        return snapshotCreateResult.result.snapshotID;
+        return getSolidFireElement(sfConnection).createSnapshot(request).getSnapshotID();
     }
 
-    public static SolidFireSnapshot getSolidFireSnapshot(SolidFireConnection sfConnection, long lVolumeId, long lSnapshotId) {
-        final Gson gson = new GsonBuilder().create();
+    public static SolidFireSnapshot getSnapshot(SolidFireConnection sfConnection, long volumeId, long snapshotId) {
+        ListSnapshotsRequest request = ListSnapshotsRequest.builder()
+                .optionalVolumeID(volumeId)
+                .build();
 
-        SnapshotsToGet snapshotsToGet = new SnapshotsToGet(lVolumeId);
-
-        String strSnapshotsToGetJson = gson.toJson(snapshotsToGet);
-
-        String strSnapshotsGetResultJson = executeJsonRpc(sfConnection, strSnapshotsToGetJson);
-
-        SnapshotsGetResult snapshotsGetResult = gson.fromJson(strSnapshotsGetResultJson, SnapshotsGetResult.class);
-
-        verifyResult(snapshotsGetResult.result, strSnapshotsGetResultJson, gson);
+        Snapshot[] snapshots = getSolidFireElement(sfConnection).listSnapshots(request).getSnapshots();
 
         String snapshotName = null;
 
-        if (snapshotsGetResult.result.snapshots != null) {
-            for (SnapshotsGetResult.Result.Snapshot snapshot : snapshotsGetResult.result.snapshots) {
-                if (snapshot.snapshotID == lSnapshotId) {
-                    snapshotName = snapshot.name;
+        if (snapshots != null) {
+            for (Snapshot snapshot : snapshots) {
+                if (snapshot.getSnapshotID() == snapshotId) {
+                    snapshotName = snapshot.getName();
 
                     break;
                 }
@@ -957,94 +655,60 @@ public class SolidFireUtil {
         }
 
         if (snapshotName == null) {
-            throw new CloudRuntimeException("Could not find SolidFire snapshot ID: " + lSnapshotId + " for the following SolidFire volume ID: " + lVolumeId);
+            throw new CloudRuntimeException("Could not find SolidFire snapshot ID: " + snapshotId + " for the following SolidFire volume ID: " + volumeId);
         }
 
-        return new SolidFireSnapshot(lSnapshotId, snapshotName);
-    }
-
-    public static void deleteSolidFireSnapshot(SolidFireConnection sfConnection, long lSnapshotId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        SnapshotToDelete snapshotToDelete = new SnapshotToDelete(lSnapshotId);
-
-        String strSnapshotToDeleteJson = gson.toJson(snapshotToDelete);
-
-        executeJsonRpc(sfConnection, strSnapshotToDeleteJson);
+        return new SolidFireSnapshot(snapshotId, snapshotName);
     }
 
-    public static void rollBackVolumeToSnapshot(SolidFireConnection sfConnection, long volumeId, long snapshotId) {
-        final Gson gson = new GsonBuilder().create();
-
-        RollbackToInitiate rollbackToInitiate = new RollbackToInitiate(volumeId, snapshotId);
-
-        String strRollbackToInitiateJson = gson.toJson(rollbackToInitiate);
+    public static void deleteSnapshot(SolidFireConnection sfConnection, long snapshotId) {
+        DeleteSnapshotRequest request = DeleteSnapshotRequest.builder()
+                .snapshotID(snapshotId)
+                .build();
 
-        String strRollbackInitiatedResultJson = executeJsonRpc(sfConnection, strRollbackToInitiateJson);
-
-        RollbackInitiatedResult rollbackInitiatedResult = gson.fromJson(strRollbackInitiatedResultJson, RollbackInitiatedResult.class);
-
-        verifyResult(rollbackInitiatedResult.result, strRollbackInitiatedResultJson, gson);
+        getSolidFireElement(sfConnection).deleteSnapshot(request);
     }
 
-    public static long createSolidFireClone(SolidFireConnection sfConnection, long lVolumeId, long lSnapshotId, long sfAccountId,
-            String cloneName, Map<String, String> mapAttributes) {
-        JsonObject cloneToCreate = new JsonObject();
-
-        cloneToCreate.addProperty("method", "CloneVolume");
-
-        JsonObject params = new JsonObject();
-
-        cloneToCreate.add("params", params);
-
-        params.addProperty("volumeID", lVolumeId);
+    public static class SolidFireSnapshot {
+        private final long _id;
+        private final String _name;
 
-        if (lSnapshotId > 0) {
-            params.addProperty("snapshotID", lSnapshotId);
+        SolidFireSnapshot(long id, String name) {
+            _id = id;
+            _name = name;
         }
 
-        params.addProperty("newAccountID", sfAccountId);
-        params.addProperty("name", cloneName);
-
-        if (mapAttributes != null && mapAttributes.size() > 0) {
-            JsonObject attributes = new JsonObject();
-
-            params.add("attributes", attributes);
-
-            Iterator<Map.Entry<String, String>> itr = mapAttributes.entrySet().iterator();
-
-            while (itr.hasNext()) {
-                Map.Entry<String, String> pair = itr.next();
-
-                attributes.addProperty(pair.getKey(), pair.getValue());
-            }
+        public long getId() {
+            return _id;
         }
 
-        final Gson gson = new GsonBuilder().create();
-
-        String strCloneToCreateJson = gson.toJson(cloneToCreate);
-
-        String strCloneCreateResultJson = executeJsonRpc(sfConnection, strCloneToCreateJson);
+        public String getName() {
+            return _name;
+        }
+    }
 
-        CloneCreateResult cloneCreateResult = gson.fromJson(strCloneCreateResultJson, CloneCreateResult.class);
+    public static long createClone(SolidFireConnection sfConnection, long volumeId, long snapshotId, long accountId,
+                                   String cloneName, Map<String, String> mapAttributes) {
+        CloneVolumeRequest request = CloneVolumeRequest.builder()
+                .volumeID(volumeId)
+                .optionalSnapshotID(snapshotId < 1 ? null : snapshotId)
+                .optionalNewAccountID(accountId)
+                .name(cloneName)
+                .optionalAttributes(convertMap(mapAttributes))
+                .build();
 
-        verifyResult(cloneCreateResult.result, strCloneCreateResultJson, gson);
+        CloneVolumeResult result = getSolidFireElement(sfConnection).cloneVolume(request);
 
         // Clone is an async operation. Poll until we get data.
 
-        AsyncJobToPoll asyncJobToPoll = new AsyncJobToPoll(cloneCreateResult.result.asyncHandle);
-
-        String strAsyncJobToPollJson = gson.toJson(asyncJobToPoll);
+        GetAsyncResultRequest asyncResultRequest = GetAsyncResultRequest.builder()
+                .asyncHandle(result.getAsyncHandle())
+                .build();
 
         do {
-            String strAsyncJobResultJson = executeJsonRpc(sfConnection, strAsyncJobToPollJson);
-
-            AsyncJobResult asyncJobResult = gson.fromJson(strAsyncJobResultJson, AsyncJobResult.class);
-
-            verifyResult(asyncJobResult.result, strAsyncJobResultJson, gson);
+            String status = getSolidFireElement(sfConnection).getAsyncResult(asyncResultRequest).getStatus();
 
-            if (asyncJobResult.result.status.equals("complete")) {
+            if (status.equals("complete")) {
                 break;
             }
 
@@ -1057,87 +721,52 @@ public class SolidFireUtil {
         }
         while (true);
 
-        return cloneCreateResult.result.volumeID;
+        return result.getVolumeID();
     }
 
-    public static long createSolidFireAccount(SolidFireConnection sfConnection, String strAccountName)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        AccountToAdd accountToAdd = new AccountToAdd(strAccountName);
-
-        String strAccountAddJson = gson.toJson(accountToAdd);
-
-        String strAccountAddResultJson = executeJsonRpc(sfConnection, strAccountAddJson);
-
-        AccountAddResult accountAddResult = gson.fromJson(strAccountAddResultJson, AccountAddResult.class);
-
-        verifyResult(accountAddResult.result, strAccountAddResultJson, gson);
-
-        return accountAddResult.result.accountID;
-    }
-
-    public static SolidFireAccount getSolidFireAccountById(SolidFireConnection sfConnection, long lSfAccountId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        AccountToGetById accountToGetById = new AccountToGetById(lSfAccountId);
-
-        String strAccountToGetByIdJson = gson.toJson(accountToGetById);
-
-        String strAccountGetByIdResultJson = executeJsonRpc(sfConnection, strAccountToGetByIdJson);
-
-        AccountGetResult accountGetByIdResult = gson.fromJson(strAccountGetByIdResultJson, AccountGetResult.class);
-
-        verifyResult(accountGetByIdResult.result, strAccountGetByIdResultJson, gson);
-
-        String strSfAccountName = accountGetByIdResult.result.account.username;
-        String strSfAccountInitiatorSecret = accountGetByIdResult.result.account.initiatorSecret;
-        String strSfAccountTargetSecret = accountGetByIdResult.result.account.targetSecret;
+    public static long createAccount(SolidFireConnection sfConnection, String accountName) {
+        AddAccountRequest request = AddAccountRequest.builder()
+                .username(accountName)
+                .build();
 
-        return new SolidFireAccount(lSfAccountId, strSfAccountName, strSfAccountInitiatorSecret, strSfAccountTargetSecret);
+        return getSolidFireElement(sfConnection).addAccount(request).getAccountID();
     }
 
-    public static SolidFireAccount getSolidFireAccountByName(SolidFireConnection sfConnection, String strSfAccountName)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        AccountToGetByName accountToGetByName = new AccountToGetByName(strSfAccountName);
-
-        String strAccountToGetByNameJson = gson.toJson(accountToGetByName);
-
-        String strAccountGetByNameResultJson = executeJsonRpc(sfConnection, strAccountToGetByNameJson);
+    public static SolidFireAccount getAccountById(SolidFireConnection sfConnection, long accountId) {
+        GetAccountByIDRequest request = GetAccountByIDRequest.builder()
+                .accountID(accountId)
+                .build();
 
-        AccountGetResult accountGetByNameResult = gson.fromJson(strAccountGetByNameResultJson, AccountGetResult.class);
+        Account sfAccount = getSolidFireElement(sfConnection).getAccountByID(request).getAccount();
 
-        verifyResult(accountGetByNameResult.result, strAccountGetByNameResultJson, gson);
+        String sfAccountName = sfAccount.getUsername();
+        String sfAccountInitiatorSecret = sfAccount.getInitiatorSecret().isPresent() ? sfAccount.getInitiatorSecret().get().toString() : "";
+        String sfAccountTargetSecret = sfAccount.getTargetSecret().isPresent() ? sfAccount.getTargetSecret().get().toString() : "";
 
-        long lSfAccountId = accountGetByNameResult.result.account.accountID;
-        String strSfAccountInitiatorSecret = accountGetByNameResult.result.account.initiatorSecret;
-        String strSfAccountTargetSecret = accountGetByNameResult.result.account.targetSecret;
-
-        return new SolidFireAccount(lSfAccountId, strSfAccountName, strSfAccountInitiatorSecret, strSfAccountTargetSecret);
+        return new SolidFireAccount(accountId, sfAccountName, sfAccountInitiatorSecret, sfAccountTargetSecret);
     }
 
-    public static void deleteSolidFireAccount(SolidFireConnection sfConnection, long lAccountId)
-    {
-        final Gson gson = new GsonBuilder().create();
+    private static SolidFireAccount getAccountByName(SolidFireConnection sfConnection, String accountName) {
+        GetAccountByNameRequest request = GetAccountByNameRequest.builder()
+                .username(accountName)
+                .build();
 
-        AccountToRemove accountToRemove = new AccountToRemove(lAccountId);
+        Account sfAccount = getSolidFireElement(sfConnection).getAccountByName(request).getAccount();
 
-        String strAccountToRemoveJson = gson.toJson(accountToRemove);
+        long sfAccountId = sfAccount.getAccountID();
+        String sfAccountInitiatorSecret = sfAccount.getInitiatorSecret().isPresent() ? sfAccount.getInitiatorSecret().get().toString() : "";
+        String sfAccountTargetSecret = sfAccount.getTargetSecret().isPresent() ? sfAccount.getTargetSecret().get().toString() : "";
 
-        executeJsonRpc(sfConnection, strAccountToRemoveJson);
+        return new SolidFireAccount(sfAccountId, accountName, sfAccountInitiatorSecret, sfAccountTargetSecret);
     }
 
-    public static class SolidFireAccount
-    {
+    public static class SolidFireAccount {
         private final long _id;
         private final String _name;
         private final String _initiatorSecret;
         private final String _targetSecret;
 
-        public SolidFireAccount(long id, String name, String initiatorSecret, String targetSecret) {
+        SolidFireAccount(long id, String name, String initiatorSecret, String targetSecret) {
             _id = id;
             _name = name;
             _initiatorSecret = initiatorSecret;
@@ -1152,14 +781,6 @@ public class SolidFireUtil {
             return _name;
         }
 
-        public String getInitiatorSecret() {
-            return _initiatorSecret;
-        }
-
-        public String getTargetSecret() {
-            return _targetSecret;
-        }
-
         @Override
         public int hashCode() {
             return (_id + _name).hashCode();
@@ -1182,84 +803,58 @@ public class SolidFireUtil {
 
             SolidFireAccount sfa = (SolidFireAccount)obj;
 
-            if (_id == sfa._id && _name.equals(sfa._name) &&
-                _initiatorSecret.equals(sfa._initiatorSecret) &&
-                _targetSecret.equals(sfa._targetSecret)) {
-                return true;
-            }
-
-            return false;
+            return _id == sfa._id && _name.equals(sfa._name) &&
+                    _initiatorSecret.equals(sfa._initiatorSecret) &&
+                    _targetSecret.equals(sfa._targetSecret);
         }
     }
 
-    public static long createSolidFireVag(SolidFireConnection sfConnection, String strVagName,
-            String[] iqns, long[] volumeIds)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VagToCreate vagToCreate = new VagToCreate(strVagName, iqns, volumeIds);
+    private static long createVag(SolidFireConnection sfConnection, String vagName, String[] iqns, long[] volumeIds) {
+        CreateVolumeAccessGroupRequest request = CreateVolumeAccessGroupRequest.builder()
+                .name(vagName)
+                .optionalInitiators(iqns)
+                .optionalVolumes(Longs.asList(volumeIds).toArray(new Long[volumeIds.length]))
+                .build();
 
-        String strVagCreateJson = gson.toJson(vagToCreate);
-
-        String strVagCreateResultJson = executeJsonRpc(sfConnection, strVagCreateJson);
-
-        VagCreateResult vagCreateResult = gson.fromJson(strVagCreateResultJson, VagCreateResult.class);
-
-        verifyResult(vagCreateResult.result, strVagCreateResultJson, gson);
-
-        return vagCreateResult.result.volumeAccessGroupID;
+        return getSolidFireElement(sfConnection).createVolumeAccessGroup(request).getVolumeAccessGroupID();
     }
 
-    public static void modifySolidFireVag(SolidFireConnection sfConnection, long lVagId, String[] iqns, long[] volumeIds)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VagToModify vagToModify = new VagToModify(lVagId, iqns, volumeIds);
+    public static void modifyVag(SolidFireConnection sfConnection, long vagId, String[] iqns, long[] volumeIds) {
+        ModifyVolumeAccessGroupRequest request = ModifyVolumeAccessGroupRequest.builder()
+                .volumeAccessGroupID(vagId)
+                .optionalInitiators(iqns)
+                .optionalVolumes(Longs.asList(volumeIds).toArray(new Long[volumeIds.length]))
+                .build();
 
-        String strVagModifyJson = gson.toJson(vagToModify);
-
-        executeJsonRpc(sfConnection, strVagModifyJson);
+        getSolidFireElement(sfConnection).modifyVolumeAccessGroup(request);
     }
 
-    public static SolidFireVag getSolidFireVag(SolidFireConnection sfConnection, long lVagId)
+    public static SolidFireVag getVag(SolidFireConnection sfConnection, long vagId)
     {
-        final Gson gson = new GsonBuilder().create();
-
-        VagToGet vagToGet = new VagToGet(lVagId);
+        ListVolumeAccessGroupsRequest request = ListVolumeAccessGroupsRequest.builder()
+                .optionalStartVolumeAccessGroupID(vagId)
+                .optionalLimit(1L)
+                .build();
 
-        String strVagToGetJson = gson.toJson(vagToGet);
+        VolumeAccessGroup vag = getSolidFireElement(sfConnection).listVolumeAccessGroups(request).getVolumeAccessGroups()[0];
 
-        String strVagGetResultJson = executeJsonRpc(sfConnection, strVagToGetJson);
+        String[] vagIqns = vag.getInitiators();
+        long[] vagVolumeIds = toPrimitive(vag.getVolumes());
 
-        VagGetResult vagGetResult = gson.fromJson(strVagGetResultJson, VagGetResult.class);
-
-        verifyResult(vagGetResult.result, strVagGetResultJson, gson);
-
-        String[] vagIqns = getVagIqns(vagGetResult, lVagId);
-        long[] vagVolumeIds = getVagVolumeIds(vagGetResult, lVagId);
-
-        return new SolidFireVag(lVagId, vagIqns, vagVolumeIds);
+        return new SolidFireVag(vagId, vagIqns, vagVolumeIds);
     }
 
-    public static List<SolidFireVag> getAllSolidFireVags(SolidFireConnection sfConnection)
+    private static List<SolidFireVag> getAllVags(SolidFireConnection sfConnection)
     {
-        final Gson gson = new GsonBuilder().create();
-
-        AllVags allVags = new AllVags();
+        ListVolumeAccessGroupsRequest request = ListVolumeAccessGroupsRequest.builder().build();
 
-        String strAllVagsJson = gson.toJson(allVags);
+        VolumeAccessGroup[] vags = getSolidFireElement(sfConnection).listVolumeAccessGroups(request).getVolumeAccessGroups();
 
-        String strAllVagsGetResultJson = executeJsonRpc(sfConnection, strAllVagsJson);
+        List<SolidFireVag> lstSolidFireVags = new ArrayList<>();
 
-        VagGetResult allVagsGetResult = gson.fromJson(strAllVagsGetResultJson, VagGetResult.class);
-
-        verifyResult(allVagsGetResult.result, strAllVagsGetResultJson, gson);
-
-        List<SolidFireVag> lstSolidFireVags = new ArrayList<SolidFireVag>();
-
-        if (allVagsGetResult.result.volumeAccessGroups != null ) {
-            for (VagGetResult.Result.Vag vag : allVagsGetResult.result.volumeAccessGroups) {
-                SolidFireVag sfVag = new SolidFireVag(vag.volumeAccessGroupID, vag.initiators, vag.volumes);
+        if (vags != null) {
+            for (VolumeAccessGroup vag : vags) {
+                SolidFireVag sfVag = new SolidFireVag(vag.getVolumeAccessGroupID(), vag.getInitiators(), toPrimitive(vag.getVolumes()));
 
                 lstSolidFireVags.add(sfVag);
             }
@@ -1268,42 +863,26 @@ public class SolidFireUtil {
         return lstSolidFireVags;
     }
 
-    public static void deleteSolidFireVag(SolidFireConnection sfConnection, long lVagId)
-    {
-        final Gson gson = new GsonBuilder().create();
-
-        VagToDelete vagToDelete = new VagToDelete(lVagId);
-
-        String strVagToDeleteJson = gson.toJson(vagToDelete);
-
-        executeJsonRpc(sfConnection, strVagToDeleteJson);
-    }
-
-    public static class SolidFireVag
-    {
+    public static class SolidFireVag {
         private final long _id;
         private final String[] _initiators;
         private final long[] _volumeIds;
 
-        public SolidFireVag(long id, String[] initiators, long[] volumeIds)
-        {
+        SolidFireVag(long id, String[] initiators, long[] volumeIds) {
             _id = id;
             _initiators = initiators;
             _volumeIds = volumeIds;
         }
 
-        public long getId()
-        {
+        public long getId() {
             return _id;
         }
 
-        public String[] getInitiators()
-        {
+        public String[] getInitiators() {
             return _initiators;
         }
 
-        public long[] getVolumeIds()
-        {
+        public long[] getVolumeIds() {
             return _volumeIds;
         }
 
@@ -1327,848 +906,178 @@ public class SolidFireUtil {
                 return false;
             }
 
-            SolidFireVag sfvag = (SolidFireVag)obj;
-
-            if (_id == sfvag._id) {
-                return true;
-            }
+            SolidFireVag sfVag = (SolidFireVag)obj;
 
-            return false;
+            return _id == sfVag._id;
         }
     }
 
-    @SuppressWarnings("unused")
-    private static final class VolumeToGet
-    {
-        private final String method = "ListActiveVolumes";
-        private final VolumeToGetParams params;
+    private static String getVip(String keyToMatch, String url) {
+        String delimiter = ":";
 
-        private VolumeToGet(final long lVolumeId)
-        {
-            params = new VolumeToGetParams(lVolumeId);
-        }
+        String storageVip = getValue(keyToMatch, url);
 
-        private static final class VolumeToGetParams
-        {
-            private final long startVolumeID;
-            private final long limit = 1;
+        int index = storageVip.indexOf(delimiter);
 
-            private VolumeToGetParams(final long lVolumeId)
-            {
-                startVolumeID = lVolumeId;
-            }
-        }
-    }
-
-    @SuppressWarnings("unused")
-    private static final class VolumesToGetForAccount
-    {
-        private final String method = "ListVolumesForAccount";
-        private final VolumesToGetForAccountParams params;
-
-        private VolumesToGetForAccount(final long lAccountId)
-        {
-            params = new VolumesToGetForAccountParams(lAccountId);
-        }
-
-        private static final class VolumesToGetForAccountParams
-        {
-            private final long accountID;
-
-            private VolumesToGetForAccountParams(final long lAccountId)
-            {
-                accountID = lAccountId;
-            }
+        if (index != -1) {
+            return storageVip.substring(0, index);
         }
-    }
 
-    @SuppressWarnings("unused")
-    private static final class ListDeletedVolumes
-    {
-        private final String method = "ListDeletedVolumes";
+        return storageVip;
     }
 
-    @SuppressWarnings("unused")
-    private static final class VolumeToDelete
-    {
-        private final String method = "DeleteVolume";
-        private final VolumeToDeleteParams params;
-
-        private VolumeToDelete(final long lVolumeId) {
-            params = new VolumeToDeleteParams(lVolumeId);
-        }
-
-        private static final class VolumeToDeleteParams {
-            private final long volumeID;
+    private static int getPort(String keyToMatch, String url, int defaultPortNumber) {
+        String delimiter = ":";
 
-            private VolumeToDeleteParams(final long lVolumeId) {
-                volumeID = lVolumeId;
-            }
-        }
-    }
+        String storageVip = getValue(keyToMatch, url);
 
-    @SuppressWarnings("unused")
-    private static final class VolumeToPurge
-    {
-        private final String method = "PurgeDeletedVolume";
-        private final VolumeToPurgeParams params;
+        int index = storageVip.indexOf(delimiter);
 
-        private VolumeToPurge(final long lVolumeId) {
-            params = new VolumeToPurgeParams(lVolumeId);
-        }
+        int portNumber = defaultPortNumber;
 
-        private static final class VolumeToPurgeParams {
-            private final long volumeID;
+        if (index != -1) {
+            String port = storageVip.substring(index + delimiter.length());
 
-            private VolumeToPurgeParams(final long lVolumeId) {
-                volumeID = lVolumeId;
+            try {
+                portNumber = Integer.parseInt(port);
+            } catch (NumberFormatException ex) {
+                throw new IllegalArgumentException("Invalid URL format (port is not an integer)");
             }
         }
-    }
 
-    @SuppressWarnings("unused")
-    private static final class SnapshotsToGet
-    {
-        private final String method = "ListSnapshots";
-        private final SnapshotsToGetParams params;
-
-        private SnapshotsToGet(final long lVolumeId) {
-            params = new SnapshotsToGetParams(lVolumeId);
-        }
-
-        private static final class SnapshotsToGetParams {
-            private final long volumeID;
-
-            private SnapshotsToGetParams(final long lVolumeId) {
-                volumeID = lVolumeId;
-            }
-        }
+        return portNumber;
     }
 
-    @SuppressWarnings("unused")
-    private static final class SnapshotToDelete
-    {
-        private final String method = "DeleteSnapshot";
-        private final SnapshotToDeleteParams params;
-
-        private SnapshotToDelete(final long lSnapshotId) {
-            params = new SnapshotToDeleteParams(lSnapshotId);
+    private static String[] getNewHostIqns(String[] iqns, String[] iqnsToAddOrRemove, boolean add) {
+        if (add) {
+            return getNewHostIqnsAdd(iqns, iqnsToAddOrRemove);
         }
 
-        private static final class SnapshotToDeleteParams {
-            private final long snapshotID;
-
-            private SnapshotToDeleteParams(final long lSnapshotId) {
-                snapshotID = lSnapshotId;
-            }
-        }
+        return getNewHostIqnsRemove(iqns, iqnsToAddOrRemove);
     }
 
-    @SuppressWarnings("unused")
-    private static final class RollbackToInitiate {
-        private final String method = "RollbackToSnapshot";
-        private final RollbackToInitiateParams params;
-
-        private RollbackToInitiate(final long lVolumeId, final long lSnapshotId) {
-            params = new RollbackToInitiateParams(lVolumeId, lSnapshotId);
-        }
-
-        private static final class RollbackToInitiateParams {
-            private final long volumeID;
-            private final long snapshotID;
+    private static String[] getNewHostIqnsAdd(String[] iqns, String[] iqnsToAdd) {
+        List<String> lstIqns = iqns != null ? new ArrayList<>(Arrays.asList(iqns)) : new ArrayList<String>();
 
-            private RollbackToInitiateParams(final long lVolumeId, final long lSnapshotId) {
-                volumeID = lVolumeId;
-                snapshotID = lSnapshotId;
+        if (iqnsToAdd != null) {
+            for (String iqnToAdd : iqnsToAdd) {
+                if (!lstIqns.contains(iqnToAdd)) {
+                    lstIqns.add(iqnToAdd);
+                }
             }
         }
-    }
-
-    @SuppressWarnings("unused")
-    private static final class AccountToAdd
-    {
-        private final String method = "AddAccount";
-        private final AccountToAddParams params;
-
-        private AccountToAdd(final String strAccountName)
-        {
-            params = new AccountToAddParams(strAccountName);
-        }
-
-        private static final class AccountToAddParams
-        {
-            private final String username;
 
-            private AccountToAddParams(final String strAccountName)
-            {
-                username = strAccountName;
-            }
-        }
+        return lstIqns.toArray(new String[0]);
     }
 
-    @SuppressWarnings("unused")
-    private static final class AccountToGetById
-    {
-        private final String method = "GetAccountByID";
-        private final AccountToGetByIdParams params;
-
-        private AccountToGetById(final long lAccountId)
-        {
-            params = new AccountToGetByIdParams(lAccountId);
-        }
-
-        private static final class AccountToGetByIdParams
-        {
-            private final long accountID;
+    private static String[] getNewHostIqnsRemove(String[] iqns, String[] iqnsToRemove) {
+        List<String> lstIqns = iqns != null ? new ArrayList<>(Arrays.asList(iqns)) : new ArrayList<String>();
 
-            private AccountToGetByIdParams(final long lAccountId)
-            {
-                accountID = lAccountId;
+        if (iqnsToRemove != null) {
+            for (String iqnToRemove : iqnsToRemove) {
+                lstIqns.remove(iqnToRemove);
             }
         }
-    }
 
-    @SuppressWarnings("unused")
-    private static final class AccountToGetByName
-    {
-        private final String method = "GetAccountByName";
-        private final AccountToGetByNameParams params;
-
-        private AccountToGetByName(final String strUsername)
-        {
-            params = new AccountToGetByNameParams(strUsername);
-        }
-
-        private static final class AccountToGetByNameParams
-        {
-            private final String username;
-
-            private AccountToGetByNameParams(final String strUsername)
-            {
-                username = strUsername;
-            }
-        }
+        return lstIqns.toArray(new String[0]);
     }
 
-    @SuppressWarnings("unused")
-    private static final class AccountToRemove {
-        private final String method = "RemoveAccount";
-        private final AccountToRemoveParams params;
-
-        private AccountToRemove(final long lAccountId) {
-            params = new AccountToRemoveParams(lAccountId);
-        }
-
-        private static final class AccountToRemoveParams {
-            private final long accountID;
+    private static long[] getNewVolumeIdsAdd(long[] volumeIds, long volumeIdToAdd) {
+        List<Long> lstVolumeIds = new ArrayList<>();
 
-            private AccountToRemoveParams(final long lAccountId) {
-                accountID = lAccountId;
+        if (volumeIds != null) {
+            for (long volumeId : volumeIds) {
+                lstVolumeIds.add(volumeId);
             }
         }
-    }
-
-    @SuppressWarnings("unused")
-    private static final class VagToCreate
-    {
-        private final String method = "CreateVolumeAccessGroup";
-        private final VagToCreateParams params;
 
-        private VagToCreate(final String strVagName, final String[] iqns, final long[] volumeIds)
-        {
-            params = new VagToCreateParams(strVagName, iqns, volumeIds);
+        if (lstVolumeIds.contains(volumeIdToAdd)) {
+            return volumeIds;
         }
 
-        private static final class VagToCreateParams
-        {
-            private final String name;
-            private final String[] initiators;
-            private final long[] volumes;
+        lstVolumeIds.add(volumeIdToAdd);
 
-            private VagToCreateParams(final String strVagName, final String[] iqns, final long[] volumeIds)
-            {
-                name = strVagName;
-                initiators = iqns;
-                volumes = volumeIds;
-            }
-        }
+        return toPrimitive(lstVolumeIds.toArray(new Long[lstVolumeIds.size()]));
     }
 
-    @SuppressWarnings("unused")
-    private static final class VagToModify
-    {
-        private final String method = "ModifyVolumeAccessGroup";
-        private final VagToModifyParams params;
-
-        private VagToModify(final long lVagName, final String[] iqns, final long[] volumeIds)
-        {
-            params = new VagToModifyParams(lVagName, iqns, volumeIds);
-        }
-
-        private static final class VagToModifyParams
-        {
-            private final long volumeAccessGroupID;
-            private final String[] initiators;
-            private final long[] volumes;
+    private static long[] getNewVolumeIdsRemove(long[] volumeIds, long volumeIdToRemove) {
+        List<Long> lstVolumeIds = new ArrayList<>();
 
-            private VagToModifyParams(final long lVagName, final String[] iqns, final long[] volumeIds)
-            {
-                volumeAccessGroupID = lVagName;
-                initiators = iqns;
-                volumes = volumeIds;
+        if (volumeIds != null) {
+            for (long volumeId : volumeIds) {
+                lstVolumeIds.add(volumeId);
             }
         }
-    }
-
-    @SuppressWarnings("unused")
-    private static final class VagToGet
-    {
-        private final String method = "ListVolumeAccessGroups";
-        private final VagToGetParams params;
-
-        private VagToGet(final long lVagId)
-        {
-            params = new VagToGetParams(lVagId);
-        }
 
-        private static final class VagToGetParams
-        {
-            private final long startVolumeAccessGroupID;
-            private final long limit = 1;
+        lstVolumeIds.remove(volumeIdToRemove);
 
-            private VagToGetParams(final long lVagId)
-            {
-                startVolumeAccessGroupID = lVagId;
-            }
-        }
+        return toPrimitive(lstVolumeIds.toArray(new Long[lstVolumeIds.size()]));
     }
 
-    @SuppressWarnings("unused")
-    private static final class AllVags
-    {
-        private final String method = "ListVolumeAccessGroups";
-        private final VagToGetParams params;
-
-        private AllVags()
-        {
-            params = new VagToGetParams();
+    private static String[] getIqnsFromHosts(List<? extends Host> hosts) {
+        if (hosts == null || hosts.size() == 0) {
+            throw new CloudRuntimeException("There do not appear to be any hosts in this cluster.");
         }
 
-        private static final class VagToGetParams
-        {}
-    }
-
-    @SuppressWarnings("unused")
-    private static final class VagToDelete
-    {
-        private final String method = "DeleteVolumeAccessGroup";
-        private final VagToDeleteParams params;
+        List<String> lstIqns = new ArrayList<>();
 
-        private VagToDelete(final long lVagId) {
-            params = new VagToDeleteParams(lVagId);
+        for (Host host : hosts) {
+            lstIqns.add(host.getStorageUrl());
         }
 
-        private static final class VagToDeleteParams {
-            private final long volumeAccessGroupID;
-
-            private VagToDeleteParams(final long lVagId) {
-                volumeAccessGroupID = lVagId;
-            }
-        }
+        return lstIqns.toArray(new String[0]);
     }
 
-    @SuppressWarnings("unused")
-    private static final class AsyncJobToPoll
-    {
-        private final String method = "GetAsyncResult";
-        private final AsyncJobToPollParams params;
-
-        private AsyncJobToPoll(final long asyncHandle)
-        {
-            params = new AsyncJobToPollParams(asyncHandle);
-        }
+    // this method takes in a collection of hosts and tries to find an existing VAG that has all of them in it
+    // if successful, the VAG is returned; else, a CloudRuntimeException is thrown and this issue should be corrected by an admin
+    private static SolidFireUtil.SolidFireVag getCompatibleVag(SolidFireConnection sfConnection, List<HostVO> hosts) {
+        List<SolidFireUtil.SolidFireVag> sfVags = SolidFireUtil.getAllVags(sfConnection);
 
-        private static final class AsyncJobToPollParams
-        {
-            private final long asyncHandle;
+        if (sfVags != null) {
+            List<String> hostIqns = new ArrayList<>();
 
-            private AsyncJobToPollParams(final long asyncHandle)
-            {
-                this.asyncHandle = asyncHandle;
+            // where the method we're in is called, hosts should not be null
+            for (HostVO host : hosts) {
+                // where the method we're in is called, host.getStorageUrl() should not be null (it actually should start with "iqn")
+                hostIqns.add(host.getStorageUrl().toLowerCase());
             }
-        }
-    }
-
-    private static final class VolumeCreateResult {
-        private Result result;
 
-        private static final class Result {
-            private long volumeID;
-        }
-    }
+            for (SolidFireUtil.SolidFireVag sfVag : sfVags) {
+                List<String> lstInitiators = getStringArrayAsLowerCaseStringList(sfVag.getInitiators());
 
-    private static final class VolumeGetResult {
-        private Result result;
-
-        private static final class Result {
-            private Volume[] volumes;
-
-            private static final class Volume {
-                private long volumeID;
-                private String name;
-                private String iqn;
-                private long accountID;
-                private String status;
-                private boolean enable512e;
-                private Qos qos;
-                private long totalSize;
-
-                private static final class Qos {
-                    private long minIOPS;
-                    private long maxIOPS;
-                    private long burstIOPS;
+                // lstInitiators should not be returned from getStringArrayAsLowerCaseStringList as null
+                if (lstInitiators.containsAll(hostIqns)) {
+                    return sfVag;
                 }
             }
         }
-    }
-
-    private static final class SnapshotCreateResult {
-        private Result result;
-
-        private static final class Result {
-            private long snapshotID;
-        }
-    }
-
-    private static final class SnapshotsGetResult {
-        private Result result;
-
-        private static final class Result {
-            private Snapshot[] snapshots;
-
-            private static final class Snapshot {
-                private long snapshotID;
-                private String name;
-            }
-        }
-    }
-
-    @SuppressWarnings("unused")
-    private static final class RollbackInitiatedResult {
-        private Result result;
-
-        private static final class Result {
-            private long snapshotID;
-        }
-    }
-
-    private static final class CloneCreateResult {
-        private Result result;
-
-        private static final class Result {
-            private long volumeID;
-            private long asyncHandle;
-        }
-    }
-
-    private static final class AccountAddResult {
-        private Result result;
-
-        private static final class Result {
-            private long accountID;
-        }
-    }
-
-    private static final class AccountGetResult {
-        private Result result;
-
-        private static final class Result {
-            private Account account;
-
-            private static final class Account {
-                private long accountID;
-                private String username;
-                private String initiatorSecret;
-                private String targetSecret;
-            }
-        }
-    }
-
-    private static final class VagCreateResult {
-        private Result result;
-
-        private static final class Result {
-            private long volumeAccessGroupID;
-        }
-    }
-
-    private static final class VagGetResult
-    {
-        private Result result;
-
-        private static final class Result
-        {
-            private Vag[] volumeAccessGroups;
-
-            private static final class Vag
-            {
-                private long volumeAccessGroupID;
-                private String[] initiators;
-                private long[] volumes;
-            }
-        }
-    }
-
-    private static final class AsyncJobResult {
-        private AsyncResult result;
-
-        private static final class AsyncResult
-        {
-            private String status;
-        }
-    }
-
-    private static final class JsonError
-    {
-        private Error error;
-
-        private static final class Error {
-            private String message;
-        }
-    }
 
-    private static DefaultHttpClient getHttpClient(int iPort) {
-        try {
-            SSLContext sslContext = SSLUtils.getSSLContext();
-            X509TrustManager tm = new X509TrustManager() {
-                @Override
-                public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
-                }
-
-                @Override
-                public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
-                }
-
-                @Override
-                public X509Certificate[] getAcceptedIssuers() {
-                    return null;
-                }
-            };
-
-            sslContext.init(null, new TrustManager[] {tm}, new SecureRandom());
-
-            SSLSocketFactory socketFactory = new SSLSocketFactory(sslContext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-            SchemeRegistry registry = new SchemeRegistry();
-
-            registry.register(new Scheme("https", iPort, socketFactory));
-
-            BasicClientConnectionManager mgr = new BasicClientConnectionManager(registry);
-            DefaultHttpClient client = new DefaultHttpClient();
-
-            return new DefaultHttpClient(mgr, client.getParams());
-        } catch (NoSuchAlgorithmException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        } catch (KeyManagementException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        }
+        throw new CloudRuntimeException("Unable to locate the appropriate SolidFire Volume Access Group");
     }
 
-    private static String executeJsonRpc(SolidFireConnection sfConnection, String strJsonToExecute) {
-        DefaultHttpClient httpClient = null;
-        StringBuilder sb = new StringBuilder();
-
-        try {
-            StringEntity input = new StringEntity(strJsonToExecute);
-
-            input.setContentType("application/json");
-
-            httpClient = getHttpClient(sfConnection.getManagementPort());
-
-            URI uri = new URI("https://" + sfConnection.getManagementVip() + ":" + sfConnection.getManagementPort() + "/json-rpc/6.0");
-            AuthScope authScope = new AuthScope(uri.getHost(), uri.getPort(), AuthScope.ANY_SCHEME);
-            UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(sfConnection.getClusterAdminUsername(), sfConnection.getClusterAdminPassword());
-
-            httpClient.getCredentialsProvider().setCredentials(authScope, credentials);
-
-            HttpPost postRequest = new HttpPost(uri);
-
-            postRequest.setEntity(input);
-
-            HttpResponse response = httpClient.execute(postRequest);
-
-            if (!isSuccess(response.getStatusLine().getStatusCode())) {
-                throw new CloudRuntimeException("Failed on JSON-RPC API call. HTTP error code = " + response.getStatusLine().getStatusCode());
-            }
+    private static List<String> getStringArrayAsLowerCaseStringList(String[] aString) {
+        List<String> lstLowerCaseString = new ArrayList<>();
 
-            try(BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));) {
-                String strOutput;
-                while ((strOutput = br.readLine()) != null) {
-                    sb.append(strOutput);
-                }
-            }catch (IOException ex) {
-                throw new CloudRuntimeException(ex.getMessage());
-            }
-        } catch (UnsupportedEncodingException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        } catch (ClientProtocolException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        } catch (IOException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        } catch (URISyntaxException ex) {
-            throw new CloudRuntimeException(ex.getMessage());
-        } finally {
-            if (httpClient != null) {
-                try {
-                    httpClient.getConnectionManager().shutdown();
-                } catch (Exception t) {
-                    s_logger.info("[ignored]"
-                            + "error shutting down http client: " + t.getLocalizedMessage());
+        if (aString != null) {
+            for (String str : aString) {
+                if (str != null) {
+                    lstLowerCaseString.add(str.toLowerCase());
                 }
             }
         }
 
-        return sb.toString();
-    }
-
-    private static boolean isSuccess(int iCode) {
-        return iCode >= 200 && iCode < 300;
-    }
-
-    private static void verifyResult(Object result, String strJson, Gson gson) throws IllegalStateException {
-        if (result != null) {
-            return;
-        }
-
-        JsonError jsonError = gson.fromJson(strJson, JsonError.class);
-
-        if (jsonError != null) {
-            throw new IllegalStateException(jsonError.error.message);
-        }
-
-        throw new IllegalStateException("Problem with the following JSON: " + strJson);
-    }
-
-    private static String getVolumeName(VolumeGetResult volumeGetResult, long lVolumeId) {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 && volumeGetResult.result.volumes[0].volumeID == lVolumeId) {
-            return volumeGetResult.result.volumes[0].name;
-        }
-
-        throw new CloudRuntimeException("Could not determine the name of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static String getVolumeIqn(VolumeGetResult volumeGetResult, long lVolumeId) {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 && volumeGetResult.result.volumes[0].volumeID == lVolumeId) {
-            return volumeGetResult.result.volumes[0].iqn;
-        }
-
-        throw new CloudRuntimeException("Could not determine the IQN of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static long getVolumeAccountId(VolumeGetResult volumeGetResult, long lVolumeId) {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 && volumeGetResult.result.volumes[0].volumeID == lVolumeId) {
-            return volumeGetResult.result.volumes[0].accountID;
-        }
-
-        throw new CloudRuntimeException("Could not determine the account ID of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static String getVolumeStatus(VolumeGetResult volumeGetResult, long lVolumeId) {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 && volumeGetResult.result.volumes[0].volumeID == lVolumeId) {
-            return volumeGetResult.result.volumes[0].status;
-        }
-
-        throw new CloudRuntimeException("Could not determine the status of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static boolean getVolumeEnable512e(VolumeGetResult volumeGetResult, long lVolumeId)
-    {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 &&
-            volumeGetResult.result.volumes[0].volumeID == lVolumeId)
-        {
-            return volumeGetResult.result.volumes[0].enable512e;
-        }
-
-        throw new CloudRuntimeException("Could not determine the enable 512 emulation of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static long getVolumeMinIops(VolumeGetResult volumeGetResult, long lVolumeId)
-    {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 &&
-            volumeGetResult.result.volumes[0].volumeID == lVolumeId && volumeGetResult.result.volumes[0].qos != null)
-        {
-            return volumeGetResult.result.volumes[0].qos.minIOPS;
-        }
-
-        throw new CloudRuntimeException("Could not determine the min IOPS of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static long getVolumeMaxIops(VolumeGetResult volumeGetResult, long lVolumeId)
-    {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 &&
-            volumeGetResult.result.volumes[0].volumeID == lVolumeId && volumeGetResult.result.volumes[0].qos != null)
-        {
-            return volumeGetResult.result.volumes[0].qos.maxIOPS;
-        }
-
-        throw new CloudRuntimeException("Could not determine the max IOPS of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static long getVolumeBurstIops(VolumeGetResult volumeGetResult, long lVolumeId)
-    {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 &&
-            volumeGetResult.result.volumes[0].volumeID == lVolumeId && volumeGetResult.result.volumes[0].qos != null)
-        {
-            return volumeGetResult.result.volumes[0].qos.burstIOPS;
-        }
-
-        throw new CloudRuntimeException("Could not determine the burst IOPS of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static long getVolumeTotalSize(VolumeGetResult volumeGetResult, long lVolumeId)
-    {
-        if (volumeGetResult.result.volumes != null && volumeGetResult.result.volumes.length == 1 &&
-            volumeGetResult.result.volumes[0].volumeID == lVolumeId)
-        {
-            return volumeGetResult.result.volumes[0].totalSize;
-        }
-
-        throw new CloudRuntimeException("Could not determine the total size of the volume for volume ID of " + lVolumeId + ".");
-    }
-
-    private static String[] getVagIqns(VagGetResult vagGetResult, long lVagId)
-    {
-        if (vagGetResult.result.volumeAccessGroups != null && vagGetResult.result.volumeAccessGroups.length == 1 &&
-            vagGetResult.result.volumeAccessGroups[0].volumeAccessGroupID == lVagId)
-        {
-            return vagGetResult.result.volumeAccessGroups[0].initiators;
-        }
-
-        throw new CloudRuntimeException("Could not determine the IQNs of the volume access group for volume access group ID of " + lVagId + ".");
-    }
-
-    private static long[] getVagVolumeIds(VagGetResult vagGetResult, long lVagId)
-    {
-        if (vagGetResult.result.volumeAccessGroups != null && vagGetResult.result.volumeAccessGroups.length == 1 &&
-            vagGetResult.result.volumeAccessGroups[0].volumeAccessGroupID == lVagId)
-        {
-            return vagGetResult.result.volumeAccessGroups[0].volumes;
-        }
-
-        throw new CloudRuntimeException("Could not determine the volume IDs of the volume access group for volume access group ID of " + lVagId + ".");
-    }
-
-    // used to parse the "url" parameter when creating primary storage that's based on the SolidFire plug-in with the
-    // name SolidFireUtil.PROVIDER_NAME (as opposed to the SolidFire plug-in with the name SolidFireUtil.SHARED_PROVIDER_NAME)
-    // return a String instance that contains at most the MVIP and SVIP info
-    public static String getModifiedUrl(String originalUrl) {
-        StringBuilder sb = new StringBuilder();
-
-        String delimiter = ";";
-
-        StringTokenizer st = new StringTokenizer(originalUrl, delimiter);
-
-        while (st.hasMoreElements()) {
-            String token = st.nextElement().toString().toUpperCase();
-
-            if (token.startsWith(SolidFireUtil.MANAGEMENT_VIP.toUpperCase()) || token.startsWith(SolidFireUtil.STORAGE_VIP.toUpperCase())) {
-                sb.append(token).append(delimiter);
-            }
-        }
-
-        String modifiedUrl = sb.toString();
-        int lastIndexOf = modifiedUrl.lastIndexOf(delimiter);
-
-        if (lastIndexOf == (modifiedUrl.length() - delimiter.length())) {
-            return modifiedUrl.substring(0, lastIndexOf);
-        }
-
-        retu

<TRUNCATED>