mirror of https://github.com/apache/cloudstack.git
change storage allocator policy based on hypervisor
This commit is contained in:
parent
3aef9f408e
commit
edb16aa117
|
|
@ -67,4 +67,5 @@ public interface ServiceOffering {
|
|||
*/
|
||||
boolean getUseLocalStorage();
|
||||
|
||||
public String gethypervisorType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,16 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
|
|||
|
||||
sshConnection.connect(null, 60000, 60000);
|
||||
if (!sshConnection.authenticateWithPassword(username, password)) {
|
||||
throw new Exception("Unable to authenticate");
|
||||
s_logger.debug("Failed to authenticate");
|
||||
return null;
|
||||
}
|
||||
|
||||
/*Is a KVM host?*/
|
||||
sshSession = sshConnection.openSession();
|
||||
sshSession.execCommand("lsmod|grep kvm >& /dev/null");
|
||||
if (sshSession.getExitStatus() != 0) {
|
||||
s_logger.debug("It's not a KVM enabled machine");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!sshExecuteCmd(sshConnection, "lsmod|grep kvm >& /dev/null", 3)) {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
if (conn == null) {
|
||||
String msg = "Unable to get a connection to " + url;
|
||||
s_logger.debug(msg);
|
||||
throw new RuntimeException(msg);
|
||||
return null;
|
||||
}
|
||||
|
||||
String pod;
|
||||
|
|
|
|||
|
|
@ -124,4 +124,7 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe
|
|||
public NetworkOffering.GuestIpType getGuestIpType() {
|
||||
return guestIpType;
|
||||
}
|
||||
public String gethypervisorType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,25 +137,17 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||
}
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.KVM);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.KVM);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.KVM);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.KVM);
|
||||
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "KVM, Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.KVM);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "KVM, Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.KVM);
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.XenServer);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.XenServer);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.XenServer);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.XenServer);
|
||||
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Xenserver, Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.XenServer);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Xenserver, Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.XenServer);
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "VMware, Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "VMware, Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
|
||||
// Save default disk offerings
|
||||
_configMgr.createDiskOffering(User.UID_SYSTEM, DomainVO.ROOT_DOMAIN, "Small", "Small Disk, 5 GB", 5, null);
|
||||
_configMgr.createDiskOffering(User.UID_SYSTEM, DomainVO.ROOT_DOMAIN, "Medium", "Medium Disk, 20 GB", 20, null);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import com.cloud.configuration.dao.ConfigurationDao;
|
|||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.server.StatsCollector;
|
||||
|
|
@ -74,6 +76,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||
@Inject VolumeDao _volumeDao;
|
||||
@Inject StoragePoolHostDao _poolHostDao;
|
||||
@Inject ConfigurationDao _configDao;
|
||||
@Inject ClusterDao _clusterDao;
|
||||
int _storageOverprovisioningFactor;
|
||||
long _extraBytesPerVolume = 0;
|
||||
Random _rand;
|
||||
|
|
@ -142,6 +145,12 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||
return false;
|
||||
}
|
||||
|
||||
/*hypervisor type is correct*/
|
||||
Long clusterId = pool.getClusterId();
|
||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||
if (!cluster.getHypervisorType().equalsIgnoreCase(offering.gethypervisorType())) {
|
||||
return false;
|
||||
}
|
||||
// check the used size against the total size, skip this host if it's greater than the configured
|
||||
// capacity check "storage.capacity.threshold"
|
||||
if (sc != null) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.2/systemvm.vhd.bz2', 'bcc7f290f4c27ab4d0fe95d1012829ea', 0, 'SystemVM Template', 'VHD', 15, 0, 1);
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 12, 1, 1);
|
||||
VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI(Xenserver)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 12, 1, 1);
|
||||
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (3, 'routing', 'DomR Template(KVM)', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/a88232bf-6a18-38e7-aeee-c1702725079f.qcow2.bz2', 'e39c55e93ae96bd43bfd588ca6ee3269', 'DomR Template', 0, 'QCOW2', 21, 0, 1);
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones)
|
||||
VALUES (4, 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI(KVM)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 9, 1, 1);
|
||||
|
||||
|
||||
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS');
|
||||
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian');
|
||||
|
|
|
|||
Loading…
Reference in New Issue