Updated Branches: refs/heads/4.2 784bef766 -> 4191f157c
change associatesUcsProfileToBlade to async api Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4191f157 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4191f157 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4191f157 Branch: refs/heads/4.2 Commit: 4191f157c1ef23200ba5bb00050f4634933bafe5 Parents: 784bef7 Author: frank <frank.zh...@citrix.com> Authored: Thu Jul 25 15:25:06 2013 -0700 Committer: frank <frank.zh...@citrix.com> Committed: Thu Jul 25 15:25:29 2013 -0700 ---------------------------------------------------------------------- api/src/com/cloud/event/EventTypes.java | 2 ++ client/tomcatconf/commands.properties.in | 1 + .../ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java | 5 +++++ .../cloudstack/api/AssociateUcsProfileToBladeCmd.java | 13 ++++++++++++- utils/src/com/cloud/utils/xmlobject/XmlObject.java | 4 ++-- 5 files changed, 22 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4191f157/api/src/com/cloud/event/EventTypes.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index ca764e9..6f1eed6 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -443,6 +443,8 @@ public class EventTypes { public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE"; public static final String EVENT_CLEANUP_VM_RESERVATION = "VM.RESERVATION.CLEANUP"; + + public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE"; static { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4191f157/client/tomcatconf/commands.properties.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index d8d176f..e801213 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -608,6 +608,7 @@ listBaremetalPxePingServer=1 #### UCS commands addUcsManager=1 +listUcsManager=1 listUcsProfile=1 listUcsBlade=1 associatesUcsProfileToBlade=1 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4191f157/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 index f9e2c5a..8595d3a 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java @@ -322,6 +322,11 @@ public class UcsManagerImpl implements UcsManager { String res = client.call(cmd); XmlObject xo = XmlObjectParser.parseFromString(res); s_logger.debug(String.format("association response is %s", res)); + + if (xo.get("outConfig.computeBlade.association").equals("none")) { + throw new CloudRuntimeException(String.format("cannot associated a profile to blade[dn:%s]. please check your UCS manasger for detailed error information", dn)); + } + return xo.get("outConfig.computeBlade.association").equals("associated"); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4191f157/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java index c3178cd..5e65ece 100755 --- a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java +++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/AssociateUcsProfileToBladeCmd.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.response.UcsBladeResponse; import org.apache.cloudstack.api.response.UcsManagerResponse; import org.apache.log4j.Logger; +import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.NetworkRuleConflictException; @@ -37,7 +38,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.ucs.manager.UcsManager; import com.cloud.user.Account; @APICommand(name="associatesUcsProfileToBlade", description="associate a profile to a blade", responseObject=UcsBladeResponse.class) -public class AssociateUcsProfileToBladeCmd extends BaseCmd { +public class AssociateUcsProfileToBladeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class); @Inject @@ -96,4 +97,14 @@ public class AssociateUcsProfileToBladeCmd extends BaseCmd { public void setBladeId(Long bladeId) { this.bladeId = bladeId; } + + @Override + public String getEventType() { + return EventTypes.EVENT_UCS_ASSOCIATED_PROFILE; + } + + @Override + public String getEventDescription() { + return "associating a ucs profile to blade"; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4191f157/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 old mode 100644 new mode 100755 index 67bb8ed..4162e4a --- a/utils/src/com/cloud/utils/xmlobject/XmlObject.java +++ b/utils/src/com/cloud/utils/xmlobject/XmlObject.java @@ -50,10 +50,10 @@ public class XmlObject { elements.put(key, e); } else { if (old instanceof List) { - System.out.println(String.format("already list %s, add", key)); + //System.out.println(String.format("already list %s, add", key)); ((List)old).add(e); } else { - System.out.println(String.format("not list list %s, add list", key)); + //System.out.println(String.format("not list list %s, add list", key)); List lst = new ArrayList(); lst.add(old); lst.add(e);