cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [1/3] first commit of improvised cloudbyte storage plugin
Date Fri, 18 Jul 2014 03:35:16 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master b080eaf32 -> f3cbb6999


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiService.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiService.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiService.java
new file mode 100644
index 0000000..3e75704
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.util;
+
+import org.apache.cloudstack.api.response.ListResponse;
+
+import com.cloud.utils.component.PluggableService;
+
+public interface ElastistorVolumeApiService extends PluggableService {
+
+    ListResponse<ListElastistorVolumeResponse> listElastistorVolume(ListElastistorVolumeCmd
cmd);
+
+    ListResponse<ListElastistorPoolResponse> listElastistorPools(ListElastistorPoolCmd
cmd);
+
+    ListResponse<ListElastistorInterfaceResponse> listElastistorInterfaces(ListElastistorInterfaceCmd
cmd);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiServiceImpl.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiServiceImpl.java
new file mode 100644
index 0000000..8919483
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ElastistorVolumeApiServiceImpl.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.provider.ElastistorPrimaryDataStoreProvider;
+import org.apache.cloudstack.storage.datastore.util.ElastistorUtil.FileSystem;
+import org.apache.cloudstack.storage.datastore.util.ElastistorUtil.ListInterfacesResponse;
+import org.apache.cloudstack.storage.datastore.util.ElastistorUtil.ListPoolsResponse;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.storage.dao.VolumeDetailsDao;
+import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.dao.UserVmDao;
+
+@Component
+public class ElastistorVolumeApiServiceImpl extends ManagerBase implements ElastistorVolumeApiService
{
+    private static final Logger s_logger = Logger.getLogger(ElastistorVolumeApiServiceImpl.class);
+
+    @Inject
+    protected VolumeDao _volsDao;
+    @Inject
+    protected UserVmDao _userVmDao;
+    @Inject
+    protected DiskOfferingDao _diskOfferingDao;
+    @Inject
+    private PrimaryDataStoreDao _storagePoolDao;
+    @Inject
+    VolumeService volService;
+    @Inject
+    VolumeDataFactory volFactory;
+    @Inject
+    ElastistorPrimaryDataStoreProvider esProvider;
+    @Inject
+    VolumeDetailsDao volumeDetailsDao;
+
+    @Override
+    public List<Class<?>> getCommands() {
+
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(ListElastistorVolumeCmd.class);
+        cmdList.add(ListElastistorPoolCmd.class);
+        cmdList.add(ListElastistorInterfaceCmd.class);
+
+        s_logger.info("Commands were registered successfully with elastistor volume api service.
[cmdcount:" + cmdList.size() + "]");
+        return cmdList;
+
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
+        _name = name;
+        _configParams = params;
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        return true;
+    }
+
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public ListResponse<ListElastistorVolumeResponse> listElastistorVolume(ListElastistorVolumeCmd
cmd) {
+
+        try {
+            FileSystem listVolumeResponse = ElastistorUtil.listVolume(cmd.getId());
+
+            List<ListElastistorVolumeResponse> volumeResponses = new ArrayList<ListElastistorVolumeResponse>();
+
+            ListElastistorVolumeResponse volumeResponse;
+
+            volumeResponse = new ListElastistorVolumeResponse();
+
+            volumeResponse.setId(listVolumeResponse.getUuid());
+            volumeResponse.setName(listVolumeResponse.getName());
+            volumeResponse.setGraceAllowed(listVolumeResponse.getGraceallowed());
+            volumeResponse.setDeduplication(listVolumeResponse.getDeduplication());
+            volumeResponse.setCompression(listVolumeResponse.getCompression());
+            volumeResponse.setSync(listVolumeResponse.getSync());
+            // set object name for a better json structure
+            volumeResponse.setObjectName("elastistorvolume");
+            volumeResponses.add(volumeResponse);
+
+            ListResponse<ListElastistorVolumeResponse> response = new ListResponse<ListElastistorVolumeResponse>();
+
+            response.setResponses(volumeResponses);
+
+            return response;
+        } catch (Throwable e) {
+            s_logger.error("Unable to list elastistor volume.", e);
+            throw new CloudRuntimeException("Unable to list elastistor volume. " + e.getMessage());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public ListResponse<ListElastistorPoolResponse> listElastistorPools(ListElastistorPoolCmd
cmd) {
+
+        try {
+            ListPoolsResponse listPools = ElastistorUtil.ListElastistorPools();
+
+            List<ListElastistorPoolResponse> poolResponses = new ArrayList<ListElastistorPoolResponse>();
+
+            ListElastistorPoolResponse elastistorPoolResponse;
+
+            for (int i = 0; i < listPools.getPools().getCount(); i++) {
+                // Always instantiate inside the loop
+                elastistorPoolResponse = new ListElastistorPoolResponse();
+
+                elastistorPoolResponse.setId(listPools.getPools().getPool(i).getUuid());
+                elastistorPoolResponse.setName(listPools.getPools().getPool(i).getName());
+                elastistorPoolResponse.setAvailIOPS(Long.parseLong(listPools.getPools().getPool(i).getAvailIOPS()));
+                elastistorPoolResponse.setCurrentAvailableSpace(Long.parseLong(listPools.getPools().getPool(i).getAvailableSpace()));
+                elastistorPoolResponse.setState(listPools.getPools().getPool(i).getState());
+                elastistorPoolResponse.setControllerid(listPools.getPools().getPool(i).getControllerid());
+                elastistorPoolResponse.setGateway(listPools.getPools().getPool(i).getGateway());
+
+                // set object name for a better json structure
+                elastistorPoolResponse.setObjectName("elastistorpool");
+                poolResponses.add(elastistorPoolResponse);
+            }
+
+            ListResponse<ListElastistorPoolResponse> response = new ListResponse<ListElastistorPoolResponse>();
+
+            response.setResponses(poolResponses);
+
+            return response;
+
+        } catch (Throwable e) {
+            s_logger.error("Unable to list elastistor pools.", e);
+            throw new CloudRuntimeException("Unable to list elastistor pools. " + e.getMessage());
+        }
+
+    }
+
+    @Override
+    public ListResponse<ListElastistorInterfaceResponse> listElastistorInterfaces(ListElastistorInterfaceCmd
cmd) {
+        try {
+            ListInterfacesResponse listInterfacesResponse = ElastistorUtil.ListElastistorInterfaces(cmd.getControllerId());
+
+            List<ListElastistorInterfaceResponse> interfaceResponses = new ArrayList<ListElastistorInterfaceResponse>();
+
+            ListElastistorInterfaceResponse interfaceResponse;
+
+            for (int i = 0; i < listInterfacesResponse.getInterfaces().getCount(); i++)
{
+                // Always instantiate inside the loop
+                interfaceResponse = new ListElastistorInterfaceResponse();
+
+                interfaceResponse.setId(listInterfacesResponse.getInterfaces().getInterface(i).getUuid());
+                interfaceResponse.setName(listInterfacesResponse.getInterfaces().getInterface(i).getName());
+                interfaceResponse.setStatus(listInterfacesResponse.getInterfaces().getInterface(i).getStatus());
+
+                // set object name for a better json structure
+                interfaceResponse.setObjectName("elastistorInterface");
+                interfaceResponses.add(interfaceResponse);
+            }
+
+            ListResponse<ListElastistorInterfaceResponse> response = new ListResponse<ListElastistorInterfaceResponse>();
+
+            response.setResponses(interfaceResponses);
+
+            return response;
+        } catch (Throwable e) {
+            s_logger.error("Unable to list elastistor interfaces.", e);
+            throw new CloudRuntimeException("Unable to list elastistor interfaces. " + e.getMessage());
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceCmd.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceCmd.java
new file mode 100644
index 0000000..0dd6869
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceCmd.java
@@ -0,0 +1,58 @@
+// Copyright 2012-2013 CloudByte Inc.
+package org.apache.cloudstack.storage.datastore.util;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listElastistorInterface", description = "Lists the network Interfaces
of elastistor", responseObject = ListElastistorVolumeResponse.class)
+public class ListElastistorInterfaceCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ListElastistorInterfaceCmd.class.getName());
+    private static final String s_name = "listElastistorInterfaceResponse";
+
+    @Inject
+    ElastistorVolumeApiService _ElastistorVolumeApiService;
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = "controllerid", type = CommandType.STRING, description = "controller
id")
+    private String controllerid;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public String getControllerId() {
+        return controllerid;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+
+        ListResponse<ListElastistorInterfaceResponse> response = _ElastistorVolumeApiService.listElastistorInterfaces(this);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceResponse.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceResponse.java
new file mode 100644
index 0000000..cefe0d5
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorInterfaceResponse.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.datastore.util;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class ListElastistorInterfaceResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the id of the NIC")
+    private String id;
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description = "the name of the NIC")
+    private String name;
+
+    @SerializedName(ApiConstants.STATUS)
+    @Param(description = "the status of the NIC")
+    private String status;
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return id;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolCmd.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolCmd.java
new file mode 100644
index 0000000..4c9f714
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolCmd.java
@@ -0,0 +1,61 @@
+// Copyright 2012-2013 CloudByte Inc.
+package org.apache.cloudstack.storage.datastore.util;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseCmd.CommandType;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listElastistorPool", description = "Lists the pools of elastistor",
+        responseObject = ListElastistorPoolResponse.class)
+public class ListElastistorPoolCmd extends BaseCmd {
+    public static final Logger  s_logger = Logger.getLogger(ListElastistorPoolCmd.class.getName());
+    private static final String s_name   = "listElastistorPoolResponse";
+
+    @Inject
+    ElastistorVolumeApiService  _ElastistorVolumeApiService;
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of
the Pool")
+    private Long                id;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+
+        ListResponse<ListElastistorPoolResponse> response = _ElastistorVolumeApiService.listElastistorPools(this);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolResponse.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolResponse.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolResponse.java
new file mode 100644
index 0000000..4b238bc
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorPoolResponse.java
@@ -0,0 +1,114 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.datastore.util;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+public class ListElastistorPoolResponse extends BaseResponse {
+    @SerializedName("id")
+    @Param(description = "the ID of the storage pool")
+    private String id;
+
+    @SerializedName("name")
+    @Param(description = "the name of the storage pool")
+    private String name;
+
+    @SerializedName(ApiConstants.STATE)
+    @Param(description = "the state of the storage pool")
+    private String state;
+
+    @SerializedName(ApiConstants.SIZE)
+    @Param(description = "the current available space of the pool")
+    private Long currentAvailableSpace;
+
+    @SerializedName(ApiConstants.MAX_IOPS)
+    @Param(description = "available iops of the pool")
+    private Long availIOPS;
+
+    @SerializedName("controllerid")
+    @Param(description = "controller of the pool")
+    private String controllerid;
+
+    @SerializedName("gateway")
+    @Param(description = "default gateway of the pool")
+    private String gateway;
+
+    @Override
+    public String getObjectId() {
+        return this.getId();
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public Long getCurrentAvailableSpace() {
+        return currentAvailableSpace;
+    }
+
+    public void setCurrentAvailableSpace(Long currentAvailableSpace) {
+        this.currentAvailableSpace = currentAvailableSpace;
+    }
+
+    public Long getAvailIOPS() {
+        return availIOPS;
+    }
+
+    public void setAvailIOPS(Long availIOPS) {
+        this.availIOPS = availIOPS;
+    }
+
+    public String getControllerid() {
+        return controllerid;
+    }
+
+    public void setControllerid(String controllerid) {
+        this.controllerid = controllerid;
+    }
+
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeCmd.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeCmd.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeCmd.java
new file mode 100644
index 0000000..985eeb9
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeCmd.java
@@ -0,0 +1,59 @@
+// Copyright 2012-2013 CloudByte Inc.
+package org.apache.cloudstack.storage.datastore.util;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listElastistorVolume", description = "Lists the volumes of elastistor",
responseObject = ListElastistorVolumeResponse.class)
+public class ListElastistorVolumeCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ListElastistorVolumeCmd.class.getName());
+    private static final String s_name = "listElastistorVolumeResponse";
+
+    @Inject
+    ElastistorVolumeApiService _ElastistorVolumeApiService;
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description
= "the ID of the account")
+    private String id;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public String getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() {
+
+        ListResponse<ListElastistorVolumeResponse> response = _ElastistorVolumeApiService.listElastistorVolume(this);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3cbb699/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeResponse.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeResponse.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeResponse.java
new file mode 100644
index 0000000..a9838dd
--- /dev/null
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/util/ListElastistorVolumeResponse.java
@@ -0,0 +1,99 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.datastore.util;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class ListElastistorVolumeResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the id of the volume")
+    private String id;
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description = "the name of the volume")
+    private String name;
+
+    @SerializedName("graceallowed")
+    @Param(description = "graceallowed")
+    private String graceAllowed;
+
+    @SerializedName("deduplication")
+    @Param(description = "deduplication")
+    private String deduplication;
+
+    @SerializedName("compression")
+    @Param(description = "compression")
+    private String compression;
+
+    @SerializedName("sync")
+    @Param(description = "syncronization")
+    private String sync;
+
+    public String getGraceAllowed() {
+        return graceAllowed;
+    }
+
+    public void setGraceAllowed(String graceAllowed) {
+        this.graceAllowed = graceAllowed;
+    }
+
+    public String getDeduplication() {
+        return deduplication;
+    }
+
+    public void setDeduplication(String deduplication) {
+        this.deduplication = deduplication;
+    }
+
+    public String getCompression() {
+        return compression;
+    }
+
+    public void setCompression(String compression) {
+        this.compression = compression;
+    }
+
+    public String getSync() {
+        return sync;
+    }
+
+    public void setSync(String sync) {
+        this.sync = sync;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return id;
+    }
+
+}


Mime
View raw message