incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [5/50] [abbrv] git commit: refs/heads/master - CloudStack CLOUDSTACK-723 Enhanced baremetal servers support on Cisco UCS
Date Fri, 01 Feb 2013 23:27:32 GMT
CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

init


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

Branch: refs/heads/master
Commit: 301b0b90909c60111a179c078609e2ac4840fe73
Parents: fb05089
Author: frank <frank.zhang@citrix.com>
Authored: Fri Jan 25 15:00:09 2013 -0800
Committer: frank <frank.zhang@citrix.com>
Committed: Fri Jan 25 15:00:09 2013 -0800

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java    |    1 +
 plugins/hypervisors/ucs/pom.xml                    |   37 +++
 .../src/com/cloud/ucs/database/UcsManagerDao.java  |   16 +
 .../com/cloud/ucs/database/UcsManagerDaoImpl.java  |   12 +
 .../src/com/cloud/ucs/database/UcsManagerVO.java   |   78 ++++++
 .../com/cloud/ucs/manager/AddUcsManagerCmd.java    |  107 ++++++++
 .../cloud/ucs/manager/AddUcsManagerResponse.java   |   53 ++++
 .../ucs/manager/AssociateUcsProfileToBladeCmd.java |   75 +++++
 ...sociateUcsProfileToBladesInClusterResponse.java |    6 +
 .../com/cloud/ucs/manager/ListUcsManagerCmd.java   |   61 ++++
 .../cloud/ucs/manager/ListUcsManagerResponse.java  |   42 +++
 .../com/cloud/ucs/manager/ListUcsProfileCmd.java   |   62 +++++
 .../cloud/ucs/manager/ListUcsProfileResponse.java  |   20 ++
 .../src/com/cloud/ucs/manager/StringTemplate.java  |   22 ++
 .../ucs/src/com/cloud/ucs/manager/UcsCommands.java |   44 +++
 .../src/com/cloud/ucs/manager/UcsHttpClient.java   |   33 +++
 .../ucs/src/com/cloud/ucs/manager/UcsManager.java  |   15 +
 .../src/com/cloud/ucs/manager/UcsManagerImpl.java  |  212 +++++++++++++++
 .../src/com/cloud/ucs/structure/ComputeBlade.java  |  162 +++++++++++
 .../src/com/cloud/ucs/structure/UcsProfile.java    |   37 +++
 plugins/pom.xml                                    |    5 +-
 utils/src/com/cloud/utils/xmlobject/XmlObject.java |   23 ++
 22 files changed, 1121 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
