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 2015/09/19 03:31:18 UTC

[12/50] git commit: updated refs/heads/sf-plugins to 157efc3

Return additional volume-related data

Add additional volume-delete logic


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

Branch: refs/heads/sf-plugins
Commit: a6e84edba361d8e811c6d678a54fd08e4dfea804
Parents: e34de4a
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Jul 9 14:29:01 2015 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri Sep 18 19:28:19 2015 -0600

----------------------------------------------------------------------
 .../apache/cloudstack/api/helper/ApiHelper.java |   4 +
 .../response/ApiSolidFireVolumeResponse.java    |  51 ++++++++++
 .../solidfire/dataaccess/SfVolume.java          |   4 +
 .../solidfire/dataaccess/vo/SfVolumeVO.java     |   5 +
 ui/plugins/sfSharedVolume/sfSharedVolume.js     | 101 +++++++++++++++++++
 5 files changed, 165 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6e84edb/plugins/api/solidfire/src/org/apache/cloudstack/api/helper/ApiHelper.java
----------------------------------------------------------------------
diff --git a/plugins/api/solidfire/src/org/apache/cloudstack/api/helper/ApiHelper.java b/plugins/api/solidfire/src/org/apache/cloudstack/api/helper/ApiHelper.java
index 9a83404..89c48eb 100644
--- a/plugins/api/solidfire/src/org/apache/cloudstack/api/helper/ApiHelper.java
+++ b/plugins/api/solidfire/src/org/apache/cloudstack/api/helper/ApiHelper.java
@@ -180,6 +180,7 @@ public class ApiHelper {
         sfResponse.setMinIops(sfVolume.getMinIops());
         sfResponse.setMaxIops(sfVolume.getMaxIops());
         sfResponse.setBurstIops(sfVolume.getBurstIops());
+        sfResponse.setCreated(sfVolume.getCreated());
 
         SfVirtualNetwork sfVirtualNetwork = _sfVirtualNetworkDao.findById(sfVolume.getSfVirtualNetworkId());
 
@@ -188,6 +189,7 @@ public class ApiHelper {
         Account account = _accountDao.findById(sfVirtualNetwork.getAccountId());
 
         sfResponse.setAccountUuid(account.getUuid());
+        sfResponse.setAccountName(account.getAccountName());
 
         SfCluster sfCluster = _sfClusterDao.findById(sfVirtualNetwork.getSfClusterId());
 
@@ -196,6 +198,7 @@ public class ApiHelper {
         DataCenterVO dataCenterVO = _zoneDao.findById(sfCluster.getZoneId());
 
         sfResponse.setZoneUuid(dataCenterVO.getUuid());
+        sfResponse.setZoneName(dataCenterVO.getName());
 
         if (ResponseView.Full.equals(responseView)) {
             sfResponse.setClusterName(sfCluster.getName());
@@ -204,6 +207,7 @@ public class ApiHelper {
         sfResponse.setTargetPortal(sfVirtualNetwork.getSvip());
         sfResponse.setVlanId(sfVirtualNetwork.getId());
         sfResponse.setVlanUuid(sfVirtualNetwork.getUuid());
+        sfResponse.setVlanName(sfVirtualNetwork.getName());
 
         AccountDetailVO accountDetail = _accountDetailsDao.findDetail(sfVirtualNetwork.getAccountId(), SolidFireUtil.CHAP_INITIATOR_USERNAME);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6e84edb/plugins/api/solidfire/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeResponse.java
----------------------------------------------------------------------
diff --git a/plugins/api/solidfire/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeResponse.java b/plugins/api/solidfire/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeResponse.java
index e4f0e70..97ab909 100644
--- a/plugins/api/solidfire/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeResponse.java
+++ b/plugins/api/solidfire/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeResponse.java
@@ -16,10 +16,13 @@
 // under the License.
 package org.apache.cloudstack.api.response;
 
+import java.util.Date;
+
 import com.cloud.serializer.Param;
 
 import com.google.gson.annotations.SerializedName;
 
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
 import org.apache.cloudstack.api.helper.ApiHelper;
@@ -67,6 +70,10 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
     @Param(description = "UUID of the account the volume is associated with")
     private String _accountUuid;
 
+    @SerializedName("accountname")
+    @Param(description = "Name of the account the volume is associated with")
+    private String _accountName;
+
     @SerializedName("vlanid")
     @Param(description = "ID of the VLAN the volume is associated with")
     private long _vlanId;
@@ -75,6 +82,10 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
     @Param(description = "UUID of the VLAN the volume is associated with")
     private String _vlanUuid;
 
+    @SerializedName("vlanname")
+    @Param(description = "Name of the VLAN the volume is associated with")
+    private String _vlanName;
+
     @SerializedName("zoneid")
     @Param(description = "ID of the zone the volume is associated with")
     private long _zoneId;
@@ -83,6 +94,10 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
     @Param(description = "UUID of the zone the volume is associated with")
     private String _zoneUuid;
 
+    @SerializedName("zonename")
+    @Param(description = "Name of the zone the volume is associated with")
+    private String _zoneName;
+
     @SerializedName("clustername")
     @Param(description = "Name of cluster the volume belongs to")
     private String _clusterName;
@@ -107,6 +122,10 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
     @Param(description = "CHAP target secret")
     private String _chapTargetSecret;
 
+    @SerializedName(ApiConstants.CREATED)
+    @Param(description = "Date volume was created")
+    private Date _created;
+
     public void setId(long id) {
         _id = id;
     }
@@ -187,6 +206,14 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
         return _accountUuid;
     }
 
+    public void setAccountName(String accountName) {
+        _accountName = accountName;
+    }
+
+    public String getAccountName() {
+        return _accountName;
+    }
+
     public void setVlanId(long vlanId) {
         _vlanId = vlanId;
     }
@@ -203,6 +230,14 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
         return _vlanUuid;
     }
 
+    public void setVlanName(String vlanName) {
+        _vlanName = vlanName;
+    }
+
+    public String getVlanName() {
+        return _vlanName;
+    }
+
     public void setZoneId(long zoneId) {
         _zoneId = zoneId;
     }
@@ -219,6 +254,14 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
         return _zoneUuid;
     }
 
+    public void setZoneName(String zoneName) {
+        _zoneName = zoneName;
+    }
+
+    public String getZoneName() {
+        return _zoneName;
+    }
+
     public void setClusterName(String clusterName) {
         _clusterName = clusterName;
     }
@@ -266,4 +309,12 @@ public class ApiSolidFireVolumeResponse extends BaseResponse {
     public String getTargetInitiatorSecret() {
         return _chapTargetSecret;
     }
+
+    public void setCreated(Date created) {
+        _created = created;
+    }
+
+    public Date getCreated() {
+        return _created;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6e84edb/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/SfVolume.java
----------------------------------------------------------------------
diff --git a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/SfVolume.java b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/SfVolume.java
index d59395d..dd5e11d 100644
--- a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/SfVolume.java
+++ b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/SfVolume.java
@@ -16,6 +16,8 @@
 // under the License.
 package org.apache.cloudstack.solidfire.dataaccess;
 
+import java.util.Date;
+
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
@@ -35,4 +37,6 @@ public interface SfVolume extends Identity, InternalIdentity {
     long getBurstIops();
 
     long getSfVirtualNetworkId();
+
+    Date getCreated();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6e84edb/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/vo/SfVolumeVO.java
----------------------------------------------------------------------
diff --git a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/vo/SfVolumeVO.java b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/vo/SfVolumeVO.java
index f1aede1..9334b51 100644
--- a/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/vo/SfVolumeVO.java
+++ b/plugins/api/solidfire/src/org/apache/cloudstack/solidfire/dataaccess/vo/SfVolumeVO.java
@@ -160,4 +160,9 @@ public class SfVolumeVO implements SfVolume {
     public long getSfVirtualNetworkId() {
         return sfVirtualNetworkId;
     }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6e84edb/ui/plugins/sfSharedVolume/sfSharedVolume.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/sfSharedVolume.js b/ui/plugins/sfSharedVolume/sfSharedVolume.js
index 6eb9cf1..ab76ff3 100644
--- a/ui/plugins/sfSharedVolume/sfSharedVolume.js
+++ b/ui/plugins/sfSharedVolume/sfSharedVolume.js
@@ -230,6 +230,107 @@
                 }
               },
               action: function(args) {
+                $.ajax({
+                  url: createURL('deleteSolidFireVolume'),
+                  data: data,
+                  success: function(json) {
+                    var sfvolumeObj = json.deletesolidfirevolumeresponse.apideletesolidfirevolume;
+
+                    args.response.success({
+                      data: sfvolumeObj
+                    });
+                  },
+                  error: function(json) {
+                    args.response.error(parseXMLHttpResponse(json));
+                  }
+                });
+              }
+            }
+          },
+          tabs: {
+            details: {
+              title: 'label.details',
+              preFilter: function(args) {
+                var hiddenFields;
+
+                if (isAdmin()) {
+                  hiddenFields = [];
+                } else {
+                  hiddenFields = ['clustername', 'accountname'];
+                }
+
+                return hiddenFields;
+              },
+              fields: [
+                {
+                  name: {
+                    label: 'label.name'
+                  }
+                },
+                {
+                  uuid: {
+                    label: 'label.id'
+                  },
+                  clustername: {
+                    label: 'Cluster'
+                  },
+                  zonename: {
+                    label: 'label.zone'
+                  },
+                  accountname: {
+                    label: 'label.account'
+                  },
+                  vlanname: {
+                    label: 'VLAN'
+                  },
+                  size: {
+                    label: 'label.disk.size.gb'
+                  },
+                  miniops: {
+                    label: 'label.disk.iops.min'
+                  },
+                  maxiops: {
+                    label: 'label.disk.iops.max'
+                  },
+                  burstiops: {
+                    label: 'Burst IOPS'
+                  },
+                  targetportal: {
+                    label: 'Target Portal'
+                  },
+                  iqn: {
+                    label: 'IQN'
+                  },
+                  chapinitiatorusername: {
+                    label: 'Initiator Username'
+                  },
+                  chapinitiatorsecret: {
+                    label: 'Initiator Secret'
+                  },
+                  created: {
+                    label: 'label.created',
+                    converter: cloudStack.converters.toLocalDate
+                  }
+                }
+              ],
+              tags: cloudStack.api.tags({
+                resourceType: 'Volume',
+                contextId: 'volumes'
+              }),
+              dataProvider: function(args) {
+                $.ajax({
+                  url: createURL("listSolidFireVolumes&id=" + args.context.volumes[0].id),
+                  dataType: "json",
+                  async: true,
+                  success: function(json) {
+                    var jsonObj = json.listsolidfirevolumesresponse.sfvolume[0];
+
+                    args.response.success({
+                      actionFilter: volumeActionfilter,
+                      data: jsonObj
+                    });
+                  }
+                });
               }
             }
           }