CloudStack CLOUDSTACK-774

Supporting kickstart in CloudStack baremetal

fixing bugs to align to new code base

Conflicts:

	client/tomcatconf/componentContext.xml.in
This commit is contained in:
frank 2013-02-13 11:23:02 -08:00
parent 54741a2b0f
commit 1f15c1e9e7
14 changed files with 59 additions and 181 deletions

View File

@ -85,6 +85,11 @@
<artifactId>cloud-plugin-hypervisor-xen</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-baremetal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-ovm</artifactId>

View File

@ -44,7 +44,6 @@
<bean id="clusteredAgentManagerImpl" class="com.cloud.agent.manager.ClusteredAgentManagerImpl" />
<bean id="clusteredVirtualMachineManagerImpl" class="com.cloud.vm.ClusteredVirtualMachineManagerImpl" />
<bean id="highAvailabilityManagerExtImpl" class="com.cloud.ha.HighAvailabilityManagerExtImpl" />
<!-- bean id="bareMetalVmManagerImpl" class="com.cloud.baremetal.BareMetalVmManagerImpl" / -->
<bean id="userVmManagerImpl" class="com.cloud.vm.UserVmManagerImpl" />
<bean id="consoleProxyManagerImpl" class="com.cloud.consoleproxy.ConsoleProxyManagerImpl" />
<bean id="securityGroupManagerImpl2" class="com.cloud.network.security.SecurityGroupManagerImpl2" />
@ -53,6 +52,11 @@
<bean id="ipv6AddressManagerImpl" class="com.cloud.network.Ipv6AddressManagerImpl" />
<bean id="apiRateLimitServiceImpl" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl"/>
<bean id="BaremetalManager" class="com.cloud.baremetal.manager.BaremetalManagerImpl"/>
<bean id="BaremetalDhcpManager" class="com.cloud.baremetal.networkservice.BaremetalDhcpManagerImpl"/>
<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" />
<!--
@ -64,8 +68,11 @@
<bean id="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement">
<property name="name" value="ExternalDhcpServer"/>
</bean>
<bean id="BareMetal" class="com.cloud.network.element.BareMetalElement">
<property name="name" value="BareMetal"/>
<bean id="BareMetalDhcp" class="com.cloud.baremetal.networkservice.BaremetalDhcpElement">
<property name="name" value="BareMetalDhcp"/>
</bean>
<bean id="BareMetalPxe" class="com.cloud.baremetal.networkservice.BaremetalPxeElement">
<property name="name" value="BareMetalPxe"/>
</bean>
<bean id="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement">
<property name="name" value="SecurityGroupProvider"/>
@ -119,6 +126,14 @@
<property name="name" value="Basic"/>
</bean>
<bean id="hyervisorTemplateAdapter" class="com.cloud.template.HyervisorTemplateAdapter">
<property name="name" value="HypervisorAdapter"/>
</bean>
<bean id="BareMetalTemplateAdapter" class="com.cloud.baremetal.manager.BareMetalTemplateAdapter" >
<property name="name" value="BareMetalTemplateAdapter"/>
</bean>
<!--
Authenticators
-->
@ -181,7 +196,7 @@
-->
<bean id="BareMetalDiscoverer" class="com.cloud.baremetal.BareMetalDiscoverer">
<bean id="BareMetalDiscoverer" class="com.cloud.baremetal.manager.BareMetalDiscoverer">
<property name="name" value="Bare Metal Agent"/>
</bean>

View File

@ -68,8 +68,11 @@
<bean id="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement">
<property name="name" value="ExternalDhcpServer"/>
</bean>
<bean id="BareMetal" class="com.cloud.network.element.BareMetalElement">
<property name="name" value="BareMetal"/>
<bean id="BareMetalDhcp" class="com.cloud.baremetal.networkservice.BaremetalDhcpElement">
<property name="name" value="BareMetalDhcp"/>
</bean>
<bean id="BareMetalPxe" class="com.cloud.baremetal.networkservice.BaremetalPxeElement">
<property name="name" value="BareMetalPxe"/>
</bean>
<bean id="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement">
<property name="name" value="SecurityGroupProvider"/>

View File

@ -69,8 +69,10 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
long startTime = System.nanoTime();
s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
Set<Class<?>> cmdClasses = new HashSet<Class<?>>();
for(PluggableService service: _services)
cmdClasses.addAll(service.getCommands());
for(PluggableService service: _services) {
s_logger.debug(String.format("getting api commands of service: %s", service.getClass().getName()));
cmdClasses.addAll(service.getCommands());
}
cacheResponseMap(cmdClasses);
long endTime = System.nanoTime();
s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");

