This commit is contained in:
Pranav Saxena 2013-02-19 16:47:52 +05:30
commit fb689e77f1
35 changed files with 388 additions and 266 deletions

View File

@ -264,6 +264,8 @@ public interface ConfigurationService {
boolean removeLDAP(LDAPRemoveCmd cmd);
LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd);
/**
* @param offering
* @return

View File

@ -31,6 +31,7 @@ import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
@APICommand(name = "ldapConfig", description="Configure the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.0")
@ -43,7 +44,10 @@ public class LDAPConfigCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com")
@Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com")
private String listall;
@Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com")
private String hostname;
@Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.")
@ -52,10 +56,10 @@ public class LDAPConfigCmd extends BaseCmd {
@Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
private Boolean useSSL;
@Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, required=true, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
@Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
private String searchBase;
@Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, required=true, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
@Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
private String queryFilter;
@Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.")
@ -74,6 +78,10 @@ public class LDAPConfigCmd extends BaseCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getListAll() {
return listall == null ? "false" : listall;
}
public String getBindPassword() {
return bindPassword;
}
@ -82,30 +90,56 @@ public class LDAPConfigCmd extends BaseCmd {
return bindDN;
}
public void setBindDN(String bdn) {
this.bindDN=bdn;
}
public String getQueryFilter() {
return queryFilter;
}
public void setQueryFilter(String queryFilter) {
this.queryFilter=queryFilter;
}
public String getSearchBase() {
return searchBase;
}
public void setSearchBase(String searchBase) {
this.searchBase=searchBase;
}
public Boolean getUseSSL() {
return useSSL == null ? Boolean.FALSE : Boolean.TRUE;
return useSSL == null ? Boolean.FALSE : useSSL;
}
public void setUseSSL(Boolean useSSL) {
this.useSSL=useSSL;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname=hostname;
}
public Integer getPort() {
return port <= 0 ? 389 : port;
}
public void setPort(Integer port) {
this.port=port;
}
public String getTrustStore() {
return trustStore;
}
public void setTrustStore(String trustStore) {
this.trustStore=trustStore;
}
public String getTrustStorePassword() {
return trustStorePassword;
@ -122,12 +156,25 @@ public class LDAPConfigCmd extends BaseCmd {
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
try {
boolean result = _configService.updateLDAP(this);
if (result){
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
if ("true".equalsIgnoreCase(getListAll())){
// return the existing conf
LDAPConfigCmd cmd = _configService.listLDAPConfig(this);
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(),
cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
lr.setResponseName(getCommandName());
this.setResponseObject(lr);
}
else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) {
throw new InvalidParameterValueException("You need to provide hostname, serachbase and queryfilter to configure your LDAP server");
}
else {
boolean result = _configService.updateLDAP(this);
if (result){
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
lr.setResponseName(getCommandName());
this.setResponseObject(lr);
}
}
}
catch (NamingException ne){
ne.printStackTrace();

View File

@ -30,7 +30,7 @@ public class LDAPConfigResponse extends BaseResponse {
@SerializedName(ApiConstants.PORT) @Param(description="Specify the LDAP port if required, default is 389")
private String port;
@SerializedName(ApiConstants.PORT) @Param(description="Check Use SSL if the external LDAP server is configured for LDAP over SSL")
@SerializedName(ApiConstants.USE_SSL) @Param(description="Check Use SSL if the external LDAP server is configured for LDAP over SSL")
private String useSSL;
@SerializedName(ApiConstants.SEARCH_BASE) @Param(description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com")

View File

@ -174,6 +174,13 @@
<property name="name" value="KVM Agent"/>
</bean>
<!--
<bean id="SimulatorDiscoverer" class="com.cloud.resource.SimulatorDiscoverer">
<property name="name" value="KVM Agent"/>
</bean>
-->
<bean id="BareMetalDiscoverer" class="com.cloud.baremetal.BareMetalDiscoverer">
<property name="name" value="Bare Metal Agent"/>
</bean>
@ -265,5 +272,11 @@
<bean id="OvmGuru" class="com.cloud.ovm.hypervisor.OvmGuru">
<property name="name" value="OvmGuru"/>
</bean>
<!--
<bean id="SimulatorGuru" class="com.cloud.simulator.SimulatorGuru">
<property name="name" value="SimulatorGuru"/>
</bean>
-->
</beans>

View File

@ -24,11 +24,11 @@
console view via the web UI. It connects the users browser to the VNC port made available via
the hypervisor for the console of the guest. Both the administrator and end user web UIs offer a
console connection.</para>
<para>Clicking on a console icon brings up a new window. The AJAX code downloaded into that window
<para>Clicking a console icon brings up a new window. The AJAX code downloaded into that window
refers to the public IP address of a console proxy VM. There is exactly one public IP address
allocated per console proxy VM. The AJAX application connects to this IP. The console proxy then
proxies the connection to the VNC port for the requested VM on the Host hosting the guest.
.</para>
proxies the connection to the VNC port for the requested VM on the Host hosting the
guest.</para>
<note>
<para>The hypervisors will have many ports assigned to VNC usage so that multiple VNC sessions
can occur simultaneously.</para>

View File

@ -1,33 +1,39 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
%BOOK_ENTITIES;
]>
<!-- 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.
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.
-->
<chapter id="working-with-system-vm">
<title>Working with System Virtual Machines</title>
<para>&PRODUCT; uses several types of system virtual machines to perform tasks in the cloud. In general &PRODUCT; manages these system VMs and creates, starts, and stops them as needed based on scale and immediate needs. However, the administrator should be aware of them and their roles to assist in debugging issues.</para>
<xi:include href="system-vm-template.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="multiple-system-vm-vmware.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="console-proxy.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="virtual-router.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="secondary-storage-vm.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<title>Working with System Virtual Machines</title>
<para>&PRODUCT; uses several types of system virtual machines to perform tasks in the cloud. In
general &PRODUCT; manages these system VMs and creates, starts, and stops them as needed based
on scale and immediate needs. However, the administrator should be aware of them and their roles
to assist in debugging issues.</para>
<note>
<para>You can configure the system.vm.random.password parameter to create a random system VM
password to ensure higher security. If you reset the value for system.vm.random.password to
true and restart the Management Server, a random password is generated and stored encrypted in
the database. You can view the decrypted password under the system.vm.password global
parameter on the &PRODUCT; UI or by calling the listConfigurations API.</para>
</note>
<xi:include href="system-vm-template.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="multiple-system-vm-vmware.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="console-proxy.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="virtual-router.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="secondary-storage-vm.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</chapter>

View File

@ -62,7 +62,9 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
import org.springframework.stereotype.Component;
@Component
@Local(value = { MockAgentManager.class })
public class MockAgentManagerImpl extends ManagerBase implements MockAgentManager {
private static final Logger s_logger = Logger.getLogger(MockAgentManagerImpl.class);

View File

@ -97,7 +97,9 @@ import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine.State;
import org.springframework.stereotype.Component;
@Component
@Local(value = { MockStorageManager.class })
public class MockStorageManagerImpl extends ManagerBase implements MockStorageManager {
private static final Logger s_logger = Logger.getLogger(MockStorageManagerImpl.class);

View File

@ -17,58 +17,12 @@
package com.cloud.agent.manager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.BumpUpPriorityCommand;
import com.cloud.agent.api.CheckRouterAnswer;
import com.cloud.agent.api.CheckRouterCommand;
import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.CleanupNetworkRulesCmd;
import com.cloud.agent.api.GetDomRVersionAnswer;
import com.cloud.agent.api.GetDomRVersionCmd;
import com.cloud.agent.api.GetVmStatsAnswer;
import com.cloud.agent.api.GetVmStatsCommand;
import com.cloud.agent.api.GetVncPortAnswer;
import com.cloud.agent.api.GetVncPortCommand;
import com.cloud.agent.api.MigrateAnswer;
import com.cloud.agent.api.MigrateCommand;
import com.cloud.agent.api.NetworkUsageAnswer;
import com.cloud.agent.api.NetworkUsageCommand;
import com.cloud.agent.api.PrepareForMigrationAnswer;
import com.cloud.agent.api.PrepareForMigrationCommand;
import com.cloud.agent.api.RebootAnswer;
import com.cloud.agent.api.RebootCommand;
import com.cloud.agent.api.SecurityGroupRuleAnswer;
import com.cloud.agent.api.SecurityGroupRulesCmd;
import com.cloud.agent.api.StartAnswer;
import com.cloud.agent.api.StartCommand;
import com.cloud.agent.api.StopAnswer;
import com.cloud.agent.api.StopCommand;
import com.cloud.agent.api.VmStatsEntry;
import com.cloud.agent.api.*;
import com.cloud.agent.api.check.CheckSshAnswer;
import com.cloud.agent.api.check.CheckSshCommand;
import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
import com.cloud.agent.api.routing.DhcpEntryCommand;
import com.cloud.agent.api.routing.IpAssocCommand;
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.api.routing.SavePasswordCommand;
import com.cloud.agent.api.routing.SetFirewallRulesCommand;
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
import com.cloud.agent.api.routing.VmDataCommand;
import com.cloud.agent.api.routing.*;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.network.Networks.TrafficType;
@ -86,7 +40,18 @@ import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine.State;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
@Local(value = { MockVmManager.class })
public class MockVmManagerImpl extends ManagerBase implements MockVmManager {
private static final Logger s_logger = Logger.getLogger(MockVmManagerImpl.class);

View File

@ -16,73 +16,12 @@
// under the License.
package com.cloud.agent.manager;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.AttachIsoCommand;
import com.cloud.agent.api.AttachVolumeCommand;
import com.cloud.agent.api.BackupSnapshotCommand;
import com.cloud.agent.api.BumpUpPriorityCommand;
import com.cloud.agent.api.CheckHealthCommand;
import com.cloud.agent.api.CheckNetworkCommand;
import com.cloud.agent.api.CheckRouterCommand;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.CleanupNetworkRulesCmd;
import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.ComputeChecksumCommand;
import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
import com.cloud.agent.api.CreateStoragePoolCommand;
import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
import com.cloud.agent.api.DeleteSnapshotBackupCommand;
import com.cloud.agent.api.DeleteStoragePoolCommand;
import com.cloud.agent.api.GetDomRVersionCmd;
import com.cloud.agent.api.GetHostStatsCommand;
import com.cloud.agent.api.GetStorageStatsCommand;
import com.cloud.agent.api.GetVmStatsCommand;
import com.cloud.agent.api.GetVncPortCommand;
import com.cloud.agent.api.MaintainCommand;
import com.cloud.agent.api.ManageSnapshotCommand;
import com.cloud.agent.api.MigrateCommand;
import com.cloud.agent.api.ModifyStoragePoolCommand;
import com.cloud.agent.api.NetworkUsageCommand;
import com.cloud.agent.api.PingTestCommand;
import com.cloud.agent.api.PrepareForMigrationCommand;
import com.cloud.agent.api.RebootCommand;
import com.cloud.agent.api.SecStorageSetupCommand;
import com.cloud.agent.api.SecStorageVMSetupCommand;
import com.cloud.agent.api.SecurityGroupRulesCmd;
import com.cloud.agent.api.StartCommand;
import com.cloud.agent.api.StopCommand;
import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.api.*;
import com.cloud.agent.api.check.CheckSshCommand;
import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
import com.cloud.agent.api.routing.DhcpEntryCommand;
import com.cloud.agent.api.routing.IpAssocCommand;
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
import com.cloud.agent.api.routing.SavePasswordCommand;
import com.cloud.agent.api.routing.SetFirewallRulesCommand;
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
import com.cloud.agent.api.routing.VmDataCommand;
import com.cloud.agent.api.storage.CopyVolumeCommand;
import com.cloud.agent.api.storage.CreateCommand;
import com.cloud.agent.api.storage.DeleteTemplateCommand;
import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.DownloadCommand;
import com.cloud.agent.api.storage.DownloadProgressCommand;
import com.cloud.agent.api.storage.ListTemplateCommand;
import com.cloud.agent.api.storage.ListVolumeCommand;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.agent.api.routing.*;
import com.cloud.agent.api.storage.*;
import com.cloud.simulator.MockConfigurationVO;
import com.cloud.simulator.MockHost;
import com.cloud.simulator.MockVMVO;
@ -95,7 +34,16 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine.State;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import java.util.HashMap;
import java.util.Map;
@Component
@Local(value = { SimulatorManager.class })
public class SimulatorManagerImpl extends ManagerBase implements SimulatorManager {
private static final Logger s_logger = Logger.getLogger(SimulatorManagerImpl.class);

View File

@ -53,7 +53,7 @@ import com.cloud.storage.VMTemplateZoneVO;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplateHostDao;
import com.cloud.storage.dao.VMTemplateZoneDao;
import org.springframework.stereotype.Component;
@Local(value = Discoverer.class)
public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {

View File

@ -42,7 +42,9 @@ import com.cloud.storage.SnapshotVO;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.secondary.SecondaryStorageDiscoverer;
import com.cloud.utils.exception.CloudRuntimeException;
import org.springframework.stereotype.Component;
@Component
@Local(value=Discoverer.class)
public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer implements ResourceStateAdapter, Listener {
private static final Logger s_logger = Logger.getLogger(SimulatorSecondaryDiscoverer.class);

View File

@ -16,9 +16,6 @@
// under the License.
package com.cloud.simulator;
import javax.ejb.Local;
import javax.inject.Inject;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorGuru;
@ -28,6 +25,10 @@ import com.cloud.storage.dao.GuestOSDao;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import javax.ejb.Local;
import javax.inject.Inject;
@Local(value=HypervisorGuru.class)
public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru {
@Inject GuestOSDao _guestOsDao;

View File

@ -16,18 +16,19 @@
// under the License.
package com.cloud.simulator.dao;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Formatter;
import javax.ejb.Local;
import com.cloud.simulator.MockConfigurationVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Formatter;
@Component
@Local(value={MockConfigurationDao.class})
public class MockConfigurationDaoImpl extends GenericDaoBase<MockConfigurationVO, Long> implements MockConfigurationDao {
private SearchBuilder<MockConfigurationVO> _searchByDcIdName;

View File

@ -16,14 +16,16 @@
// under the License.
package com.cloud.simulator.dao;
import javax.ejb.Local;
import com.cloud.simulator.MockHost;
import com.cloud.simulator.MockHostVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
@Component
@Local(value={MockHostDao.class})
public class MockHostDaoImpl extends GenericDaoBase<MockHostVO, Long> implements MockHostDao {
protected final SearchBuilder<MockHostVO> GuidSearch;

View File

@ -16,13 +16,15 @@
// under the License.
package com.cloud.simulator.dao;
import javax.ejb.Local;
import com.cloud.simulator.MockSecStorageVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
@Component
@Local(value={MockSecStorageDao.class})
public class MockSecStorageDaoImpl extends GenericDaoBase<MockSecStorageVO, Long> implements MockSecStorageDao {
protected final SearchBuilder<MockSecStorageVO> urlSearch;

View File

@ -16,16 +16,18 @@
// under the License.
package com.cloud.simulator.dao;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import com.cloud.simulator.MockSecurityRulesVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import java.util.List;
import java.util.Map;
@Component
@Local(value={MockSecurityRulesDao.class})
public class MockSecurityRulesDaoImpl extends GenericDaoBase<MockSecurityRulesVO, Long> implements MockSecurityRulesDao {
protected SearchBuilder<MockSecurityRulesVO> vmIdSearch;

View File

@ -16,14 +16,16 @@
// under the License.
package com.cloud.simulator.dao;
import javax.ejb.Local;
import com.cloud.simulator.MockStoragePoolVO;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
@Component
@Local(value={MockStoragePoolDao.class})
public class MockStoragePoolDaoImpl extends GenericDaoBase<MockStoragePoolVO, Long> implements MockStoragePoolDao {
protected final SearchBuilder<MockStoragePoolVO> uuidSearch;

View File

@ -16,14 +16,6 @@
// under the License.
package com.cloud.simulator.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.simulator.MockHostVO;
import com.cloud.simulator.MockVMVO;
import com.cloud.utils.db.GenericDaoBase;
@ -31,7 +23,16 @@ import com.cloud.utils.db.JoinBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.vm.VirtualMachine;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
@Local(value={MockVMDao.class})
public class MockVMDaoImpl extends GenericDaoBase<MockVMVO, Long> implements MockVMDao {
protected SearchBuilder<MockVMVO> GuidSearch;

View File

@ -16,10 +16,6 @@
// under the License.
package com.cloud.simulator.dao;
import java.util.List;
import javax.ejb.Local;
import com.cloud.simulator.MockVolumeVO;
import com.cloud.simulator.MockVolumeVO.MockVolumeType;
import com.cloud.utils.db.GenericDaoBase;
@ -27,7 +23,12 @@ import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Func;
import org.springframework.stereotype.Component;
import javax.ejb.Local;
import java.util.List;
@Component
@Local(value={MockVolumeDao.class})
public class MockVolumeDaoImpl extends GenericDaoBase<MockVolumeVO, Long> implements MockVolumeDao {
protected final SearchBuilder<MockVolumeVO> idTypeSearch;

View File

@ -315,6 +315,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
params.put("wait", Integer.toString(_wait));
details.put("wait", Integer.toString(_wait));
params.put("migratewait", _configDao.getValue(Config.MigrateWait.toString()));
params.put(Config.XenMaxNics.toString().toLowerCase(), _configDao.getValue(Config.XenMaxNics.toString()));
params.put(Config.InstanceName.toString().toLowerCase(), _instance);
details.put(Config.InstanceName.toString().toLowerCase(), _instance);
try {

View File

@ -331,6 +331,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
protected boolean _isOvs = false;
protected List<VIF> _tmpDom0Vif = new ArrayList<VIF>();
protected XenServerStorageResource storageResource;
protected int _maxNics = 7;
public enum SRType {
NFS, LVM, ISCSI, ISO, LVMOISCSI, LVMOHBA, EXT, FILE;
@ -3842,22 +3843,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
throw new CloudRuntimeException("Could not find an available slot in VM with name to attach a new disk.");
}
protected String getUnusedVIFNum(Connection conn, VM vm) {
String vmName = "";
try {
vmName = vm.getNameLabel(conn);
Set<String> allowedVIFDevices = vm.getAllowedVIFDevices(conn);
if (allowedVIFDevices.size() > 0) {
return allowedVIFDevices.iterator().next();
}
} catch (Exception e) {
String msg = "getUnusedVIFNum failed due to " + e.toString();
s_logger.warn(msg, e);
}
throw new CloudRuntimeException("Could not find available VIF slot in VM with name: " + vmName + " to plug a VIF");
}
protected String callHostPlugin(Connection conn, String plugin, String cmd, String... params) {
Map<String, String> args = new HashMap<String, String>();
String msg;
@ -3989,22 +3974,29 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
protected String getLowestAvailableVIFDeviceNum(Connection conn, VM vm) {
String vmName = "";
try {
Set<String> availableDeviceNums = vm.getAllowedVIFDevices(conn);
Iterator<String> deviceNumsIterator = availableDeviceNums.iterator();
List<Integer> sortedDeviceNums = new ArrayList<Integer>();
while (deviceNumsIterator.hasNext()) {
try {
sortedDeviceNums.add(Integer.valueOf(deviceNumsIterator.next()));
vmName = vm.getNameLabel(conn);
List<Integer> usedDeviceNums = new ArrayList<Integer>();
Set<VIF> vifs = vm.getVIFs(conn);
Iterator<VIF> vifIter = vifs.iterator();
while(vifIter.hasNext()){
VIF vif = vifIter.next();
try{
usedDeviceNums.add(Integer.valueOf(vif.getDevice(conn)));
} catch (NumberFormatException e) {
s_logger.debug("Obtained an invalid value for an available VIF device number for VM: " + vm.getNameLabel(conn));
return null;
String msg = "Obtained an invalid value for an allocated VIF device number for VM: " + vmName;
s_logger.debug(msg, e);
throw new CloudRuntimeException(msg);
}
}
Collections.sort(sortedDeviceNums);
return String.valueOf(sortedDeviceNums.get(0));
for(Integer i=0; i< _maxNics; i++){
if(!usedDeviceNums.contains(i)){
s_logger.debug("Lowest available Vif device number: "+i+" for VM: " + vmName);
return i.toString();
}
}
} catch (XmlRpcException e) {
String msg = "Caught XmlRpcException: " + e.getMessage();
s_logger.warn(msg, e);
@ -4013,7 +4005,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
s_logger.warn(msg, e);
}
return null;
throw new CloudRuntimeException("Could not find available VIF slot in VM with name: " + vmName);
}
protected VDI mount(Connection conn, StoragePoolType pooltype, String volumeFolder, String volumePath) {
@ -5655,6 +5647,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
value = (String) params.get("migratewait");
_migratewait = NumbersUtil.parseInt(value, 3600);
_maxNics = NumbersUtil.parseInt((String) params.get("xen.nics.max"), 7);
if (_pod == null) {
throw new ConfigurationException("Unable to get the pod");
}
@ -7765,7 +7759,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
s_logger.warn(msg);
return new PlugNicAnswer(cmd, false, msg);
}
String deviceId = getUnusedVIFNum(conn, vm);
String deviceId = getLowestAvailableVIFDeviceNum(conn, vm);
nic.setDeviceId(Integer.parseInt(deviceId));
vif = createVif(conn, vmName, vm, nic);
vif.plug(conn);

View File

@ -66,7 +66,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
String port = _configDao.getValue(LDAPParams.port.toString());
String queryFilter = _configDao.getValue(LDAPParams.queryfilter.toString());
String searchBase = _configDao.getValue(LDAPParams.searchbase.toString());
String useSSL = _configDao.getValue(LDAPParams.usessl.toString());
Boolean useSSL = Boolean.valueOf(_configDao.getValue(LDAPParams.usessl.toString()));
String bindDN = _configDao.getValue(LDAPParams.dn.toString());
String bindPasswd = _configDao.getValue(LDAPParams.passwd.toString());
String trustStore = _configDao.getValue(LDAPParams.truststore.toString());
@ -77,7 +77,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
Hashtable<String, String> env = new Hashtable<String, String>(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
String protocol = "ldap://" ;
if (new Boolean(useSSL)){
if (useSSL){
env.put(Context.SECURITY_PROTOCOL, "ssl");
protocol="ldaps://" ;
System.setProperty("javax.net.ssl.trustStore", trustStore);
@ -123,7 +123,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
env = new Hashtable<String, String>(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
protocol = "ldap://" ;
if (new Boolean(useSSL)){
if (useSSL){
env.put(Context.SECURITY_PROTOCOL, "ssl");
protocol="ldaps://" ;
}
@ -135,8 +135,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator {
ctx.close();
} catch (NamingException ne) {
ne.printStackTrace();
s_logger.warn("Authentication failed due to " + ne.getMessage());
s_logger.warn("Authentication Failed ! " + ne.getMessage() + (ne.getCause() != null ? ("; Caused by:" + ne.getCause().getMessage()) : ""));
return false;
}
catch (Exception e){

View File

@ -68,7 +68,7 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO,
DomainRouterResponse routerResponse = new DomainRouterResponse();
routerResponse.setId(router.getUuid());
routerResponse.setZoneId(router.getDataCenterUuid());
routerResponse.setName(router.getHostName());
routerResponse.setName(router.getName());
routerResponse.setTemplateId(router.getTemplateUuid());
routerResponse.setCreated(router.getCreated());
routerResponse.setState(router.getState());

View File

@ -247,7 +247,7 @@ public enum Config {
XenBondStorageNic("Advanced", ManagementServer.class, String.class, "xen.bond.storage.nics", null, "Attempt to bond the two networks if found", null),
XenHeartBeatInterval("Advanced", ManagementServer.class, Integer.class, "xen.heartbeat.interval", "60", "heartbeat to use when implementing XenServer Self Fencing", null),
XenGuestNetwork("Hidden", ManagementServer.class, String.class, "xen.guest.network.device", null, "Specify for guest network name label", null),
XenMaxNics("Advanced", AgentManager.class, Integer.class, "xen.nics.max", "7", "Maximum allowed nics for Vms created on Xen", null),
// VMware
VmwarePrivateNetworkVSwitch("Hidden", ManagementServer.class, String.class, "vmware.private.vswitch", null, "Specify the vSwitch on host for private network", null),
VmwarePublicNetworkVSwitch("Hidden", ManagementServer.class, String.class, "vmware.public.vswitch", null, "Specify the vSwitch on host for public network", null),
@ -360,7 +360,7 @@ public enum Config {
VpcMaxNetworks("Advanced", ManagementServer.class, Integer.class, "vpc.max.networks", "3", "Maximum number of networks per vpc", null),
DetailBatchQuerySize("Advanced", ManagementServer.class, Integer.class, "detail.batch.query.size", "2000", "Default entity detail batch query size for listing", null),
ConcurrentSnapshotsThresholdPerHost("Advanced", ManagementServer.class, Long.class, "concurrent.snapshots.threshold.perhost",
null, "Limits number of snapshots that can be handled by the host concurrently; default is NULL - unlimited", null),
null, "Limits number of snapshots that can be handled by the host concurrently; default is NULL - unlimited", null),
NetworkIPv6SearchRetryMax("Network", ManagementServer.class, Integer.class, "network.ipv6.search.retry.max", "10000", "The maximum number of retrying times to search for an available IPv6 address in the table", null),
ExternalBaremetalSystemUrl("Advanced", ManagementServer.class, String.class, "external.baremetal.system.url", null, "url of external baremetal system that CloudStack will talk to", null),

View File

@ -1246,6 +1246,27 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
return true;
}
@Override
@DB
public LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd) {
String hostname = _configDao.getValue(LDAPParams.hostname.toString());
cmd.setHostname(hostname == null ? "" : hostname);
String port = _configDao.getValue(LDAPParams.port.toString());
cmd.setPort(port == null ? 0 : Integer.valueOf(port));
String queryFilter = _configDao.getValue(LDAPParams.queryfilter.toString());
cmd.setQueryFilter(queryFilter == null ? "" : queryFilter);
String searchBase = _configDao.getValue(LDAPParams.searchbase.toString());
cmd.setSearchBase(searchBase == null ? "" : searchBase);
String useSSL = _configDao.getValue(LDAPParams.usessl.toString());
cmd.setUseSSL(useSSL == null ? Boolean.FALSE : Boolean.valueOf(useSSL));
String binddn = _configDao.getValue(LDAPParams.dn.toString());
cmd.setBindDN(binddn == null ? "" : binddn);
String truststore = _configDao.getValue(LDAPParams.truststore.toString());
cmd.setTrustStore(truststore == null ? "" : truststore);
return cmd;
}
@Override
@DB
public boolean updateLDAP(LDAPConfigCmd cmd) {
@ -1265,11 +1286,16 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
throw new InvalidParameterValueException("If you specify a bind name then you need to provide bind password too.");
}
// check query filter if it contains valid substitution
if (!queryFilter.contains("%u") && !queryFilter.contains("%n") && !queryFilter.contains("%e")){
throw new InvalidParameterValueException("QueryFilter should contain at least one of the substitutions: %u, %n or %e: " + queryFilter);
}
// check if the info is correct
Hashtable<String, String> env = new Hashtable<String, String>(11);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
String protocol = "ldap://";
if (new Boolean(useSSL)) {
if (useSSL) {
env.put(Context.SECURITY_PROTOCOL, "ssl");
protocol = "ldaps://";
if (trustStore == null || trustStorePassword == null) {
@ -1288,7 +1314,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
DirContext ctx = new InitialDirContext(env);
ctx.close();
// store the result in DB COnfiguration
// store the result in DB Configuration
ConfigurationVO cvo = _configDao.findByName(LDAPParams.hostname.toString());
if (cvo == null) {
cvo = new ConfigurationVO("Hidden", "DEFAULT", "management-server", LDAPParams.hostname.toString(), null, "Hostname or ip address of the ldap server eg: my.ldap.com");
@ -1356,8 +1382,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
s_logger.debug("The ldap server is configured: " + hostname);
} catch (NamingException ne) {
ne.printStackTrace();
throw new InvalidParameterValueException("Naming Exception, check you ldap data ! " + ne.getMessage() + (ne.getCause() != null ? ("Caused by:" + ne.getCause().getMessage()) : ""));
throw new InvalidParameterValueException("Naming Exception, check you ldap data ! " + ne.getMessage() + (ne.getCause() != null ? ("; Caused by:" + ne.getCause().getMessage()) : ""));
}
return true;
}

View File

@ -341,11 +341,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
_agentMgr.send(dest.getHost().getId(), cmds);
PlugNicAnswer plugNicAnswer = cmds.getAnswer(PlugNicAnswer.class);
if (!(plugNicAnswer != null && plugNicAnswer.getResult())) {
s_logger.warn("Unable to plug nic for vm " + vm.getHostName());
s_logger.warn("Unable to plug nic for vm " + vm.getName());
result = false;
}
} catch (OperationTimedoutException e) {
throw new AgentUnavailableException("Unable to plug nic for router " + vm.getHostName() + " in network " + network,
throw new AgentUnavailableException("Unable to plug nic for router " + vm.getName() + " in network " + network,
dest.getHost().getId(), e);
}
} else {

View File

@ -1233,13 +1233,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
ex.addProxyObject("vpc", vpcId, "VPC");
throw ex;
}
//allow only one private gateway per vpc
VpcGatewayVO gatewayVO = _vpcGatewayDao.getPrivateGatewayForVpc(vpcId);
if (gatewayVO != null) {
throw new InvalidParameterValueException("Private ip address already exists for vpc " + vpc);
}
//Validate physical network
if (physicalNetworkId == null) {
List<? extends PhysicalNetwork> pNtwks = _ntwkModel.getPhysicalNtwksSupportingTrafficType(vpc.getZoneId(), TrafficType.Guest);
@ -1258,7 +1252,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
vlan, ipAddress, null, gateway, netmask, gatewayOwnerId, vpcId);
//2) create gateway entry
gatewayVO = new VpcGatewayVO(ipAddress, VpcGateway.Type.Private, vpcId, privateNtwk.getDataCenterId(),
VpcGatewayVO gatewayVO = new VpcGatewayVO(ipAddress, VpcGateway.Type.Private, vpcId, privateNtwk.getDataCenterId(),
privateNtwk.getId(), vlan, gateway, netmask, vpc.getAccountId(), vpc.getDomainId());
_vpcGatewayDao.persist(gatewayVO);

View File

@ -128,6 +128,7 @@ public abstract class DiscovererBase extends AdapterBase implements Discoverer {
params.put("secondary.storage.vm", "false");
params.put("max.template.iso.size", _configDao.getValue(Config.MaxTemplateAndIsoSize.toString()));
params.put("migratewait", _configDao.getValue(Config.MigrateWait.toString()));
params.put(Config.XenMaxNics.toString().toLowerCase(), _configDao.getValue(Config.XenMaxNics.toString()));
return params;
}

View File

@ -83,81 +83,81 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.1.8", new DbUpgrade[] { new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.1.9", new DbUpgrade[] { new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.1", new DbUpgrade[] { new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(),
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.2", new DbUpgrade[] { new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.3", new DbUpgrade[] { new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.4", new DbUpgrade[] { new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40() });
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.5", new DbUpgrade[] { new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40() });
new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.6", new DbUpgrade[] { new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.7", new DbUpgrade[] { new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.8", new DbUpgrade[] { new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
, new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
, new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.9", new DbUpgrade[] { new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40() });
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.10", new DbUpgrade[] { new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.11", new DbUpgrade[] { new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.12", new DbUpgrade[] { new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.13", new DbUpgrade[] { new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40() });
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("2.2.14", new DbUpgrade[] { new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40() });
new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("3.0.0", new DbUpgrade[] { new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
_upgradeMap.put("3.0.0", new DbUpgrade[] { new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40() });
_upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40() });
_upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40(), new Upgrade40to41() });
_upgradeMap.put("4.0.0", new DbUpgrade[] { new Upgrade40to41() });
}

View File

@ -365,6 +365,15 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
return false;
}
/* (non-Javadoc)
* @see com.cloud.configuration.ConfigurationService#listLDAPConfig(org.apache.cloudstack.api.commands.LDAPConfigCmd)
*/
@Override
public LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.configuration.ConfigurationService#isOfferingForVpc(com.cloud.offering.NetworkOffering)
*/

