Updated Branches: refs/heads/4.1 ad90e208b -> 2093aefcb
CloudStack CLOUDSTACK-723 Enhanced baremetal servers support on Cisco UCS change UcsXxxDao to Spring xml loading change ListxxxCmd to inherit ListCmd change API response in line with current API architecture adding missing db schema to db upgrade schemaOh Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2093aefc Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2093aefc Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2093aefc Branch: refs/heads/4.1 Commit: 2093aefcb80a883726a4633d07a5049ece9808c1 Parents: ad90e20 Author: frank <frank@frank-dell.(none)> Authored: Thu Feb 28 15:28:00 2013 -0800 Committer: frank <frank@frank-dell.(none)> Committed: Thu Feb 28 15:34:57 2013 -0800 ---------------------------------------------------------------------- agent/pom.xml | 2 - client/pom.xml | 5 ++ client/tomcatconf/componentContext.xml.in | 3 + .../src/com/cloud/ucs/database/UcsBladeDao.java | 5 +- .../com/cloud/ucs/database/UcsBladeDaoImpl.java | 9 ++- .../ucs/src/com/cloud/ucs/database/UcsBladeVO.java | 21 +++++- .../src/com/cloud/ucs/database/UcsManagerDao.java | 5 +- .../com/cloud/ucs/database/UcsManagerDaoImpl.java | 9 ++- .../src/com/cloud/ucs/database/UcsManagerVO.java | 12 ++- .../com/cloud/ucs/manager/AddUcsManagerCmd.java | 5 +- .../ucs/manager/AssociateUcsProfileToBladeCmd.java | 13 ++-- .../AssociateUcsProfileToBladeResponse.java | 22 ------ .../src/com/cloud/ucs/manager/ListUcsBladeCmd.java | 3 +- .../com/cloud/ucs/manager/ListUcsManagerCmd.java | 16 ++++- .../com/cloud/ucs/manager/ListUcsProfileCmd.java | 14 ++-- .../src/com/cloud/ucs/manager/StringTemplate.java | 5 +- .../com/cloud/ucs/manager/UcsBladeResponse.java | 12 +++ .../ucs/src/com/cloud/ucs/manager/UcsCommands.java | 7 +- .../src/com/cloud/ucs/manager/UcsHttpClient.java | 12 +++- .../ucs/src/com/cloud/ucs/manager/UcsManager.java | 10 ++- .../src/com/cloud/ucs/manager/UcsManagerImpl.java | 57 +++++++++++---- .../com/cloud/ucs/manager/UcsManagerResponse.java | 5 +- .../com/cloud/ucs/manager/UcsProfileResponse.java | 5 +- .../src/com/cloud/ucs/structure/ComputeBlade.java | 7 +- .../src/com/cloud/ucs/structure/UcsProfile.java | 9 ++- server/pom.xml | 2 - setup/db/db/schema-40to410.sql | 22 ++++++ utils/src/com/cloud/utils/xmlobject/XmlObject.java | 5 +- 28 files changed, 202 insertions(+), 100 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/agent/pom.xml ---------------------------------------------------------------------- diff --git a/agent/pom.xml b/agent/pom.xml index f87786f..4de57f2 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -35,8 +35,6 @@ <groupId>org.apache.cloudstack</groupId> <artifactId>cloud-utils</artifactId> <version>${project.version}</version> - <classifier>tests</classifier> - <scope>test</scope> </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/client/pom.xml ---------------------------------------------------------------------- diff --git a/client/pom.xml b/client/pom.xml index 1192bed..e918073 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -91,6 +91,11 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloud-plugin-hypervisor-ucs</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.apache.cloudstack</groupId> <artifactId>cloud-plugin-hypervisor-ovm</artifactId> <version>${project.version}</version> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/client/tomcatconf/componentContext.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index 9f9f38c..ff7376e 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -58,6 +58,9 @@ <bean id="BaremetalKickStartPxeService" class="com.cloud.baremetal.networkservice.BaremetalKickStartServiceImpl"/> <bean id="BaremetalPingPxeService" class="com.cloud.baremetal.networkservice.BareMetalPingServiceImpl" /> <bean id="BaremetalPxeManager" class="com.cloud.baremetal.networkservice.BaremetalPxeManagerImpl" /> + <bean id="UcsManager" class="com.cloud.ucs.manager.UcsManagerImpl" /> + <bean id="UcsBladeDao" class="com.cloud.ucs.database.UcsBladeDaoImpl" /> + <bean id="UcsManagerDao" class="com.cloud.ucs.database.UcsManagerDaoImpl" /> <!-- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java index ce42fe0..581096d 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java @@ -5,15 +5,16 @@ // 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.database; import com.cloud.utils.db.GenericDao; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java index 8f65f6a..ae0980c 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java @@ -5,22 +5,25 @@ // 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.database; import javax.ejb.Local; + +import org.springframework.stereotype.Component; import com.cloud.utils.db.DB; import com.cloud.utils.db.GenericDaoBase; -@Local(value = { UcsBladeDao.class }) +@Local(value = { UcsBladeDao.class }) @DB(txn = false) public class UcsBladeDaoImpl extends GenericDaoBase<UcsBladeVO, Long> implements UcsBladeDao { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 712f446..a8c6fd7 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java @@ -5,15 +5,16 @@ // 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.database; import javax.persistence.Column; @@ -22,10 +23,13 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name="ucs_blade") -public class UcsBladeVO { +public class UcsBladeVO implements InternalIdentity, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -42,6 +46,9 @@ public class UcsBladeVO { @Column(name="dn") private String dn; + + @Column(name="profile_dn") + private String profileDn; public long getId() { return id; @@ -82,4 +89,12 @@ public class UcsBladeVO { public void setUuid(String uuid) { this.uuid = uuid; } + + public String getProfileDn() { + return profileDn; + } + + public void setProfileDn(String profileDn) { + this.profileDn = profileDn; + } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index fd6d762..84fe29c 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java @@ -5,15 +5,16 @@ // 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.database; import java.util.List; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index bccc0fa..39f9782 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java @@ -5,23 +5,26 @@ // 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.database; import javax.ejb.Local; + +import org.springframework.stereotype.Component; import com.cloud.utils.db.DB; import com.cloud.utils.db.GenericDaoBase; -@Local(value = { UcsManagerDao.class }) +@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/2093aefc/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 index 281d6a5..cd8371b 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java @@ -5,15 +5,16 @@ // 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.database; import javax.persistence.Column; @@ -22,10 +23,13 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; - + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + @Entity @Table(name="ucs_manager") -public class UcsManagerVO { +public class UcsManagerVO implements InternalIdentity, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 9348a72..ce8e40e 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java @@ -5,15 +5,16 @@ // 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 javax.inject.Inject; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 5c65def..c463828 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java @@ -5,15 +5,16 @@ // 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 javax.inject.Inject; @@ -32,7 +33,7 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name="associatesUscProfileToBlade", description="associate a profile to a blade", responseObject=AssociateUcsProfileToBladeResponse.class) +@APICommand(name="associatesUscProfileToBlade", description="associate a profile to a blade", responseObject=UcsBladeResponse.class) public class AssociateUcsProfileToBladeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class); @@ -43,17 +44,15 @@ public class AssociateUcsProfileToBladeCmd extends BaseCmd { 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) + @Parameter(name=ApiConstants.UCS_BLADE_ID, type=CommandType.UUID, entityType=UcsBladeResponse.class, description="blade id", required=true) private Long bladeId; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { - mgr.associateProfileToBlade(this); - AssociateUcsProfileToBladeResponse rsp = new AssociateUcsProfileToBladeResponse(); + UcsBladeResponse rsp = mgr.associateProfileToBlade(this); rsp.setResponseName(getCommandName()); - rsp.setObjectName("associateucsprofiletobalde"); this.setResponseObject(rsp); } catch (Exception e) { s_logger.warn("Exception: ", e); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 deleted file mode 100755 index bd6ebdd..0000000 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeResponse.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 AssociateUcsProfileToBladeResponse extends BaseResponse { -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 2166fcd..5440e4f 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsBladeCmd.java @@ -22,6 +22,7 @@ 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.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; @@ -35,7 +36,7 @@ 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 class ListUcsBladeCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListUcsBladeCmd.class); @Inject http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index f8cb702..862f631 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java @@ -5,15 +5,24 @@ // 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. +// +// Automatically generated by addcopyright.py at 02/28/2013 +// regarding copyright ownership. The ASF licenses this file +// "License"); you may not use this file except in compliance +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY package com.cloud.ucs.manager; import javax.inject.Inject; @@ -22,6 +31,7 @@ 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.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; @@ -35,7 +45,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.server.ManagementService; import com.cloud.user.Account; @APICommand(description="List ucs manager", responseObject=UcsManagerResponse.class) -public class ListUcsManagerCmd extends BaseCmd { +public class ListUcsManagerCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class); @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the zone id", required=true) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 53d3289..c8a2cc5 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java @@ -5,15 +5,16 @@ // 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 javax.inject.Inject; @@ -23,6 +24,7 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.BaseCmd.CommandType; +import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; @@ -35,13 +37,13 @@ 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=UcsProfileResponse.class) -public class ListUcsProfileCmd extends BaseCmd { +@APICommand(name="listUcsProfile", description="List profile in ucs manager", responseObject=UcsProfileResponse.class) +public class ListUcsProfileCmd extends BaseListCmd { 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) + @Parameter(name=ApiConstants.UCS_MANAGER_ID, type=CommandType.UUID, entityType=UcsManagerResponse.class, description="the id for the ucs manager", required=true) private Long ucsManagerId; public Long getUcsManagerId() { @@ -58,7 +60,7 @@ public class ListUcsProfileCmd extends BaseCmd { try { ListResponse<UcsProfileResponse> response = mgr.listUcsProfiles(this); response.setResponseName(getCommandName()); - response.setObjectName("ucsprofile"); + response.setObjectName("ucsprofiles"); this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Exception: ", e); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 5e5ceb9..72bbfcb 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java @@ -5,15 +5,16 @@ // 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 java.util.Map; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index fe979a4..862b206 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsBladeResponse.java @@ -37,6 +37,9 @@ public class UcsBladeResponse extends BaseResponse { @SerializedName(ApiConstants.UCS_BLADE_DN) @Param(description = "ucs blade dn") private String dn; + @SerializedName(ApiConstants.UCS_PROFILE_DN) + @Param(description = "associated ucs profile dn") + private String associatedProfileDn; public String getId() { return id; @@ -69,4 +72,13 @@ public class UcsBladeResponse extends BaseResponse { public void setDn(String dn) { this.dn = dn; } + + public String getAssociatedProfileDn() { + return associatedProfileDn; + } + + public void setAssociatedProfileDn(String associatedProfileDn) { + this.associatedProfileDn = associatedProfileDn; + } + } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 2dc4daa..eb99991 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java @@ -5,15 +5,16 @@ // 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 com.cloud.utils.xmlobject.XmlObject; @@ -83,7 +84,7 @@ public class UcsCommands { .putElement("statsPolicyName", "default") .putElement("status", "") .putElement("usrLbl", "") - .putElement("", "") + .putElement("uuid", "") .putElement("vconProfileName", "") .putElement("lsBinding", new XmlObject("lsBinding") .putElement("pnDn", bladeDn) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index d887650..5c60601 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java @@ -5,15 +5,16 @@ // 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.commons.httpclient.HttpClient; @@ -39,7 +40,12 @@ public class UcsHttpClient { if (result != 200) { throw new CloudRuntimeException("Call failed: " + post.getResponseBodyAsString()); } - return post.getResponseBodyAsString(); + String res = post.getResponseBodyAsString(); + if (res.contains("errorCode")) { + String err = String.format("ucs call failed:\nsubmitted doc:%s\nresponse:%s\n", xml, res); + throw new CloudRuntimeException(err); + } + return res; } catch (Exception e) { throw new CloudRuntimeException(e.getMessage(), e); } finally { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index a999637..aa45f8c 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java @@ -5,29 +5,31 @@ // 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.response.ListResponse; import com.cloud.utils.component.Manager; +import com.cloud.utils.component.PluggableService; -public interface UcsManager extends Manager { +public interface UcsManager extends Manager, PluggableService { UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd); ListResponse<UcsProfileResponse> listUcsProfiles(ListUcsProfileCmd cmd); ListResponse<UcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd); - void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd); + UcsBladeResponse associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd); ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 18d3475..f428e03 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java @@ -5,15 +5,16 @@ // 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 java.io.File; @@ -67,7 +68,6 @@ import com.cloud.utils.xmlobject.XmlObject; import com.cloud.utils.xmlobject.XmlObjectParser; @Local(value = { UcsManager.class }) -@Component public class UcsManagerImpl implements UcsManager { public static final Logger s_logger = Logger.getLogger(UcsManagerImpl.class); @@ -155,7 +155,9 @@ public class UcsManagerImpl implements UcsManager { UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); String login = UcsCommands.loginCmd(mgrvo.getUsername(), mgrvo.getPassword()); - cookie = client.call(login); + String ret = client.call(login); + XmlObject xo = XmlObjectParser.parseFromString(ret); + cookie = xo.get("outCookie"); cookies.put(ucsMgrId, cookie); } @@ -206,7 +208,7 @@ public class UcsManagerImpl implements UcsManager { String cmd = UcsCommands.cloneProfile(cookie, srcDn, newProfileName); String res = client.call(cmd); XmlObject xo = XmlObjectParser.parseFromString(res); - return xo.get("lsClone.outConfig.lsServer.dn"); + return xo.get("outConfig.lsServer.dn"); } private boolean isProfileAssociated(Long ucsMgrId, String dn) { @@ -216,11 +218,11 @@ public class UcsManagerImpl implements UcsManager { String cmd = UcsCommands.configResolveDn(cookie, dn); String res = client.call(cmd); XmlObject xo = XmlObjectParser.parseFromString(res); - return xo.get("outConfig.lsServer.assocState").equals("associated"); + return xo.get("outConfig.computeBlade.association").equals("associated"); } - + @Override - public void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd) { + public UcsBladeResponse associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd) { SearchCriteriaService<UcsBladeVO, UcsBladeVO> q = SearchCriteria2.create(UcsBladeVO.class); q.addAnd(q.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId()); q.addAnd(q.getEntity().getId(), Op.EQ, cmd.getBladeId()); @@ -258,11 +260,20 @@ public class UcsManagerImpl implements UcsManager { if (count >= timeout) { throw new CloudRuntimeException(String.format("associating profile[%s] to balde[%s] timeout after 600 seconds", pdn, bvo.getDn())); } + + bvo.setProfileDn(pdn); + bladeDao.update(bvo.getId(), bvo); + + UcsBladeResponse rsp = bladeVOToResponse(bvo); - s_logger.debug(String.format("successfully associated profile[%s] to blade[%s]", pdn, bvo.getDn())); + s_logger.debug(String.format("successfully associated profile[%s] to blade[%s]", pdn, bvo.getDn())); + return rsp; } private String hostIdToUuid(Long hostId) { + if (hostId == null) { + return null; + } HostVO vo = hostDao.findById(hostId); return vo.getUuid(); } @@ -298,6 +309,16 @@ public class UcsManagerImpl implements UcsManager { return response; } + private UcsBladeResponse bladeVOToResponse(UcsBladeVO vo) { + 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())); + return rsp; + } + public ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd) { SearchCriteriaService<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class); serv.addAnd(serv.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId()); @@ -305,12 +326,7 @@ public class UcsManagerImpl implements UcsManager { 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())); + UcsBladeResponse rsp = bladeVOToResponse(vo); rsps.add(rsp); } @@ -343,5 +359,16 @@ public class UcsManagerImpl implements UcsManager { @Override public void setRunLevel(int level) { this.runLevel = level; + } + + @Override + public List<Class<?>> getCommands() { + List<Class<?>> cmds = new ArrayList<Class<?>>(); + cmds.add(ListUcsBladeCmd.class); + cmds.add(ListUcsManagerCmd.class); + cmds.add(ListUcsProfileCmd.class); + cmds.add(AddUcsManagerCmd.class); + cmds.add(AssociateUcsProfileToBladeCmd.class); + return cmds; } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 634ee81..6a82dae 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerResponse.java @@ -5,15 +5,16 @@ // 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; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 1bbd2ca..0621f6f 100755 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsProfileResponse.java @@ -5,15 +5,16 @@ // 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; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 4685611..e3b1cfd 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java @@ -5,15 +5,16 @@ // 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.structure; import java.util.ArrayList; @@ -45,7 +46,7 @@ public class ComputeBlade { public static List<ComputeBlade> fromXmString(String xmlstr) { XmlObject root = XmlObjectParser.parseFromString(xmlstr); - List<XmlObject> lst = root.getAsList("configResolveClass.outConfigs.computeBlade"); + List<XmlObject> lst = root.getAsList("outConfigs.computeBlade"); List<ComputeBlade> blades = new ArrayList<ComputeBlade>(); if (lst == null) { return blades; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 index 5cb8c39..16cf35d 100644 --- a/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java @@ -5,15 +5,16 @@ // 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.structure; import java.util.ArrayList; @@ -36,7 +37,9 @@ public class UcsProfile { List<XmlObject> xos = xo.getAsList("outDns.dn"); if (xos != null) { for (XmlObject x : xos) { - UcsProfile p = UcsProfile.fromXmlObject(x); + //UcsProfile p = UcsProfile.fromXmlObject(x); + UcsProfile p = new UcsProfile(); + p.setDn(x.get("value").toString()); ps.add(p); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index 17d4723..a8f8649 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -77,8 +77,6 @@ <groupId>org.apache.cloudstack</groupId> <artifactId>cloud-utils</artifactId> <version>${project.version}</version> - <classifier>tests</classifier> - <scope>test</scope> </dependency> <dependency> <groupId>org.reflections</groupId> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/setup/db/db/schema-40to410.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 2c0b981..bc23a09 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -1653,4 +1653,26 @@ CREATE TABLE `cloud`.`baremetal_pxe_devices` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `cloud`.`ucs_blade` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `ucs_manager_id` bigint unsigned NOT NULL, + `host_id` bigint unsigned DEFAULT NULL, + `dn` varchar(512) NOT NULL, + `profile_dn` varchar(512) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`ucs_manager` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `zone_id` bigint unsigned NOT NULL, + `name` varchar(128) DEFAULT NULL, + `url` varchar(255) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + SET foreign_key_checks = 1; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2093aefc/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 a5b83a2..80ac13d 100644 --- a/utils/src/com/cloud/utils/xmlobject/XmlObject.java +++ b/utils/src/com/cloud/utils/xmlobject/XmlObject.java @@ -40,7 +40,10 @@ public class XmlObject { this.tag = tag; } - public XmlObject putElement(String key, Object e) { + public XmlObject putElement(String key, Object e) { + if (e == null) { + throw new IllegalArgumentException(String.format("element[%s] can not be null", key)); + } Object old = elements.get(key); if (old == null) { System.out.println(String.format("no %s, add new", key));