View File

@ -1,25 +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.
//
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.database;
import com.cloud.utils.db.GenericDao;
public interface BaremetalCmdbDao extends GenericDao<BaremetalCmdbVO, Long> {
}

View File

@ -1,32 +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.
//
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.database;
import javax.ejb.Local;
import org.springframework.stereotype.Component;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
@Component
@Local(value = {BaremetalCmdbDao.class})
@DB(txn = false)
public class BaremetalCmdbDaoImpl extends GenericDaoBase<BaremetalCmdbVO, Long> implements BaremetalCmdbDao {
}

View File

@ -1,104 +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.
//
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.database;
import java.util.UUID;
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="baremetal_cmdb")
public class BaremetalCmdbVO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name="uuid")
private String uuid;
@Column(name="zone_id")
private long zoneId;
@Column(name="url")
private String url;
@Column(name="password")
private String password;
@Column(name="username")
private String username;
public BaremetalCmdbVO() {
uuid = UUID.randomUUID().toString();
}
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 long getZoneId() {
return zoneId;
}
public void setZoneId(long zoneId) {
this.zoneId = zoneId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

View File

@ -18,10 +18,12 @@
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.manager;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
import org.apache.cloudstack.api.response.HostResponse;
@APICommand(name="addBaremetalHost", description="add a baremetal host", responseObject = HostResponse.class)
public class AddBaremetalHostCmd extends AddHostCmd {
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="ip address intentionally allocated to this host after provisioning")

View File

@ -18,9 +18,11 @@
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.networkservice;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.Parameter;
@APICommand(name="addBaremetalPxePingServer", description="add a baremetal ping pxe server", responseObject = BaremetalPxePingResponse.class)
public class AddBaremetalPxePingServerCmd extends AddBaremetalPxeCmd {
@Parameter(name=ApiConstants.PING_STORAGE_SERVER_IP, type=CommandType.STRING, required = true, description="PING storage server ip")

View File

@ -319,6 +319,9 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
@Override
public List<Class<?>> getCommands() {
return null;
List<Class<?>> cmds = new ArrayList<Class<?>>();
cmds.add(AddBaremetalDhcpCmd.class);
cmds.add(ListBaremetalDhcpCmd.class);
return cmds;
}
}

View File

@ -166,13 +166,11 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
@Override
public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
return true;
}
@Override
public boolean verifyServicesCombination(Set<Service> services) {
// TODO Auto-generated method stub
return false;
return true;
}
}

View File

@ -23,6 +23,7 @@
package com.cloud.baremetal.networkservice;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -236,7 +237,10 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
@Override
public List<Class<?>> getCommands() {
// TODO Auto-generated method stub
return null;
List<Class<?>> cmds = new ArrayList<Class<?>>();
cmds.add(AddBaremetalKickStartPxeCmd.class);
cmds.add(AddBaremetalPxePingServerCmd.class);
cmds.add(ListBaremetalPxePingServersCmd.class);
return cmds;
}
}

View File

@ -139,6 +139,7 @@ import com.cloud.utils.component.PluggableService;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
@Component
public class ApiServer implements HttpRequestHandler {
@ -207,8 +208,12 @@ public class ApiServer implements HttpRequestHandler {
for(PluggableService pluggableService: _pluggableServices)
cmdClasses.addAll(pluggableService.getCommands());
for(Class<?> cmdClass: cmdClasses) {
String apiName = cmdClass.getAnnotation(APICommand.class).name();
for(Class<?> cmdClass: cmdClasses) {
APICommand at = cmdClass.getAnnotation(APICommand.class);
if (at == null) {
throw new CloudRuntimeException(String.format("%s is claimed as a API command, but it doesn't have @APICommand annotation", cmdClass.getName()));
}
String apiName = at.name();
if (_apiNameCmdClassMap.containsKey(apiName)) {
s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName);
continue;

View File

@ -97,8 +97,8 @@ public class Transaction {
/* FIXME: We need a better solution for this
* Initialize encryption if we need it for db.properties
*/
EncryptionSecretKeyChecker enc = new EncryptionSecretKeyChecker();
enc.check();
//EncryptionSecretKeyChecker enc = new EncryptionSecretKeyChecker();
//enc.check();
}
private final LinkedList<StackElement> _stack;