View File

@ -23,3 +23,4 @@ ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_hosts_per_cluster`
UPDATE `cloud`.`hypervisor_capabilities` SET `max_hosts_per_cluster`=32 WHERE `hypervisor_type`='VMware';
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.1', 128, 0, 32);
DELETE FROM `cloud`.`configuration` where name='vmware.percluster.host.max';
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xen.nics.max', '7', 'Maximum allowed nics for Vms created on Xen');

View File

@ -19,6 +19,8 @@ under the License.
# Setting up Tools and Environment
- Install VirtualBox 4.2 or latest
- Tool for exporting appliances: qemu-img, vboxmanage, vhd-util
- Install [RVM](https://rvm.io/rvm/install)
- Setup paths:
export PATH=~/.rvm/bin:$PATH
@ -36,7 +38,14 @@ Note, gem may require gcc-4.2, make sure link exists:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
# How to build SystemVM template appliance
# How to build SystemVMs automatically
Just run build.sh, it will export archived appliances for KVM, Xen,
VMWare and HyperV in `dist`:
sh build.sh
# Building SystemVM template appliance manually
List available appliances one can build:
@ -50,3 +59,9 @@ Build systemvm template appliance:
Start the box:
veewee vbox up 'systemvmtemplate'
Halt the box:
veewee vbox halt 'systemvmtemplate'
Now VirtualBox can be used to export appliance.

View File

@ -1,3 +1,4 @@
#!/bin/bash -xl
# 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
@ -16,12 +17,53 @@
# under the License.
set -x
set -e
appliance="systemvmtemplate"
build_date=`date +%Y-%m-%d`
branch="master"
rootdir=$PWD
# Initialize veewee and dependencies
bundle
# Start building the appliance
# Clean and start building the appliance
veewee vbox destroy $appliance
veewee vbox build $appliance --nogui
veewee vbox halt $appliance
while [[ `vboxmanage list runningvms | grep $appliance | wc -l` -ne 0 ]];
do
echo "Waiting for $appliance to shutdown"
sleep 2;
done
# Get appliance uuids
machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'`
hdd_uuid=`vboxmanage showvminfo $appliance | grep vmdk | head -1 | awk '{print $8}' | cut -d ')' -f 1`
# Start exporting
rm -fr dist
mkdir dist
# Export for VMWare vSphere
vboxmanage export $machine_uuid --output dist/$appliance-$build_date-$branch-vmware.ova
echo "$appliance exported for VMWare: dist/$appliance-$build_date-$branch-vmware.ova"
# Export for HyperV
vboxmanage clonehd $hdd_uuid dist/$appliance-$build_date-$branch-hyperv.vhd --format VHD
bzip2 dist/$appliance-$build_date-$branch-hyperv.vhd
echo "$appliance exported for HyperV: dist/$appliance-$build_date-$branch-hyperv.vhd.bz2"
# Export for KVM
vboxmanage clonehd $hdd_uuid dist/raw.img --format RAW
qemu-img convert -f raw -O qcow2 dist/raw.img dist/$appliance-$build_date-$branch-kvm.qcow2
bzip2 dist/$appliance-$build_date-$branch-kvm.qcow2
echo "$appliance exported for KVM: dist/$appliance-$build_date-$branch-kvm.qcow2.bz2"
# Export for Xen
# This will be an overwrite convert so, do it at the end
vhd-util convert -s 0 -t 1 -i dist/raw.img -o dist/$appliance-$build_date-$branch-xen.vhd
bzip2 dist/$appliance-$build_date-$branch-xen.vhd
echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2"

