cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [12/50] [abbrv] git commit: refs/heads/vim51_win8 - CloudStack CLOUDSTACK-723 Enhanced baremetal servers support on Cisco UCS
Date Sat, 02 Mar 2013 01:01:28 GMT
CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

change API response in line with new API response convention

Conflicts:

	api/src/org/apache/cloudstack/api/ApiConstants.java


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

Branch: refs/heads/vim51_win8
Commit: dcef281bad3c933ffc73b7eefbd9e1ea981614fc
Parents: 558b808
Author: frank <frank.zhang@citrix.com>
Authored: Tue Feb 26 16:30:58 2013 -0800
Committer: frank <frank@frank-dell.(none)>
Committed: Thu Feb 28 15:40:41 2013 -0800

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java    |    4 +
 .../ucs/src/com/cloud/ucs/database/UcsBladeVO.java |    6 +-
 .../com/cloud/ucs/manager/AddUcsManagerCmd.java    |   13 +-
 .../cloud/ucs/manager/AddUcsManagerResponse.java   |   69 ----------
 .../ucs/manager/AssociateUcsProfileToBladeCmd.java |   11 +-
 .../AssociateUcsProfileToBladeResponse.java        |   22 +++
 ...sociateUcsProfileToBladesInClusterResponse.java |   22 ---
 .../src/com/cloud/ucs/manager/ListUcsBladeCmd.java |   70 ++++++++++
 .../com/cloud/ucs/manager/ListUcsManagerCmd.java   |    4 +-
 .../cloud/ucs/manager/ListUcsManagerResponse.java  |   58 --------
 .../com/cloud/ucs/manager/ListUcsProfileCmd.java   |    4 +-
 .../cloud/ucs/manager/ListUcsProfileResponse.java  |   36 -----
 .../com/cloud/ucs/manager/UcsBladeResponse.java    |   56 ++++++++
 .../ucs/src/com/cloud/ucs/manager/UcsManager.java  |   10 +-
 .../src/com/cloud/ucs/manager/UcsManagerImpl.java  |  101 ++++++++++----
 .../com/cloud/ucs/manager/UcsManagerResponse.java  |   72 ++++++++++
 .../com/cloud/ucs/manager/UcsProfileResponse.java  |   36 +++++
 17 files changed, 360 insertions(+), 234 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index a26b468..4fdc91e 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -454,6 +454,10 @@ public class ApiConstants {
     public static final String GUEST_VM_CIDR = "guestvmcidr";
     public static final String NETWORK_CIDR = "networkcidr";
     public static final String RESERVED_IP_RANGE = "reservediprange";
+    public static final String UCS_MANAGER_ID = "ucsmanagerid";
+    public static final String UCS_PROFILE_DN = "profiledn";
+    public static final String UCS_BLADE_DN = "bladedn";
+    public static final String UCS_BLADE_ID = "bladeid";
 
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java
old mode 100644
new mode 100755
index 527bc27..712f446
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java
@@ -41,8 +41,8 @@ public class UcsBladeVO {
     private Long hostId;
     
     @Column(name="dn")
-    private String dn;
-
+    private String dn;
+    
     public long getId() {
         return id;
     }
@@ -81,5 +81,5 @@ public class UcsBladeVO {
 
     public void setUuid(String uuid) {
         this.uuid = uuid;
-    }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java
old mode 100644
new mode 100755
index 078add9..9348a72
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java
@@ -25,6 +25,7 @@ import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.BaseCmd.CommandType;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.exception.ConcurrentOperationException;
@@ -35,33 +36,33 @@ import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.server.ManagementService;
 import com.cloud.user.Account;
 
-@APICommand(description="Adds a Ucs manager", responseObject=AddUcsManagerResponse.class)
+@APICommand(name="addUcsManager", description="Adds a Ucs manager", responseObject=UcsManagerResponse.class)
 public class AddUcsManagerCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(AddUcsManagerCmd.class);
     
     @Inject
     private UcsManager mgr;
     
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone id
for the ucs manager", required=true)
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, description="the Zone id
for the ucs manager", entityType=ZoneResponse.class, required=true)
     private Long zoneId;
     
     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of
UCS manager")
     private String name;
     
-    @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the name of UCS
url")
+    @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the name of UCS
url", required=true)
     private String url;
     
-    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username
of UCS")
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username
of UCS", required=true)
     private String username;
     
-    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="the password
of UCS")
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="the password
of UCS", required=true)
     private String password;
     
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
             ResourceAllocationException, NetworkRuleConflictException {
         try {
-            AddUcsManagerResponse rsp = mgr.addUcsManager(this);
+            UcsManagerResponse rsp = mgr.addUcsManager(this);
             rsp.setObjectName("ucsmanager");
             rsp.setResponseName(getCommandName());
             this.setResponseObject(rsp);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java
deleted file mode 100644
index 98dfd04..0000000
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.ucs.manager;
-
-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 AddUcsManagerResponse extends BaseResponse {
-    @SerializedName(ApiConstants.ID) @Param(description="the ID of the ucs manager")
-    private String id;
-    
-    @SerializedName(ApiConstants.NAME) @Param(description="the name of ucs manager")
-    private String name;
-    
-    @SerializedName(ApiConstants.URL) @Param(description="the url of ucs manager")
-    private String url;
-    
-    @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of ucs manager")
-    private String zoneId;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getZoneId() {
-        return zoneId;
-    }
-
-    public void setZoneId(String zoneId) {
-        this.zoneId = zoneId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
old mode 100644
new mode 100755
index cc59e42..5c65def
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
@@ -19,8 +19,10 @@ package com.cloud.ucs.manager;
 import javax.inject.Inject;
 
 import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.log4j.Logger;
 
@@ -30,15 +32,18 @@ import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.user.Account;
-@APICommand(description="associate a profile to a blade", responseObject=AssociateUcsProfileToBladesInClusterResponse.class)
+@APICommand(name="associatesUscProfileToBlade", description="associate a profile to a blade",
responseObject=AssociateUcsProfileToBladeResponse.class)
 public class AssociateUcsProfileToBladeCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class);
     
     @Inject
     private UcsManager mgr;
-    
+    
+    @Parameter(name=ApiConstants.UCS_MANAGER_ID, type=CommandType.UUID, description="ucs
manager id", entityType=UcsManagerResponse.class, required=true)
     private Long ucsManagerId;
+    @Parameter(name=ApiConstants.UCS_PROFILE_DN, type=CommandType.STRING, description="profile
dn", required=true)
     private String profileDn;
+    @Parameter(name=ApiConstants.UCS_BLADE_ID, type=CommandType.UUID, description="blade
id", required=true)
     private Long bladeId;
     
     @Override
@@ -46,7 +51,7 @@ public class AssociateUcsProfileToBladeCmd extends BaseCmd {
             ResourceAllocationException, NetworkRuleConflictException {
         try {
             mgr.associateProfileToBlade(this);
-            AssociateUcsProfileToBladesInClusterResponse rsp = new AssociateUcsProfileToBladesInClusterResponse();
+            AssociateUcsProfileToBladeResponse rsp = new AssociateUcsProfileToBladeResponse();
             rsp.setResponseName(getCommandName());
             rsp.setObjectName("associateucsprofiletobalde");
             this.setResponseObject(rsp);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeResponse.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeResponse.java
new file mode 100755
index 0000000..bd6ebdd
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeResponse.java
@@ -0,0 +1,22 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.ucs.manager;
+
+import org.apache.cloudstack.api.BaseResponse;
+
+public class AssociateUcsProfileToBladeResponse extends BaseResponse {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java
deleted file mode 100644
index f6cb0a6..0000000
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.ucs.manager;
-
-import org.apache.cloudstack.api.BaseResponse;
-
-public class AssociateUcsProfileToBladesInClusterResponse extends BaseResponse {
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java
new file mode 100755
index 0000000..5061a44
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java
@@ -0,0 +1,70 @@
+package com.cloud.ucs.manager;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@APICommand(name="listUcsBlade", description="List ucs blades", responseObject=UcsBladeResponse.class)
   
+public class ListUcsBladeCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ListUcsBladeCmd.class);
+    
+    @Inject
+    private UcsManager mgr;
+    
+    @Parameter(name=ApiConstants.UCS_MANAGER_ID, type=CommandType.UUID, description="ucs
manager id", entityType=UcsManagerResponse.class, required=true)
+    private Long ucsManagerId;
+
+    public UcsManager getMgr() {
+        return mgr;
+    }
+
+    public void setMgr(UcsManager mgr) {
+        this.mgr = mgr;
+    }
+
+    public Long getUcsManagerId() {
+        return ucsManagerId;
+    }
+
+    public void setUcsManagerId(Long ucsManagerId) {
+        this.ucsManagerId = ucsManagerId;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException, NetworkRuleConflictException {
+        try {
+            ListResponse<UcsBladeResponse> response = mgr.listUcsBlades(this);
+            response.setResponseName(getCommandName());
+            response.setObjectName("ucsblade");
+            this.setResponseObject(response);
+        } catch (Exception e) {
+            s_logger.warn(e.getMessage(), e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return "listucsbladeresponse";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java
old mode 100644
new mode 100755
index 31662d9..f8cb702
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java
@@ -34,7 +34,7 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.server.ManagementService;
 import com.cloud.user.Account;
-@APICommand(description="List ucs manager", responseObject=ListUcsManagerResponse.class)
+@APICommand(description="List ucs manager", responseObject=UcsManagerResponse.class)
 public class ListUcsManagerCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class);
     
@@ -48,7 +48,7 @@ public class ListUcsManagerCmd extends BaseCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
             ResourceAllocationException, NetworkRuleConflictException {
         try {
-            ListResponse<ListUcsManagerResponse> response  = mgr.listUcsManager(this);
           
+            ListResponse<UcsManagerResponse> response  = mgr.listUcsManager(this);
           
             response.setResponseName(getCommandName());
             response.setObjectName("ucsmanager");
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java
deleted file mode 100644
index 450d59c..0000000
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.ucs.manager;
-
-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 ListUcsManagerResponse extends BaseResponse {
-    @SerializedName(ApiConstants.ID) @Param(description="id of ucs manager")
-    private String id;
-    
-    @SerializedName(ApiConstants.NAME) @Param(description="name of ucs manager")
-    private String name;
-    
-    @SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id the ucs manager belongs
to")
-    private String zoneId;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getZoneId() {
-        return zoneId;
-    }
-
-    public void setZoneId(String zoneId) {
-        this.zoneId = zoneId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java
old mode 100644
new mode 100755
index 7cbbe14..53d3289
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java
@@ -35,7 +35,7 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.server.ManagementService;
 import com.cloud.user.Account;
-@APICommand(description="List profile in ucs manager", responseObject=ListUcsProfileResponse.class)
+@APICommand(description="List profile in ucs manager", responseObject=UcsProfileResponse.class)
 public class ListUcsProfileCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(ListUcsProfileCmd.class);
     
@@ -56,7 +56,7 @@ public class ListUcsProfileCmd extends BaseCmd {
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
             ResourceAllocationException, NetworkRuleConflictException {
         try {
-            ListResponse<ListUcsProfileResponse> response = mgr.listUcsProfiles(this);
+            ListResponse<UcsProfileResponse> response = mgr.listUcsProfiles(this);
             response.setResponseName(getCommandName());
             response.setObjectName("ucsprofile");
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java
b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java
deleted file mode 100644
index c29d1d0..0000000
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.ucs.manager;
-
-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 ListUcsProfileResponse extends BaseResponse {
-    @SerializedName(ApiConstants.UCS_DN) @Param(description="the dn of ucs profile")
-    private String dn;
-
-    public String getDn() {
-        return dn;
-    }
-
-    public void setDn(String dn) {
-        this.dn = dn;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java
new file mode 100755
index 0000000..2dd20c7
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java
@@ -0,0 +1,56 @@
+package com.cloud.ucs.manager;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.cloud.ucs.database.UcsBladeVO;
+import com.google.gson.annotations.SerializedName;
+@EntityReference(value=UcsBladeVO.class)
+public class UcsBladeResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "ucs blade id")
+    private String id;
+    @SerializedName(ApiConstants.UCS_MANAGER_ID)
+    @Param(description = "ucs manager id")
+    private String ucsManagerId;
+    @SerializedName(ApiConstants.HOST_ID)
+    @Param(description = "cloudstack host id this blade associates to")
+    private String hostId;
+    @SerializedName(ApiConstants.UCS_BLADE_DN)
+    @Param(description = "ucs blade dn")
+    private String dn;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+    
+    public String getUcsManagerId() {
+        return ucsManagerId;
+    }
+
+    public void setUcsManagerId(String ucsManagerId) {
+        this.ucsManagerId = ucsManagerId;
+    }
+
+    public String getHostId() {
+        return hostId;
+    }
+
+    public void setHostId(String hostId) {
+        this.hostId = hostId;
+    }
+
+    public String getDn() {
+        return dn;
+    }
+
+    public void setDn(String dn) {
+        this.dn = dn;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
old mode 100644
new mode 100755
index 2e8040a..a999637
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
@@ -21,11 +21,13 @@ import org.apache.cloudstack.api.response.ListResponse;
 import com.cloud.utils.component.Manager;
 
 public interface UcsManager extends Manager {
-    AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd);
+    UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd);
     
-    ListResponse<ListUcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd);
+    ListResponse<UcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd);
     
-    ListResponse<ListUcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd);
+    ListResponse<UcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd);
 
-    void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd);
+    void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd);
+    
+    ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
old mode 100644
new mode 100755
index 356113d..18d3475
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -42,8 +42,11 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.org.Cluster;
 import com.cloud.resource.ResourceService;
@@ -78,8 +81,15 @@ public class UcsManagerImpl implements UcsManager {
     private ClusterDetailsDao clusterDetailsDao;
     @Inject
     private UcsBladeDao bladeDao;
+    @Inject
+    private HostDao hostDao;
+    @Inject
+    private DataCenterDao dcDao;
 
-    private Map<Long, String> cookies = new HashMap<Long, String>();
+    private Map<Long, String> cookies = new HashMap<Long, String>();
+    private String name;
+    private int runLevel;
+    private Map<String, Object> params;
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
@@ -98,7 +108,7 @@ public class UcsManagerImpl implements UcsManager {
 
     @Override
     public String getName() {
-        return "UcsManager";
+        return name;
     }
 
     private void discoverBlades(UcsManagerVO ucsMgrVo) {
@@ -114,7 +124,7 @@ public class UcsManagerImpl implements UcsManager {
     
     @Override
     @DB
-    public AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
+    public UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
         UcsManagerVO vo = new UcsManagerVO();
         vo.setUuid(UUID.randomUUID().toString());
         vo.setPassword(cmd.getPassword());
@@ -127,7 +137,7 @@ public class UcsManagerImpl implements UcsManager {
         txn.start();
         ucsDao.persist(vo);
         txn.commit();
-        AddUcsManagerResponse rsp = new AddUcsManagerResponse();
+        UcsManagerResponse rsp = new UcsManagerResponse();
         rsp.setId(String.valueOf(vo.getId()));
         rsp.setName(vo.getName());
         rsp.setUrl(vo.getUrl());
@@ -175,12 +185,12 @@ public class UcsManagerImpl implements UcsManager {
     }
 
     @Override
-    public ListResponse<ListUcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd)
{
+    public ListResponse<UcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd)
{
         List<UcsProfile> profiles = getUcsProfiles(cmd.getUcsManagerId());
-        ListResponse<ListUcsProfileResponse> response = new ListResponse<ListUcsProfileResponse>();
-        List<ListUcsProfileResponse> rs = new ArrayList<ListUcsProfileResponse>();
+        ListResponse<UcsProfileResponse> response = new ListResponse<UcsProfileResponse>();
+        List<UcsProfileResponse> rs = new ArrayList<UcsProfileResponse>();
         for (UcsProfile p : profiles) {
-            ListUcsProfileResponse r = new ListUcsProfileResponse();
+            UcsProfileResponse r = new UcsProfileResponse();
             r.setObjectName("ucsprofile");
             r.setDn(p.getDn());
             rs.add(r);
@@ -250,55 +260,88 @@ public class UcsManagerImpl implements UcsManager {
         }
         
         s_logger.debug(String.format("successfully associated profile[%s] to blade[%s]",
pdn, bvo.getDn()));
-    }
+    }
+    
+    private String hostIdToUuid(Long hostId) {
+        HostVO vo = hostDao.findById(hostId);
+        return vo.getUuid();
+    }
+    
+    private String zoneIdToUuid(Long zoneId) {
+        DataCenterVO vo = dcDao.findById(zoneId);
+        return vo.getUuid();
+    }
+    
+    private String ucsManagerIdToUuid(Long ucsMgrId) {
+        UcsManagerVO vo = ucsDao.findById(ucsMgrId); 
+        return vo.getUuid();
+    }
 
     @Override
-    public ListResponse<ListUcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd)
{
+    public ListResponse<UcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd) {
         SearchCriteriaService<UcsManagerVO, UcsManagerVO> serv = SearchCriteria2.create(UcsManagerVO.class);
         serv.addAnd(serv.getEntity().getZoneId(), Op.EQ, cmd.getZoneId());
         List<UcsManagerVO> vos = serv.list();
 
-        List<ListUcsManagerResponse> rsps = new ArrayList<ListUcsManagerResponse>(vos.size());
+        List<UcsManagerResponse> rsps = new ArrayList<UcsManagerResponse>(vos.size());
         for (UcsManagerVO vo : vos) {
-            ListUcsManagerResponse rsp = new ListUcsManagerResponse();
+            UcsManagerResponse rsp = new UcsManagerResponse();
             rsp.setObjectName("ucsmanager");
-            rsp.setId(String.valueOf(vo.getId()));
-            rsp.setName(vo.getName());
-            rsp.setZoneId(String.valueOf(vo.getZoneId()));
+            rsp.setId(vo.getUuid());
+            rsp.setName(vo.getName());
+            rsp.setUrl(vo.getUrl());
+            rsp.setZoneId(zoneIdToUuid(vo.getZoneId()));
             rsps.add(rsp);
         }
-        ListResponse<ListUcsManagerResponse> response = new ListResponse<ListUcsManagerResponse>();
+        ListResponse<UcsManagerResponse> response = new ListResponse<UcsManagerResponse>();
         response.setResponses(rsps);
         return response;
+    }
+    
+    public ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd) {
+        SearchCriteriaService<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
+        serv.addAnd(serv.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId());
+        List<UcsBladeVO> vos = serv.list();
+        
+        List<UcsBladeResponse> rsps = new ArrayList<UcsBladeResponse>(vos.size());
+        for (UcsBladeVO vo : vos) {
+            UcsBladeResponse rsp = new UcsBladeResponse();
+            rsp.setObjectName("ucsblade");
+            rsp.setId(vo.getUuid());
+            rsp.setDn(vo.getDn());
+            rsp.setHostId(hostIdToUuid(vo.getHostId()));
+            rsp.setUcsManagerId(ucsManagerIdToUuid(vo.getUcsManagerId()));
+            rsps.add(rsp);
+        }
+        
+        ListResponse<UcsBladeResponse> response = new ListResponse<UcsBladeResponse>();
+        response.setResponses(rsps);
+        
+        return response;
     }
 
     @Override
-    public void setName(String name) {
-        // TODO Auto-generated method stub
-        
+    public void setName(String name) {
+        this.name = name;
     }
 
     @Override
-    public void setConfigParams(Map<String, Object> params) {
-        // TODO Auto-generated method stub
-        
+    public void setConfigParams(Map<String, Object> params) {
+        this.params = params;
     }
 
     @Override
     public Map<String, Object> getConfigParams() {
-        // TODO Auto-generated method stub
-        return null;
+        return this.params;
     }
 
     @Override
     public int getRunLevel() {
-        // TODO Auto-generated method stub
-        return 0;
+        return runLevel;
     }
 
     @Override
-    public void setRunLevel(int level) {
-        // TODO Auto-generated method stub
-        
+    public void setRunLevel(int level) {
+        this.runLevel = level;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java
new file mode 100755
index 0000000..634ee81
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java
@@ -0,0 +1,72 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.ucs.manager;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.EntityReference;
+
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.cloud.ucs.database.UcsManagerVO;
+import com.google.gson.annotations.SerializedName;
+@EntityReference(value=UcsManagerVO.class)
+public class UcsManagerResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID) @Param(description="the ID of the ucs manager")
+    private String id;
+    
+    @SerializedName(ApiConstants.NAME) @Param(description="the name of ucs manager")
+    private String name;
+    
+    @SerializedName(ApiConstants.URL) @Param(description="the url of ucs manager")
+    private String url;
+    
+    @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of ucs manager")
+    private String zoneId;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcef281b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java
new file mode 100755
index 0000000..1bbd2ca
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.ucs.manager;
+
+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 UcsProfileResponse extends BaseResponse {
+    @SerializedName(ApiConstants.UCS_DN) @Param(description="ucs profile dn")
+    private String dn;
+
+    public String getDn() {
+        return dn;
+    }
+
+    public void setDn(String dn) {
+        this.dn = dn;
+    }
+}


Mime
View raw message