old mode 100644
new mode 100755
index d3bfcd6..fa136a3
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -426,6 +426,7 @@ public class ApiConstants {
     public static final String CONDITION_IDS = "conditionids";
     public static final String COUNTERPARAM_LIST = "counterparam";
     public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
+    public static final String UCS_DN = "ucsdn";
 
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/pom.xml b/plugins/hypervisors/ucs/pom.xml
new file mode 100755
index 0000000..aecace8
--- /dev/null
+++ b/plugins/hypervisors/ucs/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.1.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.cloudstack</groupId>
+  <artifactId>cloud-plugin-hypervisor-ucs</artifactId>
+  <version>4.1.0-SNAPSHOT</version>
+  <name>cloud-plugin-hypervisor-ucs</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-utils</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java
new file mode 100755
index 0000000..eb4c257
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java
@@ -0,0 +1,16 @@
+package com.cloud.ucs.database;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria2;
+
+public interface UcsManagerDao extends GenericDao<UcsManagerVO, Long> {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java
new file mode 100755
index 0000000..f1475ab
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java
@@ -0,0 +1,12 @@
+package com.cloud.ucs.database;
+
+import javax.ejb.Local;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+
+@Local(value = { UcsManagerDao.class })
+@DB(txn = false)
+public class UcsManagerDaoImpl  extends GenericDaoBase<UcsManagerVO, Long> implements UcsManagerDao {
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java
new file mode 100755
index 0000000..7c451be
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java
@@ -0,0 +1,78 @@
+package com.cloud.ucs.database;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="ucs_manager")
+public class UcsManagerVO {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+	private long id;
+   
+    @Column(name="zone_id")
+	private long zoneId;
+    
+    @Column(name="uuid")
+	private String uuid;
+    
+    @Column(name="name")
+	private String name;
+    
+    @Column(name="url")
+	private String url;
+    
+    @Column(name="username")
+	private String username;
+    
+    @Column(name="password")
+	private String password;
+	
+	public long getId() {
+		return id;
+	}
+	public void setId(long id) {
+		this.id = id;
+	}
+	public String getUuid() {
+		return uuid;
+	}
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+	public String getUrl() {
+		return url;
+	}
+	public void setUrl(String url) {
+		this.url = url;
+	}
+	public String getUsername() {
+		return username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+	public String getPassword() {
+		return password;
+	}
+	public void setPassword(String password) {
+		this.password = password;
+	}
+    public long getZoneId() {
+        return zoneId;
+    }
+    public void setZoneId(long zoneId) {
+        this.zoneId = zoneId;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..6d4e6b2
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java
@@ -0,0 +1,107 @@
+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.BaseCmd;
+import org.apache.cloudstack.api.BaseCmd.CommandType;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+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.server.ManagementService;
+import com.cloud.user.Account;
+
+@APICommand(description="Adds a Ucs manager", responseObject=AddUcsManagerResponse.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)
+    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")
+    private String url;
+    
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username of UCS")
+    private String username;
+    
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="the password of UCS")
+    private String password;
+    
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException, NetworkRuleConflictException {
+        try {
+            AddUcsManagerResponse rsp = mgr.addUcsManager(this);
+            rsp.setObjectName("ucsmanager");
+            rsp.setResponseName(getCommandName());
+            this.setResponseObject(rsp);
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); 
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return "addUcsManagerResponse";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(Long zoneId) {
+        this.zoneId = 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 getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..eff30b9
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java
@@ -0,0 +1,53 @@
+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/301b0b90/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
new file mode 100755
index 0000000..2d384d1
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java
@@ -0,0 +1,75 @@
+package com.cloud.ucs.manager;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.ServerApiException;
+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(description="associate a profile to a blade", responseObject=AssociateUcsProfileToBladesInClusterResponse.class)
+public class AssociateUcsProfileToBladeCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class);
+    
+    @Inject
+    private UcsManager mgr;
+    
+    private Long ucsManagerId;
+    private String profileDn;
+    private Long bladeId;
+    
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException, NetworkRuleConflictException {
+        try {
+            mgr.associateProfileToBlade(this);
+            AssociateUcsProfileToBladesInClusterResponse rsp = new AssociateUcsProfileToBladesInClusterResponse();
+            rsp.setResponseName(getCommandName());
+            rsp.setObjectName("associateucsprofiletobalde");
+            this.setResponseObject(rsp);
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());   
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return "associateucsprofiletobladeresponse";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    public Long getUcsManagerId() {
+        return ucsManagerId;
+    }
+
+    public void setUcsManagerId(Long ucsManagerId) {
+        this.ucsManagerId = ucsManagerId;
+    }
+
+    public String getProfileDn() {
+        return profileDn;
+    }
+
+    public void setProfileDn(String profileDn) {
+        this.profileDn = profileDn;
+    }
+
+    public Long getBladeId() {
+        return bladeId;
+    }
+
+    public void setBladeId(Long bladeId) {
+        this.bladeId = bladeId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..eedd9fc
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java
@@ -0,0 +1,6 @@
+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/301b0b90/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
new file mode 100755
index 0000000..53dd0c0
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java
@@ -0,0 +1,61 @@
+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.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.server.ManagementService;
+import com.cloud.user.Account;
+@APICommand(description="List ucs manager", responseObject=ListUcsManagerResponse.class)
+public class ListUcsManagerCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class);
+    
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the zone id", required=true)
+    private Long zoneId;
+    
+    @Inject
+    private UcsManager mgr;
+    
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException, NetworkRuleConflictException {
+        try {
+            ListResponse<ListUcsManagerResponse> response  = mgr.listUcsManager(this);            
+            response.setResponseName(getCommandName());
+            response.setObjectName("ucsmanager");
+            this.setResponseObject(response);
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());  
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return "listucsmanagerreponse";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(Long zoneId) {
+        this.zoneId = zoneId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..d45aec5
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java
@@ -0,0 +1,42 @@
+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/301b0b90/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
new file mode 100755
index 0000000..ce51f82
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java
@@ -0,0 +1,62 @@
+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.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.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.server.ManagementService;
+import com.cloud.user.Account;
+@APICommand(description="List profile in ucs manager", responseObject=ListUcsProfileResponse.class)
+public class ListUcsProfileCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ListUcsProfileCmd.class);
+    
+    @Inject UcsManager mgr;
+    
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id for the ucs manager", required=true)
+    private Long ucsManagerId;
+
+    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<ListUcsProfileResponse> response = mgr.listUcsProfiles(this);
+            response.setResponseName(getCommandName());
+            response.setObjectName("ucsprofile");
+            this.setResponseObject(response);
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());  
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return "listucsprofileresponse";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..846ac27
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java
@@ -0,0 +1,20 @@
+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/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java
new file mode 100755
index 0000000..f7cd315
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java
@@ -0,0 +1,22 @@
+package com.cloud.ucs.manager;
+
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class StringTemplate {
+    public static String replaceTokens(String text, Map<String, String> replacements) {
+        Pattern pattern = Pattern.compile("\\[(.+?)\\]");
+        Matcher matcher = pattern.matcher(text);
+        StringBuffer buffer = new StringBuffer();
+        while (matcher.find()) {
+            String replacement = replacements.get(matcher.group(1));
+            if (replacement != null) {
+                matcher.appendReplacement(buffer, "");
+                buffer.append(replacement);
+            }
+        }
+        matcher.appendTail(buffer);
+        return buffer.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java
new file mode 100755
index 0000000..32c017d
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java
@@ -0,0 +1,44 @@
+package com.cloud.ucs.manager;
+
+import com.cloud.utils.xmlobject.XmlObject;
+
+public class UcsCommands {
+    public static String loginCmd(String username, String password) {
+        XmlObject cmd = new XmlObject("aaaLogin");
+        cmd.putElement("inName", username);
+        cmd.putElement("inPassword", password);
+        return cmd.dump();
+    }
+    
+    public static String listComputeBlades(String cookie) {
+        XmlObject cmd = new XmlObject("configResolveClass");
+        cmd.putElement("classId", "computeBlade");
+        cmd.putElement("cookie", cookie);
+        cmd.putElement("inHierarchical", "false");
+        return cmd.dump();
+    }
+    
+    public static String listProfiles(String cookie) {
+        XmlObject cmd = new XmlObject("configFindDnsByClassId");
+        cmd.putElement("classId", "lsServer");
+        cmd.putElement("cookie", cookie);
+        return cmd.dump();
+    }
+    
+    public static String cloneProfile(String cookie, String srcDn, String newProfileName) {
+        XmlObject cmd = new XmlObject("lsClone");
+        cmd.putElement("cookie", cookie);
+        cmd.putElement("dn", srcDn);
+        cmd.putElement("inTargetOrg", "org-root");
+        cmd.putElement("inServerName", newProfileName);
+        cmd.putElement("inHierarchical", "false");
+        return cmd.dump();
+    }
+    
+    public static String configResolveDn(String cookie, String dn) {
+        XmlObject cmd = new XmlObject("configResolveDn");
+        cmd.putElement("cookie", cookie);
+        cmd.putElement("dn", dn);
+        return cmd.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java
new file mode 100755
index 0000000..978f67a
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java
@@ -0,0 +1,33 @@
+package com.cloud.ucs.manager;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class UcsHttpClient {
+    private static HttpClient client = new HttpClient();
+    private String url;
+
+    public UcsHttpClient(String ip) {
+        this.url = String.format("http://%s/nuova", ip);
+    }
+
+    public String call(String xml) {
+        PostMethod post = new PostMethod(url);
+        post.setRequestEntity(new StringRequestEntity(xml));
+        post.setRequestHeader("Content-type", "text/xml");
+        try {
+            int result = client.executeMethod(post);
+            if (result != 200) {
+               throw new CloudRuntimeException("Call failed: " + post.getResponseBodyAsString()); 
+            }
+            return post.getResponseBodyAsString();
+        } catch (Exception e) {
+            throw new CloudRuntimeException(e.getMessage(), e);
+        } finally {
+            post.releaseConnection();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..5683760
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
@@ -0,0 +1,15 @@
+package com.cloud.ucs.manager;
+
+import org.apache.cloudstack.api.response.ListResponse;
+
+import com.cloud.utils.component.Manager;
+
+public interface UcsManager extends Manager {
+    AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd);
+    
+    ListResponse<ListUcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd);
+    
+    ListResponse<ListUcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd);
+
+    void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/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
new file mode 100755
index 0000000..d19e535
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -0,0 +1,212 @@
+package com.cloud.ucs.manager;
+
+import java.io.File;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.ResponseGenerator;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ClusterResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.host.HostVO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster;
+import com.cloud.resource.ResourceService;
+import com.cloud.ucs.database.UcsManagerDao;
+import com.cloud.ucs.database.UcsManagerVO;
+import com.cloud.ucs.structure.ComputeBlade;
+import com.cloud.ucs.structure.UcsProfile;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+import com.cloud.utils.xmlobject.XmlObject;
+import com.cloud.utils.xmlobject.XmlObjectParser;
+
+@Local(value = { UcsManager.class })
+public class UcsManagerImpl implements UcsManager {
+    public static final Logger s_logger = Logger.getLogger(UcsManagerImpl.class);
+
+    @Inject
+    private UcsManagerDao ucsDao;
+    @Inject
+    private ResourceService resourceService;
+    @Inject
+    private ClusterDao clusterDao;
+    @Inject
+    private ClusterDetailsDao clusterDetailsDao;
+
+    private Map<Long, String> cookies = new HashMap<Long, String>();
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        return true;
+    }
+
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+    @Override
+    public String getName() {
+        return "UcsManager";
+    }
+
+    @Override
+    @DB
+    public AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
+        UcsManagerVO vo = new UcsManagerVO();
+        vo.setUuid(UUID.randomUUID().toString());
+        vo.setPassword(cmd.getPassword());
+        vo.setUrl(cmd.getUrl());
+        vo.setUsername(cmd.getUsername());
+        vo.setZoneId(cmd.getZoneId());
+        vo.setName(cmd.getName());
+
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        ucsDao.persist(vo);
+        txn.commit();
+        AddUcsManagerResponse rsp = new AddUcsManagerResponse();
+        rsp.setId(String.valueOf(vo.getId()));
+        rsp.setName(vo.getName());
+        rsp.setUrl(vo.getUrl());
+        rsp.setZoneId(String.valueOf(vo.getZoneId()));
+        return rsp;
+    }
+
+    private String getUcsManagerIp() {
+        SearchCriteriaService<UcsManagerVO, UcsManagerVO> serv = SearchCriteria2.create(UcsManagerVO.class);
+        List<UcsManagerVO> vos = serv.list();
+        if (vos.isEmpty()) {
+            throw new CloudRuntimeException("Cannot find any UCS manager, you must add it first");
+        }
+        return vos.get(0).getUrl();
+    }
+
+    private String getCookie(Long ucsMgrId) {
+        try {
+            String cookie = cookies.get(ucsMgrId);
+            if (cookie == null) {
+                UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
+                UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
+                String login = UcsCommands.loginCmd(mgrvo.getUsername(), mgrvo.getPassword());
+                cookie = client.call(login);
+                cookies.put(ucsMgrId, cookie);
+            }
+
+            return cookie;
+        } catch (Exception e) {
+            throw new CloudRuntimeException("Cannot get cookie", e);
+        }
+    }
+
+    private List<ComputeBlade> listBlades(Long ucsMgrId) {
+        String cookie = getCookie(ucsMgrId);
+        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
+        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
+        String cmd = UcsCommands.listComputeBlades(cookie);
+        String ret = client.call(cmd);
+        return ComputeBlade.fromXmString(ret);
+    }
+
+    private List<UcsProfile> getUcsProfiles(Long ucsMgrId) {
+        String cookie = getCookie(ucsMgrId);
+        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
+        String cmd = UcsCommands.listProfiles(cookie);
+        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
+        String res = client.call(cmd);
+        List<UcsProfile> profiles = UcsProfile.fromXmlString(res);
+        return profiles;
+    }
+
+    @Override
+    public ListResponse<ListUcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd) {
+        List<UcsProfile> profiles = getUcsProfiles(cmd.getUcsManagerId());
+        ListResponse<ListUcsProfileResponse> response = new ListResponse<ListUcsProfileResponse>();
+        List<ListUcsProfileResponse> rs = new ArrayList<ListUcsProfileResponse>();
+        for (UcsProfile p : profiles) {
+            ListUcsProfileResponse r = new ListUcsProfileResponse();
+            r.setObjectName("ucsprofile");
+            r.setDn(p.getDn());
+            rs.add(r);
+        }
+        response.setResponses(rs);
+        return response;
+    }
+
+    private String cloneProfile(Long ucsMgrId, String srcDn, String newProfileName) {
+        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
+        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
+        String cookie = getCookie(ucsMgrId);
+        String cmd = UcsCommands.cloneProfile(cookie, srcDn, newProfileName);
+        String res = client.call(cmd);
+        XmlObject xo = XmlObjectParser.parseFromString(res);
+        return xo.get("lsClone.outConfig.lsServer.dn");
+    }
+
+    private String buildProfileNameForHost(HostVO vo) {
+        return String.format("z%sp%sc%sh%s", vo.getDataCenterId(), vo.getPodId(), vo.getClusterId(), vo.getId());
+    }
+
+    private boolean isBladeAssociated(Long ucsMgrId, String dn) {
+        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
+        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
+        String cookie = getCookie(ucsMgrId);
+        String cmd = UcsCommands.configResolveDn(cookie, dn);
+        String res = client.call(cmd);
+        XmlObject xo = XmlObjectParser.parseFromString(res);
+        return xo.get("outConfig.lsServer.assocState").equals("associated");
+    }
+
+    @Override
+    public void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd) {
+    }
+
+    @Override
+    public ListResponse<ListUcsManagerResponse> 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());
+        for (UcsManagerVO vo : vos) {
+            ListUcsManagerResponse rsp = new ListUcsManagerResponse();
+            rsp.setObjectName("ucsmanager");
+            rsp.setId(String.valueOf(vo.getId()));
+            rsp.setName(vo.getName());
+            rsp.setZoneId(String.valueOf(vo.getZoneId()));
+            rsps.add(rsp);
+        }
+        ListResponse<ListUcsManagerResponse> response = new ListResponse<ListUcsManagerResponse>();
+        response.setResponses(rsps);
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java
new file mode 100755
index 0000000..9c7356c
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java
@@ -0,0 +1,162 @@
+package com.cloud.ucs.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.utils.xmlobject.XmlObject;
+import com.cloud.utils.xmlobject.XmlObjectParser;
+
+public class ComputeBlade {
+    String adminPower;
+    String adminState;
+    String assignedToDn;
+    String association;
+    String availability;
+    String availableMemory;
+    String chassisId;
+    String dn;
+    String name;
+    String numOfAdaptors;
+    String numOfCores;
+    String numOfCoresEnabled;
+    String numOfCpus;
+    String numOfEthHostIfs;
+    String numOfFcHostIfs;
+    String numOfThreads;
+    String operPower;
+    String totalMemory;
+    String uuid;
+    
+    public static List<ComputeBlade> fromXmString(String xmlstr) {
+        XmlObject root = XmlObjectParser.parseFromString(xmlstr);
+        List<XmlObject> lst = root.getAsList("configResolveClass.outConfigs.computeBlade");
+        List<ComputeBlade> blades = new ArrayList<ComputeBlade>();
+        if (lst == null) {
+            return blades;
+        }
+        for (XmlObject xo : lst) {
+            blades.add(fromXmlObject(xo));
+        }
+        return blades;
+    }
+    
+    public static ComputeBlade fromXmlObject(XmlObject obj) {
+        ComputeBlade ret = new ComputeBlade();
+        return obj.evaluateObject(ret);
+    }
+    
+    public String getAdminPower() {
+        return adminPower;
+    }
+    public void setAdminPower(String adminPower) {
+        this.adminPower = adminPower;
+    }
+    public String getAdminState() {
+        return adminState;
+    }
+    public void setAdminState(String adminState) {
+        this.adminState = adminState;
+    }
+    public String getAssignedToDn() {
+        return assignedToDn;
+    }
+    public void setAssignedToDn(String assignedToDn) {
+        this.assignedToDn = assignedToDn;
+    }
+    public String getAssociation() {
+        return association;
+    }
+    public void setAssociation(String association) {
+        this.association = association;
+    }
+    public String getAvailability() {
+        return availability;
+    }
+    public void setAvailability(String availability) {
+        this.availability = availability;
+    }
+    public String getAvailableMemory() {
+        return availableMemory;
+    }
+    public void setAvailableMemory(String availableMemory) {
+        this.availableMemory = availableMemory;
+    }
+    public String getChassisId() {
+        return chassisId;
+    }
+    public void setChassisId(String chassisId) {
+        this.chassisId = chassisId;
+    }
+    public String getDn() {
+        return dn;
+    }
+    public void setDn(String dn) {
+        this.dn = dn;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getNumOfAdaptors() {
+        return numOfAdaptors;
+    }
+    public void setNumOfAdaptors(String numOfAdaptors) {
+        this.numOfAdaptors = numOfAdaptors;
+    }
+    public String getNumOfCores() {
+        return numOfCores;
+    }
+    public void setNumOfCores(String numOfCores) {
+        this.numOfCores = numOfCores;
+    }
+    public String getNumOfCoresEnabled() {
+        return numOfCoresEnabled;
+    }
+    public void setNumOfCoresEnabled(String numOfCoresEnabled) {
+        this.numOfCoresEnabled = numOfCoresEnabled;
+    }
+    public String getNumOfCpus() {
+        return numOfCpus;
+    }
+    public void setNumOfCpus(String numOfCpus) {
+        this.numOfCpus = numOfCpus;
+    }
+    public String getNumOfEthHostIfs() {
+        return numOfEthHostIfs;
+    }
+    public void setNumOfEthHostIfs(String numOfEthHostIfs) {
+        this.numOfEthHostIfs = numOfEthHostIfs;
+    }
+    public String getNumOfFcHostIfs() {
+        return numOfFcHostIfs;
+    }
+    public void setNumOfFcHostIfs(String numOfFcHostIfs) {
+        this.numOfFcHostIfs = numOfFcHostIfs;
+    }
+    public String getNumOfThreads() {
+        return numOfThreads;
+    }
+    public void setNumOfThreads(String numOfThreads) {
+        this.numOfThreads = numOfThreads;
+    }
+    public String getOperPower() {
+        return operPower;
+    }
+    public void setOperPower(String operPower) {
+        this.operPower = operPower;
+    }
+    public String getTotalMemory() {
+        return totalMemory;
+    }
+    public void setTotalMemory(String totalMemory) {
+        this.totalMemory = totalMemory;
+    }
+    public String getUuid() {
+        return uuid;
+    }
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java
new file mode 100755
index 0000000..b8b2646
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java
@@ -0,0 +1,37 @@
+package com.cloud.ucs.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.utils.xmlobject.XmlObject;
+import com.cloud.utils.xmlobject.XmlObjectParser;
+
+public class UcsProfile {
+    private String dn;
+    
+    public static UcsProfile fromXmlObject(XmlObject xo) {
+        UcsProfile p = new UcsProfile();
+        return xo.evaluateObject(p);
+    }
+    
+    public static List<UcsProfile> fromXmlString(String xmlstr) {
+        List<UcsProfile> ps = new ArrayList<UcsProfile>();
+        XmlObject xo = XmlObjectParser.parseFromString(xmlstr);
+        List<XmlObject> xos = xo.getAsList("outDns.dn");
+        if (xos != null) {
+            for (XmlObject x : xos) {
+                UcsProfile p = UcsProfile.fromXmlObject(x);
+                ps.add(p);
+            }
+        }
+        return ps;
+    }
+
+    public String getDn() {
+        return dn;
+    }
+
+    public void setDn(String dn) {
+        this.dn = dn;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
old mode 100644
new mode 100755
index 61c43bd..6d87b4d
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -15,8 +16,7 @@
   KIND, either express or implied. See the License for the
   specific language governing permissions and limitations
   under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>cloudstack-plugins</artifactId>
   <name>Apache CloudStack Plugin POM</name>
@@ -40,6 +40,7 @@
     <module>hypervisors/ovm</module>
     <module>hypervisors/xen</module>
     <module>hypervisors/kvm</module>
+    <module>hypervisors/ucs</module>
     <module>network-elements/elastic-loadbalancer</module>
     <module>network-elements/ovs</module>
     <module>network-elements/nicira-nvp</module>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/301b0b90/utils/src/com/cloud/utils/xmlobject/XmlObject.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/xmlobject/XmlObject.java b/utils/src/com/cloud/utils/xmlobject/XmlObject.java
index 0c8f190..e133d61 100755
--- a/utils/src/com/cloud/utils/xmlobject/XmlObject.java
+++ b/utils/src/com/cloud/utils/xmlobject/XmlObject.java
@@ -4,6 +4,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -57,6 +58,10 @@ public class XmlObject {
     private Object recurGet(XmlObject obj, Iterator<String> it) {
         String key = it.next();
         Object e = obj.elements.get(key);
+        if (e == null) {
+            return null;
+        }
+        
         if (!it.hasNext()) {
             return e;
         } else {
@@ -161,4 +166,22 @@ public class XmlObject {
         }
         return sb.toString();
     }
+    
+    public <T> T evaluateObject(T obj) {
+        Class<?> clazz = obj.getClass();
+        try {
+            do {
+                Field[] fs = clazz.getDeclaredFields();
+                for (Field f : fs) {
+                    f.setAccessible(true);
+                    Object value = get(f.getName());
+                    f.set(obj, value);
+                }
+                clazz = clazz.getSuperclass();
+            } while (clazz != null && clazz != Object.class);
+            return obj;
+        } catch (Exception e) {
+            throw new CloudRuntimeException(e);
+        }
+    }
 }


Mime
View raw message