View File

@ -99,29 +99,28 @@ d-i clock-setup/ntp boolean true
d-i partman-auto/disk string /dev/sda
# In addition, you'll need to specify the method to use.
# The presently available methods are: "regular", "lvm" and "crypto"
d-i partman-auto/method string lvm
d-i partman-auto/method string regular
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
#d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
#d-i partman-lvm/confirm boolean true
#d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman-auto-lvm/guided_size string max
#d-i partman/choose_partition select finish
#d-i partman-auto-lvm/guided_size string max
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select multi
d-i partman/default_filesystem string ext3
d-i partman-auto/choose_recipe select atomic
#d-i partman/default_filesystem string ext3
# Or provide a recipe of your own...
# The recipe format is documented in the file devel/partman-auto-recipe.txt.
@ -129,6 +128,48 @@ d-i partman/default_filesystem string ext3
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
d-i partman-auto/expert_recipe string \
boot-root :: \
40 50 100 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
400 40 500 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
60 100 200 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
. \
500 30 1000 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } \
. \
400 40 500 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /opt } \
. \
500 60 1000 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } \
. \
100 70 400 ext4 \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } \
. \
64 512 300% linux-swap \
method{ swap } format{ } \
.
# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
@ -154,11 +195,12 @@ d-i partman/default_filesystem string ext3
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
#d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
### Base system installation
# Select the initramfs generator used to generate the initrd for 2.6 kernels.
#d-i base-installer/kernel/linux/initramfs-generators string yaird