mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
final merge of master->2.1.refactor preparing for merge back into master
This commit is contained in:
commit
2740ba6c40
@ -0,0 +1,115 @@
|
|||||||
|
package com.cloud.agent.resource.computing;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
public class KVMGuestOsMapper {
|
||||||
|
private static final Logger s_logger = Logger.getLogger(KVMGuestOsMapper.class);
|
||||||
|
private static Map<String, String> s_mapper = new HashMap<String, String>();
|
||||||
|
static {
|
||||||
|
s_mapper.put("CentOS 4.5 (32-bit)", "CentOS 4.5");
|
||||||
|
s_mapper.put("CentOS 4.6 (32-bit)", "CentOS 4.6");
|
||||||
|
s_mapper.put("CentOS 4.7 (32-bit)", "CentOS 4.7");
|
||||||
|
s_mapper.put("CentOS 4.8 (32-bit)", "CentOS 4.8");
|
||||||
|
s_mapper.put("CentOS 5.0 (32-bit)", "CentOS 5.0");
|
||||||
|
s_mapper.put("CentOS 5.0 (64-bit)", "CentOS 5.0");
|
||||||
|
s_mapper.put("CentOS 5.1 (32-bit)", "CentOS 5.1");
|
||||||
|
s_mapper.put("CentOS 5.1 (64-bit)", "CentOS 5.1");
|
||||||
|
s_mapper.put("CentOS 5.2 (32-bit)", "CentOS 5.2");
|
||||||
|
s_mapper.put("CentOS 5.2 (64-bit)", "CentOS 5.2");
|
||||||
|
s_mapper.put("CentOS 5.3 (32-bit)", "CentOS 5.3");
|
||||||
|
s_mapper.put("CentOS 5.3 (64-bit)", "CentOS 5.3");
|
||||||
|
s_mapper.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
|
||||||
|
s_mapper.put("CentOS 5.4 (64-bit)", "CentOS 5.4");
|
||||||
|
s_mapper.put("CentOS 5.5 (32-bit)", "CentOS 5.5");
|
||||||
|
s_mapper.put("CentOS 5.5 (64-bit)", "CentOS 5.5");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 2", "Red Hat Enterprise Linux 2");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 3 (32-bit)", "Red Hat Enterprise Linux 3");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 3 (64-bit)", "Red Hat Enterprise Linux 3");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 4(64-bit)", "Red Hat Enterprise Linux 4");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5.5");
|
||||||
|
s_mapper.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5.5");
|
||||||
|
s_mapper.put("Fedora 13", "Fedora 13");
|
||||||
|
s_mapper.put("Fedora 12", "Fedora 12");
|
||||||
|
s_mapper.put("Fedora 11", "Fedora 11");
|
||||||
|
s_mapper.put("Fedora 10", "Fedora 10");
|
||||||
|
s_mapper.put("Fedora 9", "Fedora 9");
|
||||||
|
s_mapper.put("Fedora 8", "Fedora 8");
|
||||||
|
s_mapper.put("Ubuntu 10.04 (32-bit)", "Ubuntu 10.04");
|
||||||
|
s_mapper.put("Ubuntu 10.04 (64-bit)", "Ubuntu 10.04");
|
||||||
|
s_mapper.put("Ubuntu 9.10 (32-bit)", "Ubuntu 9.10");
|
||||||
|
s_mapper.put("Ubuntu 9.10 (64-bit)", "Ubuntu 9.10");
|
||||||
|
s_mapper.put("Ubuntu 9.04 (32-bit)", "Ubuntu 9.04");
|
||||||
|
s_mapper.put("Ubuntu 9.04 (64-bit)", "Ubuntu 9.04");
|
||||||
|
s_mapper.put("Ubuntu 8.10 (32-bit)", "Ubuntu 8.10");
|
||||||
|
s_mapper.put("Ubuntu 8.10 (64-bit)", "Ubuntu 8.10");
|
||||||
|
s_mapper.put("Ubuntu 8.04 (32-bit)", "Ubuntu 8.04");
|
||||||
|
s_mapper.put("Ubuntu 8.04 (64-bit)", "Ubuntu 8.04");
|
||||||
|
s_mapper.put("Debian GNU/Linux 5.0 (32-bit)", "Debian GNU/Linux 5");
|
||||||
|
s_mapper.put("Debian GNU/Linux 5.0 (64-bit)", "Debian GNU/Linux 5");
|
||||||
|
s_mapper.put("Debian GNU/Linux 4.0 (32-bit)", "Debian GNU/Linux 4");
|
||||||
|
s_mapper.put("Debian GNU/Linux 4.0 (64-bit)", "Debian GNU/Linux 4");
|
||||||
|
s_mapper.put("Other 2.6x Linux (32-bit)", "Other 2.6x Linux");
|
||||||
|
s_mapper.put("Other 2.6x Linux (64-bit)", "Other 2.6x Linux");
|
||||||
|
s_mapper.put("Other Linux (32-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Other Linux (64-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Other Ubuntu (32-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Other Ubuntu (64-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Asianux 3(32-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Asianux 3(64-bit)", "Other Linux");
|
||||||
|
s_mapper.put("Windows 7 (32-bit)", "Windows 7");
|
||||||
|
s_mapper.put("Windows 7 (64-bit)", "Windows 7");
|
||||||
|
s_mapper.put("Windows Server 2003 Enterprise Edition(32-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 Enterprise Edition(64-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 DataCenter Edition(32-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 DataCenter Edition(64-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 Standard Edition(32-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 Standard Edition(64-bit)", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2003 Web Edition", "Windows Server 2003");
|
||||||
|
s_mapper.put("Microsoft Small Bussiness Server 2003", "Windows Server 2003");
|
||||||
|
s_mapper.put("Windows Server 2008 (32-bit)", "Windows Server 2008");
|
||||||
|
s_mapper.put("Windows Server 2008 (64-bit)", "Windows Server 2008");
|
||||||
|
s_mapper.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008");
|
||||||
|
s_mapper.put("Windows 2000 Server SP4 (32-bit)", "Windows 2000");
|
||||||
|
s_mapper.put("Windows 2000 Server", "Windows 2000");
|
||||||
|
s_mapper.put("Windows 2000 Advanced Server", "Windows 2000");
|
||||||
|
s_mapper.put("Windows 2000 Professional", "Windows 2000");
|
||||||
|
s_mapper.put("Windows Vista (32-bit)", "Windows Vista");
|
||||||
|
s_mapper.put("Windows Vista (64-bit)", "Windows Vista");
|
||||||
|
s_mapper.put("Windows XP SP2 (32-bit)", "Windows XP");
|
||||||
|
s_mapper.put("Windows XP SP3 (32-bit)", "Windows XP");
|
||||||
|
s_mapper.put("Windows XP (32-bit)", "Windows XP");
|
||||||
|
s_mapper.put("Windows XP (64-bit)", "Windows XP");
|
||||||
|
s_mapper.put("Windows 98", "Windows 98");
|
||||||
|
s_mapper.put("Windows 95", "Windows 95");
|
||||||
|
s_mapper.put("Windows NT 4", "Windows NT");
|
||||||
|
s_mapper.put("Windows 3.1", "Windows 3.1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGuestOsName(String guestOsName) {
|
||||||
|
String guestOS = s_mapper.get(guestOsName);
|
||||||
|
if (guestOS == null) {
|
||||||
|
s_logger.debug("Can't find the mapping of guest os: " + guestOsName);
|
||||||
|
return "Other";
|
||||||
|
} else {
|
||||||
|
return guestOS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -121,6 +121,8 @@ import com.cloud.agent.api.StartConsoleProxyAnswer;
|
|||||||
import com.cloud.agent.api.StartConsoleProxyCommand;
|
import com.cloud.agent.api.StartConsoleProxyCommand;
|
||||||
import com.cloud.agent.api.StartRouterAnswer;
|
import com.cloud.agent.api.StartRouterAnswer;
|
||||||
import com.cloud.agent.api.StartRouterCommand;
|
import com.cloud.agent.api.StartRouterCommand;
|
||||||
|
import com.cloud.agent.api.StartSecStorageVmAnswer;
|
||||||
|
import com.cloud.agent.api.StartSecStorageVmCommand;
|
||||||
import com.cloud.agent.api.StartupCommand;
|
import com.cloud.agent.api.StartupCommand;
|
||||||
import com.cloud.agent.api.StartupRoutingCommand;
|
import com.cloud.agent.api.StartupRoutingCommand;
|
||||||
import com.cloud.agent.api.StopAnswer;
|
import com.cloud.agent.api.StopAnswer;
|
||||||
@ -137,7 +139,7 @@ import com.cloud.agent.api.storage.CreatePrivateTemplateCommand;
|
|||||||
import com.cloud.agent.api.storage.DestroyCommand;
|
import com.cloud.agent.api.storage.DestroyCommand;
|
||||||
import com.cloud.agent.api.storage.DownloadAnswer;
|
import com.cloud.agent.api.storage.DownloadAnswer;
|
||||||
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
||||||
import com.cloud.agent.api.to.StoragePoolTO;
|
import com.cloud.agent.api.to.StorageFilerTO;
|
||||||
import com.cloud.agent.api.to.VolumeTO;
|
import com.cloud.agent.api.to.VolumeTO;
|
||||||
import com.cloud.agent.resource.computing.LibvirtStoragePoolDef.poolType;
|
import com.cloud.agent.resource.computing.LibvirtStoragePoolDef.poolType;
|
||||||
import com.cloud.agent.resource.computing.LibvirtStorageVolumeDef.volFormat;
|
import com.cloud.agent.resource.computing.LibvirtStorageVolumeDef.volFormat;
|
||||||
@ -156,12 +158,11 @@ import com.cloud.agent.resource.computing.LibvirtVMDef.interfaceDef.hostNicType;
|
|||||||
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
|
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
|
||||||
import com.cloud.exception.InternalErrorException;
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.host.Host.Type;
|
import com.cloud.host.Host.Type;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy;
|
import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.resource.ServerResourceBase;
|
import com.cloud.resource.ServerResourceBase;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.StorageResourceType;
|
|
||||||
import com.cloud.storage.StorageLayer;
|
import com.cloud.storage.StorageLayer;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
@ -185,6 +186,7 @@ import com.cloud.utils.script.Script;
|
|||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.DiskProfile;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.DomainRouter;
|
import com.cloud.vm.DomainRouter;
|
||||||
|
import com.cloud.vm.SecondaryStorageVmVO;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
|
|
||||||
@ -416,6 +418,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
protected String _hypervisorType;
|
protected String _hypervisorType;
|
||||||
protected String _hypervisorURI;
|
protected String _hypervisorURI;
|
||||||
protected String _hypervisorPath;
|
protected String _hypervisorPath;
|
||||||
|
protected String _sysvmISOPath;
|
||||||
protected String _privNwName;
|
protected String _privNwName;
|
||||||
protected String _privBridgeName;
|
protected String _privBridgeName;
|
||||||
protected String _linkLocalBridgeName;
|
protected String _linkLocalBridgeName;
|
||||||
@ -425,6 +428,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
protected String _domrKernel;
|
protected String _domrKernel;
|
||||||
protected String _domrRamdisk;
|
protected String _domrRamdisk;
|
||||||
protected String _pool;
|
protected String _pool;
|
||||||
|
protected String _localGateway;
|
||||||
private boolean _can_bridge_firewall;
|
private boolean _can_bridge_firewall;
|
||||||
private Pair<String, String> _pifs;
|
private Pair<String, String> _pifs;
|
||||||
private final Map<String, vmStats> _vmStats = new ConcurrentHashMap<String, vmStats>();
|
private final Map<String, vmStats> _vmStats = new ConcurrentHashMap<String, vmStats>();
|
||||||
@ -684,18 +688,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
_domrArch = "i686";
|
_domrArch = "i686";
|
||||||
} else if (!"i686".equalsIgnoreCase(_domrArch) && !"x86_64".equalsIgnoreCase(_domrArch)) {
|
} else if (!"i686".equalsIgnoreCase(_domrArch) && !"x86_64".equalsIgnoreCase(_domrArch)) {
|
||||||
throw new ConfigurationException("Invalid architecture (domr.arch) -- needs to be i686 or x86_64");
|
throw new ConfigurationException("Invalid architecture (domr.arch) -- needs to be i686 or x86_64");
|
||||||
}
|
}
|
||||||
|
|
||||||
_domrKernel = (String)params.get("domr.kernel");
|
|
||||||
if (_domrKernel == null ) {
|
|
||||||
_domrKernel = new File("/var/lib/libvirt/images/vmops-domr-kernel").getAbsolutePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
_domrRamdisk = (String)params.get("domr.ramdisk");
|
|
||||||
if (_domrRamdisk == null ) {
|
|
||||||
_domrRamdisk = new File("/var/lib/libvirt/images/vmops-domr-initramfs").getAbsolutePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
value = (String)params.get("host.reserved.mem.mb");
|
value = (String)params.get("host.reserved.mem.mb");
|
||||||
_dom0MinMem = NumbersUtil.parseInt(value, 0)*1024*1024;
|
_dom0MinMem = NumbersUtil.parseInt(value, 0)*1024*1024;
|
||||||
@ -732,6 +725,20 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ConfigurationException("Unable to find class " + "com.cloud.storage.JavaStorageLayer");
|
throw new ConfigurationException("Unable to find class " + "com.cloud.storage.JavaStorageLayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sysvmISOPath = (String)params.get("systemvm.iso.path");
|
||||||
|
if (_sysvmISOPath == null) {
|
||||||
|
String[] isoPaths = {"/usr/lib64/cloud/agent/vms/systemvm.iso", "/usr/lib/cloud/agent/vms/systemvm.iso"};
|
||||||
|
for (String isoPath : isoPaths) {
|
||||||
|
if (_storage.exists(isoPath)) {
|
||||||
|
_sysvmISOPath = isoPath;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_sysvmISOPath == null) {
|
||||||
|
throw new ConfigurationException("Can't find system vm ISO");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//_can_bridge_firewall = can_bridge_firewall();
|
//_can_bridge_firewall = can_bridge_firewall();
|
||||||
|
|
||||||
@ -780,6 +787,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
throw new ConfigurationException("Failed to get public nic name");
|
throw new ConfigurationException("Failed to get public nic name");
|
||||||
}
|
}
|
||||||
s_logger.debug("Found pif: " + _pifs.first() + " on " + _privBridgeName + ", pif: " + _pifs.second() + " on " + _publicBridgeName);
|
s_logger.debug("Found pif: " + _pifs.first() + " on " + _privBridgeName + ", pif: " + _pifs.second() + " on " + _publicBridgeName);
|
||||||
|
|
||||||
|
_localGateway = Script.runSimpleBashScript("ip route |grep default|awk '{print $3}'");
|
||||||
|
if (_localGateway == null) {
|
||||||
|
s_logger.debug("Failed to found the local gateway");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +850,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
|
|
||||||
String dataDiskPath = null;
|
String dataDiskPath = null;
|
||||||
for (diskDef disk : disks) {
|
for (diskDef disk : disks) {
|
||||||
if (disk.getDiskLabel().equalsIgnoreCase("hdb")) {
|
if (disk.getDiskLabel().equalsIgnoreCase("vdb")) {
|
||||||
dataDiskPath = disk.getDiskPath();
|
dataDiskPath = disk.getDiskPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -846,7 +859,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
patchSystemVm(cmd.getBootArgs(), dataDiskPath, vmName);
|
patchSystemVm(cmd.getBootArgs(), dataDiskPath, vmName);
|
||||||
|
|
||||||
String uuid = UUID.nameUUIDFromBytes(vmName.getBytes()).toString();
|
String uuid = UUID.nameUUIDFromBytes(vmName.getBytes()).toString();
|
||||||
String domXML = defineVMXML(cmd.getVmName(), uuid, router.getRamSize(), 1, _domrArch, nics, disks, router.getVncPassword(), "Fedora 12");
|
String domXML = defineVMXML(cmd.getVmName(), uuid, router.getRamSize(), 1, _domrArch, nics, disks, router.getVncPassword(), cmd.getGuestOSDescription());
|
||||||
|
|
||||||
s_logger.debug(domXML);
|
s_logger.debug(domXML);
|
||||||
|
|
||||||
@ -880,19 +893,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
ConsoleProxyVO console = cmd.getProxy();
|
ConsoleProxyVO console = cmd.getProxy();
|
||||||
List<interfaceDef> nics = null;
|
List<interfaceDef> nics = null;
|
||||||
try {
|
try {
|
||||||
nics = createConsoleVMNetworks(cmd);
|
nics = createSysVMNetworks(console.getGuestMacAddress(), console.getPrivateMacAddress(), console.getPublicMacAddress(), console.getVlanId());
|
||||||
|
|
||||||
List<diskDef> disks = createSystemVMDisk(cmd.getVolumes());
|
List<diskDef> disks = createSystemVMDisk(cmd.getVolumes());
|
||||||
|
|
||||||
String dataDiskPath = null;
|
String dataDiskPath = null;
|
||||||
for (diskDef disk : disks) {
|
for (diskDef disk : disks) {
|
||||||
if (disk.getDiskLabel().equalsIgnoreCase("hdb")) {
|
if (disk.getDiskLabel().equalsIgnoreCase("vdb")) {
|
||||||
dataDiskPath = disk.getDiskPath();
|
dataDiskPath = disk.getDiskPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String bootArgs = cmd.getBootArgs() + " zone=" + _dcId;
|
||||||
|
bootArgs += " pod=" + _pod;
|
||||||
|
bootArgs += " guid=Proxy." + console.getId();
|
||||||
|
bootArgs += " proxy_vm=" + console.getId();
|
||||||
|
bootArgs += " localgw=" + _localGateway;
|
||||||
String vmName = cmd.getVmName();
|
String vmName = cmd.getVmName();
|
||||||
patchSystemVm(cmd.getBootArgs(), dataDiskPath, vmName);
|
patchSystemVm(bootArgs, dataDiskPath, vmName);
|
||||||
|
|
||||||
String uuid = UUID.nameUUIDFromBytes(vmName.getBytes()).toString();
|
String uuid = UUID.nameUUIDFromBytes(vmName.getBytes()).toString();
|
||||||
String domXML = defineVMXML(cmd.getVmName(), uuid, console.getRamSize(), 1, _domrArch, nics, disks, console.getVncPassword(), "Fedora 12");
|
String domXML = defineVMXML(cmd.getVmName(), uuid, console.getRamSize(), 1, _domrArch, nics, disks, console.getVncPassword(), "Fedora 12");
|
||||||
@ -910,12 +928,50 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String startSecStorageVM(StartSecStorageVmCommand cmd) {
|
||||||
|
SecondaryStorageVmVO secVm = cmd.getSecondaryStorageVmVO();
|
||||||
|
List<interfaceDef> nics = null;
|
||||||
|
try {
|
||||||
|
nics = createSysVMNetworks(secVm.getGuestMacAddress(), secVm.getPrivateMacAddress(), secVm.getPublicMacAddress(), secVm.getVlanId());
|
||||||
|
|
||||||
|
List<diskDef> disks = createSystemVMDisk(cmd.getVolumes());
|
||||||
|
|
||||||
|
String dataDiskPath = null;
|
||||||
|
for (diskDef disk : disks) {
|
||||||
|
if (disk.getDiskLabel().equalsIgnoreCase("vdb")) {
|
||||||
|
dataDiskPath = disk.getDiskPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String vmName = cmd.getVmName();
|
||||||
|
String bootArgs = cmd.getBootArgs();
|
||||||
|
bootArgs += " zone=" + _dcId;
|
||||||
|
bootArgs += " pod=" + _pod;
|
||||||
|
bootArgs += " localgw=" + _localGateway;
|
||||||
|
patchSystemVm(bootArgs, dataDiskPath, vmName);
|
||||||
|
|
||||||
|
String uuid = UUID.nameUUIDFromBytes(vmName.getBytes()).toString();
|
||||||
|
String domXML = defineVMXML(cmd.getVmName(), uuid, secVm.getRamSize(), 1, _domrArch, nics, disks, secVm.getVncPassword(), cmd.getGuestOSDescription());
|
||||||
|
|
||||||
|
s_logger.debug(domXML);
|
||||||
|
|
||||||
|
startDomain(vmName, domXML);
|
||||||
|
} catch (LibvirtException e) {
|
||||||
|
s_logger.debug("Failed to start domr: " + e.toString());
|
||||||
|
return e.toString();
|
||||||
|
}catch (InternalErrorException e) {
|
||||||
|
s_logger.debug("Failed to start domr: " + e.toString());
|
||||||
|
return e.toString();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private String defineVMXML(String vmName, String uuid, int memSize, int cpus, String arch, List<interfaceDef> nics, List<diskDef> disks, String vncPaswd, String guestOSType) {
|
private String defineVMXML(String vmName, String uuid, int memSize, int cpus, String arch, List<interfaceDef> nics, List<diskDef> disks, String vncPaswd, String guestOSType) {
|
||||||
LibvirtVMDef vm = new LibvirtVMDef();
|
LibvirtVMDef vm = new LibvirtVMDef();
|
||||||
vm.setHvsType(_hypervisorType);
|
vm.setHvsType(_hypervisorType);
|
||||||
vm.setDomainName(vmName);
|
vm.setDomainName(vmName);
|
||||||
vm.setDomUUID(uuid);
|
vm.setDomUUID(uuid);
|
||||||
vm.setDomDescription(guestOSType);
|
vm.setDomDescription(KVMGuestOsMapper.getGuestOsName(guestOSType));
|
||||||
|
|
||||||
guestDef guest = new guestDef();
|
guestDef guest = new guestDef();
|
||||||
guest.setGuestType(guestDef.guestType.KVM);
|
guest.setGuestType(guestDef.guestType.KVM);
|
||||||
@ -1101,6 +1157,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
return execute((StartRouterCommand)cmd);
|
return execute((StartRouterCommand)cmd);
|
||||||
} else if(cmd instanceof StartConsoleProxyCommand) {
|
} else if(cmd instanceof StartConsoleProxyCommand) {
|
||||||
return execute((StartConsoleProxyCommand)cmd);
|
return execute((StartConsoleProxyCommand)cmd);
|
||||||
|
} else if(cmd instanceof StartSecStorageVmCommand) {
|
||||||
|
return execute((StartSecStorageVmCommand)cmd);
|
||||||
} else if (cmd instanceof AttachIsoCommand) {
|
} else if (cmd instanceof AttachIsoCommand) {
|
||||||
return execute((AttachIsoCommand) cmd);
|
return execute((AttachIsoCommand) cmd);
|
||||||
} else if (cmd instanceof AttachVolumeCommand) {
|
} else if (cmd instanceof AttachVolumeCommand) {
|
||||||
@ -1173,7 +1231,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Answer execute(CreateCommand cmd) {
|
protected Answer execute(CreateCommand cmd) {
|
||||||
StoragePoolTO pool = cmd.getPool();
|
StorageFilerTO pool = cmd.getPool();
|
||||||
DiskProfile dskch = cmd.getDiskCharacteristics();
|
DiskProfile dskch = cmd.getDiskCharacteristics();
|
||||||
StorageVol tmplVol = null;
|
StorageVol tmplVol = null;
|
||||||
StoragePool primaryPool = null;
|
StoragePool primaryPool = null;
|
||||||
@ -1636,6 +1694,23 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
if (secondaryPool == null) {
|
if (secondaryPool == null) {
|
||||||
return new Answer(cmd, false, " Failed to create storage pool");
|
return new Answer(cmd, false, " Failed to create storage pool");
|
||||||
}
|
}
|
||||||
|
if (tmpltname == null) {
|
||||||
|
/*Hack: server just pass the directory of system vm template, need to scan the folder */
|
||||||
|
secondaryPool.refresh(0);
|
||||||
|
String[] volumes = secondaryPool.listVolumes();
|
||||||
|
if (volumes == null) {
|
||||||
|
return new Answer(cmd, false, "Failed to get volumes from pool: " + secondaryPool.getName());
|
||||||
|
}
|
||||||
|
for (String volumeName : volumes) {
|
||||||
|
if (volumeName.endsWith("qcow2")) {
|
||||||
|
tmpltname = volumeName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tmpltname == null) {
|
||||||
|
return new Answer(cmd, false, "Failed to get template from pool: " + secondaryPool.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
tmplVol = getVolume(secondaryPool, getPathOfStoragePool(secondaryPool) + tmpltname);
|
tmplVol = getVolume(secondaryPool, getPathOfStoragePool(secondaryPool) + tmpltname);
|
||||||
if (tmplVol == null) {
|
if (tmplVol == null) {
|
||||||
return new Answer(cmd, false, " Can't find volume");
|
return new Answer(cmd, false, " Can't find volume");
|
||||||
@ -1838,18 +1913,52 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
_vms.put(cmd.getVmName(), State.Starting);
|
_vms.put(cmd.getVmName(), State.Starting);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
result = startConsoleProxy(cmd);
|
result = startConsoleProxy(cmd);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
throw new ExecutionException(result, null);
|
throw new ExecutionException(result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = _virtRouterResource.connect(router.getPrivateIpAddress(), cmd.getProxyCmdPort());
|
result = _virtRouterResource.connect(router.getGuestIpAddress(), cmd.getProxyCmdPort());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
throw new ExecutionException(result, null);
|
throw new ExecutionException(result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
state = State.Running;
|
state = State.Running;
|
||||||
return new StartConsoleProxyAnswer(cmd, router.getPrivateIpAddress(), router.getPrivateMacAddress());
|
return new StartConsoleProxyAnswer(cmd);
|
||||||
|
} catch (final ExecutionException e) {
|
||||||
|
return new Answer(cmd, false, e.getMessage());
|
||||||
|
} catch (final Throwable th) {
|
||||||
|
s_logger.warn("Exception while starting router.", th);
|
||||||
|
return createErrorAnswer(cmd, "Unable to start router", th);
|
||||||
|
} finally {
|
||||||
|
synchronized(_vms) {
|
||||||
|
_vms.put(cmd.getVmName(), state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Answer execute(StartSecStorageVmCommand cmd) {
|
||||||
|
final SecondaryStorageVmVO secVm = cmd.getSecondaryStorageVmVO();
|
||||||
|
String result = null;
|
||||||
|
|
||||||
|
State state = State.Stopped;
|
||||||
|
synchronized(_vms) {
|
||||||
|
_vms.put(cmd.getVmName(), State.Starting);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
result = startSecStorageVM(cmd);
|
||||||
|
if (result != null) {
|
||||||
|
throw new ExecutionException(result, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = _virtRouterResource.connect(secVm.getGuestIpAddress(), cmd.getProxyCmdPort());
|
||||||
|
if (result != null) {
|
||||||
|
throw new ExecutionException(result, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
state = State.Running;
|
||||||
|
return new StartSecStorageVmAnswer(cmd);
|
||||||
} catch (final ExecutionException e) {
|
} catch (final ExecutionException e) {
|
||||||
return new Answer(cmd, false, e.getMessage());
|
return new Answer(cmd, false, e.getMessage());
|
||||||
} catch (final Throwable th) {
|
} catch (final Throwable th) {
|
||||||
@ -2557,7 +2666,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
|
|
||||||
final List<Object> info = getHostInfo();
|
final List<Object> info = getHostInfo();
|
||||||
|
|
||||||
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer)info.get(0), (Long)info.get(1), (Long)info.get(2), (Long)info.get(4), (String)info.get(3), Hypervisor.Type.KVM, RouterPrivateIpStrategy.HostLocal, changes);
|
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer)info.get(0), (Long)info.get(1), (Long)info.get(2), (Long)info.get(4), (String)info.get(3), HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes);
|
||||||
fillNetworkInformation(cmd);
|
fillNetworkInformation(cmd);
|
||||||
cmd.getHostDetails().putAll(getVersionStrings());
|
cmd.getHostDetails().putAll(getVersionStrings());
|
||||||
cmd.setPool(_pool);
|
cmd.setPool(_pool);
|
||||||
@ -3093,24 +3202,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
private boolean isGuestPVEnabled(String guestOS) {
|
private boolean isGuestPVEnabled(String guestOS) {
|
||||||
if (guestOS == null)
|
if (guestOS == null)
|
||||||
return false;
|
return false;
|
||||||
if (guestOS.startsWith("Ubuntu 10.04") ||
|
String guestOSName = KVMGuestOsMapper.getGuestOsName(guestOS);
|
||||||
guestOS.startsWith("Ubuntu 9") ||
|
if (guestOSName.startsWith("Ubuntu 10.04") ||
|
||||||
guestOS.startsWith("Ubuntu 8.10") ||
|
guestOSName.startsWith("Ubuntu 9") ||
|
||||||
guestOS.startsWith("Fedora 13") ||
|
guestOSName.startsWith("Ubuntu 8.10") ||
|
||||||
guestOS.startsWith("Fedora 12") ||
|
guestOSName.startsWith("Fedora 13") ||
|
||||||
guestOS.startsWith("Fedora 11") ||
|
guestOSName.startsWith("Fedora 12") ||
|
||||||
guestOS.startsWith("Fedora 10") ||
|
guestOSName.startsWith("Fedora 11") ||
|
||||||
guestOS.startsWith("Fedora 9") ||
|
guestOSName.startsWith("Fedora 10") ||
|
||||||
guestOS.startsWith("CentOS 5.3") ||
|
guestOSName.startsWith("Fedora 9") ||
|
||||||
guestOS.startsWith("CentOS 5.4") ||
|
guestOSName.startsWith("CentOS 5.3") ||
|
||||||
guestOS.startsWith("CentOS 5.5") ||
|
guestOSName.startsWith("CentOS 5.4") ||
|
||||||
guestOS.startsWith("Red Hat Enterprise Linux 5.3") ||
|
guestOSName.startsWith("CentOS 5.5") ||
|
||||||
guestOS.startsWith("Red Hat Enterprise Linux 5.4") ||
|
guestOSName.startsWith("Red Hat Enterprise Linux 5.3") ||
|
||||||
guestOS.startsWith("Red Hat Enterprise Linux 5.5") ||
|
guestOSName.startsWith("Red Hat Enterprise Linux 5.4") ||
|
||||||
guestOS.startsWith("Red Hat Enterprise Linux 6") ||
|
guestOSName.startsWith("Red Hat Enterprise Linux 5.5") ||
|
||||||
guestOS.startsWith("Debain Lenney") ||
|
guestOSName.startsWith("Red Hat Enterprise Linux 6") ||
|
||||||
guestOS.startsWith("Debain Squeeze")
|
guestOSName.startsWith("Debian GNU/Linux")
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -3231,25 +3340,34 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
return nics;
|
return nics;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<interfaceDef> createConsoleVMNetworks(StartConsoleProxyCommand cmd) {
|
private List<interfaceDef> createSysVMNetworks(String guestMac, String privMac, String pubMac, String vlanId) throws InternalErrorException {
|
||||||
List<interfaceDef> nics = new ArrayList<interfaceDef>();
|
List<interfaceDef> nics = new ArrayList<interfaceDef>();
|
||||||
ConsoleProxyVO console = cmd.getProxy();
|
String brName;
|
||||||
String privateMac = console.getPrivateMacAddress();
|
|
||||||
String pubMac = console.getPublicMacAddress();
|
|
||||||
interfaceDef pubNic = new interfaceDef();
|
interfaceDef pubNic = new interfaceDef();
|
||||||
interfaceDef privNic = new interfaceDef();
|
interfaceDef privNic = new interfaceDef();
|
||||||
interfaceDef vnetNic = new interfaceDef();
|
interfaceDef vnetNic = new interfaceDef();
|
||||||
|
|
||||||
/*guest network is vnet: 0 is not used, 1 is link local, 2 is pub nic*/
|
/*nic 0: link local*/
|
||||||
vnetNic.defPrivateNet("default", null, null, interfaceDef.nicModel.VIRTIO);
|
privNic.defPrivateNet(_privNwName, null, guestMac, interfaceDef.nicModel.VIRTIO);
|
||||||
nics.add(vnetNic);
|
nics.add(privNic);
|
||||||
|
|
||||||
privNic.defPrivateNet(_privNwName, null, privateMac, interfaceDef.nicModel.VIRTIO);
|
/*nic 1, priv network*/
|
||||||
nics.add(privNic);
|
|
||||||
|
vnetNic.defBridgeNet(_privBridgeName, null, privMac, interfaceDef.nicModel.VIRTIO);
|
||||||
pubNic.defBridgeNet(_publicBridgeName, null, pubMac, interfaceDef.nicModel.VIRTIO);
|
nics.add(vnetNic);
|
||||||
nics.add(pubNic);
|
|
||||||
|
/*nic 2: public */
|
||||||
|
if ("untagged".equalsIgnoreCase(vlanId)) {
|
||||||
|
pubNic.defBridgeNet(_publicBridgeName, null, pubMac, interfaceDef.nicModel.VIRTIO);
|
||||||
|
} else {
|
||||||
|
String vnetId = getVnetId(vlanId);
|
||||||
|
brName = setVnetBrName(vnetId);
|
||||||
|
String vnetDev = "vtap" + vnetId;
|
||||||
|
createVnet(vnetId, _pifs.second());
|
||||||
|
pubNic.defBridgeNet(brName, null, pubMac, interfaceDef.nicModel.VIRTIO);
|
||||||
|
}
|
||||||
|
nics.add(pubNic);
|
||||||
|
|
||||||
return nics;
|
return nics;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3277,13 +3395,18 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
String datadiskPath = tmplVol.getKey();
|
String datadiskPath = tmplVol.getKey();
|
||||||
|
|
||||||
diskDef hda = new diskDef();
|
diskDef hda = new diskDef();
|
||||||
hda.defFileBasedDisk(rootkPath, "hda", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
|
hda.defFileBasedDisk(rootkPath, "vda", diskDef.diskBus.VIRTIO, diskDef.diskFmtType.QCOW2);
|
||||||
disks.add(hda);
|
disks.add(hda);
|
||||||
|
|
||||||
diskDef hdb = new diskDef();
|
diskDef hdb = new diskDef();
|
||||||
hdb.defFileBasedDisk(datadiskPath, "hdb", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
hdb.defFileBasedDisk(datadiskPath, "vdb", diskDef.diskBus.VIRTIO, diskDef.diskFmtType.RAW);
|
||||||
disks.add(hdb);
|
disks.add(hdb);
|
||||||
|
|
||||||
|
diskDef hdc = new diskDef();
|
||||||
|
hdc.defFileBasedDisk(_sysvmISOPath, "hdc", diskDef.diskBus.IDE, diskDef.diskFmtType.RAW);
|
||||||
|
hdc.setDeviceType(diskDef.deviceType.CDROM);
|
||||||
|
disks.add(hdc);
|
||||||
|
|
||||||
return disks;
|
return disks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||||||
String _localgw;
|
String _localgw;
|
||||||
String _eth1ip;
|
String _eth1ip;
|
||||||
String _eth1mask;
|
String _eth1mask;
|
||||||
|
String _pubIp;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Answer executeRequest(final Command cmd) {
|
public Answer executeRequest(final Command cmd) {
|
||||||
@ -158,6 +159,8 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||||||
fillNetworkInformation(cmd);
|
fillNetworkInformation(cmd);
|
||||||
cmd.setProxyPort(_proxyPort);
|
cmd.setProxyPort(_proxyPort);
|
||||||
cmd.setProxyVmId(_proxyVmId);
|
cmd.setProxyVmId(_proxyVmId);
|
||||||
|
if(_pubIp != null)
|
||||||
|
cmd.setPublicIpAddress(_pubIp);
|
||||||
return new StartupCommand[] {cmd};
|
return new StartupCommand[] {cmd};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,6 +225,8 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pubIp = (String)params.get("public.ip");
|
||||||
|
|
||||||
if(s_logger.isInfoEnabled())
|
if(s_logger.isInfoEnabled())
|
||||||
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
|
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
|
||||||
|
|
||||||
@ -309,8 +314,8 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||||||
_consoleProxyMain.start();
|
_consoleProxyMain.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean authenticateConsoleAccess(String vmId, String sid) {
|
public boolean authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket) {
|
||||||
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(vmId, sid);
|
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AgentControlAnswer answer = getAgentControl().sendRequest(cmd, 10000);
|
AgentControlAnswer answer = getAgentControl().sendRequest(cmd, 10000);
|
||||||
|
|||||||
@ -18,19 +18,16 @@
|
|||||||
package com.cloud.agent.api.storage;
|
package com.cloud.agent.api.storage;
|
||||||
|
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
import com.cloud.agent.api.to.StoragePoolTO;
|
import com.cloud.agent.api.to.StorageFilerTO;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
import com.cloud.vm.DiskProfile;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
|
||||||
|
|
||||||
public class CreateCommand extends Command {
|
public class CreateCommand extends Command {
|
||||||
private long volId;
|
private long volId;
|
||||||
private StoragePoolTO pool;
|
private StorageFilerTO pool;
|
||||||
private DiskProfile diskCharacteristics;
|
private DiskProfile diskCharacteristics;
|
||||||
private String templateUrl;
|
private String templateUrl;
|
||||||
private long size;
|
private long size;
|
||||||
private String instanceName;
|
|
||||||
|
|
||||||
protected CreateCommand() {
|
protected CreateCommand() {
|
||||||
super();
|
super();
|
||||||
@ -45,8 +42,8 @@ public class CreateCommand extends Command {
|
|||||||
* @param templateUrl
|
* @param templateUrl
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskProfile diskCharacteristics, String templateUrl, StoragePoolVO pool) {
|
public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) {
|
||||||
this(vol, vm, diskCharacteristics, pool, 0);
|
this(diskCharacteristics, pool, 0);
|
||||||
this.templateUrl = templateUrl;
|
this.templateUrl = templateUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,13 +55,20 @@ public class CreateCommand extends Command {
|
|||||||
* @param diskCharacteristics
|
* @param diskCharacteristics
|
||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
public CreateCommand(VolumeVO vol, VMInstanceVO vm, DiskProfile diskCharacteristics, StoragePoolVO pool, long size) {
|
public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool, long size) {
|
||||||
this.volId = vol.getId();
|
this.volId = diskCharacteristics.getVolumeId();
|
||||||
this.diskCharacteristics = diskCharacteristics;
|
this.diskCharacteristics = diskCharacteristics;
|
||||||
this.pool = new StoragePoolTO(pool);
|
this.pool = pool;
|
||||||
this.templateUrl = null;
|
this.templateUrl = null;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
//this.instanceName = vm.getInstanceName();
|
}
|
||||||
|
|
||||||
|
public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) {
|
||||||
|
this(diskCharacteristics, templateUrl, new StorageFilerTO(pool));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool, long size) {
|
||||||
|
this(diskCharacteristics, new StorageFilerTO(pool), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,7 +80,7 @@ public class CreateCommand extends Command {
|
|||||||
return templateUrl;
|
return templateUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoragePoolTO getPool() {
|
public StorageFilerTO getPool() {
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +96,8 @@ public class CreateCommand extends Command {
|
|||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getInstanceName() {
|
public String getInstanceName() {
|
||||||
return instanceName;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.cloud.agent.api.to;
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
import com.cloud.network.Network.BroadcastDomainType;
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
import com.cloud.network.Network.TrafficType;
|
import com.cloud.network.Network.TrafficType;
|
||||||
|
|
||||||
@ -24,16 +26,18 @@ import com.cloud.network.Network.TrafficType;
|
|||||||
* Transfer object to transfer network settings.
|
* Transfer object to transfer network settings.
|
||||||
*/
|
*/
|
||||||
public class NetworkTO {
|
public class NetworkTO {
|
||||||
private String uuid;
|
protected String uuid;
|
||||||
private String ip;
|
protected String ip;
|
||||||
private String netmask;
|
protected String netmask;
|
||||||
private String gateway;
|
protected String gateway;
|
||||||
private String mac;
|
protected String mac;
|
||||||
private String dns1;
|
protected String dns1;
|
||||||
private String dns2;
|
protected String dns2;
|
||||||
private Long vlan;
|
protected Long vlan;
|
||||||
private BroadcastDomainType broadcastType;
|
protected BroadcastDomainType broadcastType;
|
||||||
private TrafficType type;
|
protected TrafficType type;
|
||||||
|
protected URI broadcastUri;
|
||||||
|
protected URI isolationUri;
|
||||||
|
|
||||||
public NetworkTO() {
|
public NetworkTO() {
|
||||||
}
|
}
|
||||||
@ -150,4 +154,20 @@ public class NetworkTO {
|
|||||||
public TrafficType getType() {
|
public TrafficType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public URI getBroadcastUri() {
|
||||||
|
return broadcastUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBroadcastUri(URI broadcastUri) {
|
||||||
|
this.broadcastUri = broadcastUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public URI getIsolationUri() {
|
||||||
|
return isolationUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsolationuri(URI isolationUri) {
|
||||||
|
this.isolationUri = isolationUri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
53
api/src/com/cloud/agent/api/to/NicTO.java
Normal file
53
api/src/com/cloud/agent/api/to/NicTO.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
|
public class NicTO extends NetworkTO {
|
||||||
|
int deviceId;
|
||||||
|
Integer networkRateMbps;
|
||||||
|
Integer networkRateMulticastMbps;
|
||||||
|
String bootParams;
|
||||||
|
boolean defaultNic;
|
||||||
|
|
||||||
|
public NicTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(int deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNetworkRateMbps() {
|
||||||
|
return networkRateMbps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNetworkRateMulticastMbps() {
|
||||||
|
return networkRateMulticastMbps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBootParams() {
|
||||||
|
return bootParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBootParams(String bootParams) {
|
||||||
|
this.bootParams = bootParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefaultNic() {
|
||||||
|
return defaultNic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultNic(boolean defaultNic) {
|
||||||
|
this.defaultNic = defaultNic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,11 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.cloud.agent.api.to;
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
import com.cloud.storage.StoragePoolVO;
|
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.StoragePool;
|
||||||
|
|
||||||
|
public class StorageFilerTO {
|
||||||
public class StoragePoolTO {
|
|
||||||
long id;
|
long id;
|
||||||
String uuid;
|
String uuid;
|
||||||
String host;
|
String host;
|
||||||
@ -29,7 +28,7 @@ public class StoragePoolTO {
|
|||||||
int port;
|
int port;
|
||||||
StoragePoolType type;
|
StoragePoolType type;
|
||||||
|
|
||||||
public StoragePoolTO(StoragePoolVO pool) {
|
public StorageFilerTO(StoragePool pool) {
|
||||||
this.id = pool.getId();
|
this.id = pool.getId();
|
||||||
this.host = pool.getHostAddress();
|
this.host = pool.getHostAddress();
|
||||||
this.port = pool.getPort();
|
this.port = pool.getPort();
|
||||||
@ -62,7 +61,7 @@ public class StoragePoolTO {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StoragePoolTO() {
|
protected StorageFilerTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,6 +21,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||||
import com.cloud.vm.VirtualMachine.Type;
|
import com.cloud.vm.VirtualMachine.Type;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
public class VirtualMachineTO {
|
public class VirtualMachineTO {
|
||||||
private long id;
|
private long id;
|
||||||
@ -28,8 +29,7 @@ public class VirtualMachineTO {
|
|||||||
private BootloaderType bootloader;
|
private BootloaderType bootloader;
|
||||||
Type type;
|
Type type;
|
||||||
int cpus;
|
int cpus;
|
||||||
Integer weight;
|
Integer speed;
|
||||||
Integer utilization;
|
|
||||||
long minRam;
|
long minRam;
|
||||||
long maxRam;
|
long maxRam;
|
||||||
String hostName;
|
String hostName;
|
||||||
@ -38,11 +38,24 @@ public class VirtualMachineTO {
|
|||||||
String bootArgs;
|
String bootArgs;
|
||||||
String[] bootupScripts;
|
String[] bootupScripts;
|
||||||
boolean rebootOnCrash;
|
boolean rebootOnCrash;
|
||||||
|
Monitor monitor;
|
||||||
|
|
||||||
VolumeTO[] disks;
|
VolumeTO[] disks;
|
||||||
NicTO[] nics;
|
NicTO[] nics;
|
||||||
|
|
||||||
public VirtualMachineTO() {
|
public VirtualMachineTO(VirtualMachineProfile profile, BootloaderType bootloader) {
|
||||||
|
this.id = profile.getId();
|
||||||
|
this.type = profile.getType();
|
||||||
|
this.cpus = profile.getCpus();
|
||||||
|
this.minRam = profile.getRam();
|
||||||
|
this.maxRam = profile.getRam();
|
||||||
|
this.speed = profile.getSpeed();
|
||||||
|
this.os = profile.getOs();
|
||||||
|
this.name = profile.getName();
|
||||||
|
this.bootloader = bootloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VirtualMachineTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
@ -56,6 +69,14 @@ public class VirtualMachineTO {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Monitor getMonitor() {
|
||||||
|
return monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonitor(Monitor monitor) {
|
||||||
|
this.monitor = monitor;
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -81,22 +102,10 @@ public class VirtualMachineTO {
|
|||||||
this.cpus = cpus;
|
this.cpus = cpus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWeight() {
|
public Integer getSpeed() {
|
||||||
return weight;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeight(Integer weight) {
|
|
||||||
this.weight = weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUtilization() {
|
|
||||||
return utilization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUtiliziation(Integer utilization) {
|
|
||||||
this.utilization = utilization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMinRam() {
|
public long getMinRam() {
|
||||||
return minRam;
|
return minRam;
|
||||||
}
|
}
|
||||||
@ -133,11 +142,20 @@ public class VirtualMachineTO {
|
|||||||
public void setOs(String os) {
|
public void setOs(String os) {
|
||||||
this.os = os;
|
this.os = os;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBootArgs() {
|
public String getBootArgs() {
|
||||||
|
StringBuilder buf = new StringBuilder(bootArgs != null ? bootArgs : "");
|
||||||
|
buf.append(" ");
|
||||||
|
for (NicTO nic : nics) {
|
||||||
|
buf.append("");
|
||||||
|
}
|
||||||
return bootArgs;
|
return bootArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBootArgs(String bootArgs) {
|
||||||
|
this.bootArgs = bootArgs;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBootArgs(Map<String, String> bootParams) {
|
public void setBootArgs(Map<String, String> bootParams) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
for (Map.Entry<String, String> entry : bootParams.entrySet()) {
|
for (Map.Entry<String, String> entry : bootParams.entrySet()) {
|
||||||
@ -162,12 +180,33 @@ public class VirtualMachineTO {
|
|||||||
this.disks = disks;
|
this.disks = disks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NicTO[] getNetworks() {
|
public NicTO[] getNics() {
|
||||||
return nics;
|
return nics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNics(NicTO[] nics) {
|
public void setNics(NicTO[] nics) {
|
||||||
this.nics = nics;
|
this.nics = nics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface Monitor {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SshMonitor implements Monitor {
|
||||||
|
String ip;
|
||||||
|
int port;
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SshMonitor(String ip, int port) {
|
||||||
|
this.ip = ip;
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -19,10 +19,8 @@ package com.cloud.agent.api.to;
|
|||||||
|
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
import com.cloud.storage.VolumeVO;
|
|
||||||
|
|
||||||
|
|
||||||
public class VolumeTO {
|
public class VolumeTO {
|
||||||
@ -51,7 +49,7 @@ public class VolumeTO {
|
|||||||
this.mountPoint = mountPoint;
|
this.mountPoint = mountPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeTO(VolumeVO volume, StoragePoolVO pool) {
|
public VolumeTO(Volume volume, StoragePool pool) {
|
||||||
this.id = volume.getId();
|
this.id = volume.getId();
|
||||||
this.name = volume.getName();
|
this.name = volume.getName();
|
||||||
this.path = volume.getPath();
|
this.path = volume.getPath();
|
||||||
@ -62,15 +60,7 @@ public class VolumeTO {
|
|||||||
this.mountPoint = volume.getFolder();
|
this.mountPoint = volume.getFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeTO(VMTemplateStoragePoolVO templatePoolRef, StoragePoolVO pool) {
|
|
||||||
this.id = templatePoolRef.getId();
|
|
||||||
this.path = templatePoolRef.getInstallPath();
|
|
||||||
this.size = templatePoolRef.getTemplateSize();
|
|
||||||
this.resourceType = Storage.StorageResourceType.STORAGE_POOL;
|
|
||||||
this.storagePoolType = pool.getPoolType();
|
|
||||||
this.mountPoint = pool.getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDeviceId() {
|
public int getDeviceId() {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
@ -10,4 +10,6 @@ import com.cloud.org.Grouping;
|
|||||||
*/
|
*/
|
||||||
public interface DataCenter extends Grouping {
|
public interface DataCenter extends Grouping {
|
||||||
long getId();
|
long getId();
|
||||||
|
String getDns1();
|
||||||
|
String getDns2();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,10 +18,13 @@
|
|||||||
package com.cloud.deploy;
|
package com.cloud.deploy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes how a VM should be deployed.
|
* Describes how a VM should be deployed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface DeploymentPlan {
|
public interface DeploymentPlan {
|
||||||
|
// TODO: This interface is not fully developed. It really
|
||||||
|
// should be more complicated than this and allow a
|
||||||
|
// number of parameters to be specified.
|
||||||
public long getDataCenterId();
|
public long getDataCenterId();
|
||||||
public int getCount();
|
public int getCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,18 +20,39 @@ package com.cloud.exception;
|
|||||||
import com.cloud.utils.SerialVersionUID;
|
import com.cloud.utils.SerialVersionUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when the storage device can not be reached.
|
* This exception is thrown when storage for a VM is unavailable.
|
||||||
*
|
* If the cause is due to storage pool unavailable, calling
|
||||||
|
* getOffendingObject() will return the object that we have
|
||||||
|
* problem with.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class StorageUnavailableException extends AgentUnavailableException {
|
public class StorageUnavailableException extends Exception {
|
||||||
|
Object _obj;
|
||||||
|
|
||||||
private static final long serialVersionUID = SerialVersionUID.StorageUnavailableException;
|
private static final long serialVersionUID = SerialVersionUID.StorageUnavailableException;
|
||||||
|
|
||||||
public StorageUnavailableException(long hostId) {
|
|
||||||
super(hostId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StorageUnavailableException(String msg) {
|
public StorageUnavailableException(String msg) {
|
||||||
super(msg, -1);
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageUnavailableException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageUnavailableException(String msg, Object cause) {
|
||||||
|
super(msg);
|
||||||
|
_obj = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageUnavailableException(String msg, Object obj, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
_obj = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return object that caused this problem. It can either be a StoragePool or volume.
|
||||||
|
*/
|
||||||
|
public Object getOffendingObject() {
|
||||||
|
return _obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,7 @@ package com.cloud.host;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;;
|
||||||
import com.cloud.hypervisor.Hypervisor.Type;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +134,7 @@ public interface Host {
|
|||||||
/**
|
/**
|
||||||
* @return type of hypervisor
|
* @return type of hypervisor
|
||||||
*/
|
*/
|
||||||
Hypervisor.Type getHypervisorType();
|
HypervisorType getHypervisorType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return disconnection date
|
* @return disconnection date
|
||||||
|
|||||||
@ -19,13 +19,38 @@ package com.cloud.hypervisor;
|
|||||||
|
|
||||||
public class Hypervisor {
|
public class Hypervisor {
|
||||||
|
|
||||||
public static enum Type {
|
public static enum HypervisorType {
|
||||||
None, //for storage hosts
|
None, //for storage hosts
|
||||||
Xen,
|
Xen,
|
||||||
XenServer,
|
XenServer,
|
||||||
KVM,
|
KVM,
|
||||||
VmWare,
|
VmWare,
|
||||||
VirtualBox,
|
VirtualBox,
|
||||||
Parralels;
|
Parralels,
|
||||||
|
Any; /*If you don't care about the hypervisor type*/
|
||||||
|
|
||||||
|
public static HypervisorType getType(String hypervisor) {
|
||||||
|
if (hypervisor == null) {
|
||||||
|
return HypervisorType.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hypervisor.equalsIgnoreCase("Xen")) {
|
||||||
|
return HypervisorType.Xen;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("XenServer")) {
|
||||||
|
return HypervisorType.XenServer;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("KVM")) {
|
||||||
|
return HypervisorType.KVM;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("VmWare")) {
|
||||||
|
return HypervisorType.VmWare;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("VirtualBox")) {
|
||||||
|
return HypervisorType.VirtualBox;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("Parralels")) {
|
||||||
|
return HypervisorType.Parralels;
|
||||||
|
} else if (hypervisor.equalsIgnoreCase("Any")) {
|
||||||
|
return HypervisorType.Any;
|
||||||
|
} else {
|
||||||
|
return HypervisorType.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
api/src/com/cloud/hypervisor/HypervisorGuru.java
Normal file
28
api/src/com/cloud/hypervisor/HypervisorGuru.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.hypervisor;
|
||||||
|
|
||||||
|
import com.cloud.offering.ServiceOffering;
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
|
public interface HypervisorGuru extends Adapter {
|
||||||
|
VirtualMachineProfile design(VirtualMachine vm, ServiceOffering offering);
|
||||||
|
boolean check(VirtualMachineProfile profile);
|
||||||
|
}
|
||||||
@ -23,10 +23,10 @@ public interface NetworkConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum State implements FiniteState<State, Event> {
|
enum State implements FiniteState<State, Event> {
|
||||||
Allocated, // Indicates the network configuration is in allocated but not setup.
|
Allocated("Indicates the network configuration is in allocated but not setup"),
|
||||||
Setup, // Indicates the network configuration is setup.
|
Setup("Indicates the network configuration is setup"),
|
||||||
Implemented, // Indicates the network configuration is in use.
|
Implemented("Indicates the network configuration is in use"),
|
||||||
Destroying;
|
Destroying("Indicates the network configuration is being destroyed");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StateMachine<State, Event> getStateMachine() {
|
public StateMachine<State, Event> getStateMachine() {
|
||||||
@ -48,7 +48,23 @@ public interface NetworkConfiguration {
|
|||||||
return s_fsm.getPossibleEvents(this);
|
return s_fsm.getPossibleEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _description;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private State(String description) {
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
|
||||||
private static StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
|
private static StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
|
||||||
|
static {
|
||||||
|
s_fsm.addTransition(State.Allocated, Event.ImplementNetwork, State.Implemented);
|
||||||
|
s_fsm.addTransition(State.Implemented, Event.DestroyNetwork, State.Destroying);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,5 +66,4 @@ public interface ServiceOffering {
|
|||||||
* @return whether or not the service offering requires local storage
|
* @return whether or not the service offering requires local storage
|
||||||
*/
|
*/
|
||||||
boolean getUseLocalStorage();
|
boolean getUseLocalStorage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,12 +26,14 @@ public interface Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum State implements FiniteState<State, Event> {
|
enum State implements FiniteState<State, Event> {
|
||||||
Allocated, // Resource is allocated
|
Allocated("Resource is allocated but not reserved"),
|
||||||
Reserving, // Resource is being reserved right now.
|
Reserving("Resource is being reserved right now"),
|
||||||
Reserved, // Resource is reserved
|
Reserved("Resource has been reserved."),
|
||||||
Releasing, // Resource is being released.
|
Releasing("Resource is being released"),
|
||||||
Ready; // Resource is ready which means it does not need to go through reservation.
|
Ready("Resource is ready which means it doesn't need to go through resservation");
|
||||||
|
|
||||||
|
String _description;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StateMachine<State, Event> getStateMachine() {
|
public StateMachine<State, Event> getStateMachine() {
|
||||||
|
|
||||||
@ -54,12 +56,24 @@ public interface Resource {
|
|||||||
return s_fsm.getPossibleEvents(this);
|
return s_fsm.getPossibleEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private State(String description) {
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
|
||||||
final static private StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
|
final static private StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
|
||||||
static {
|
static {
|
||||||
s_fsm.addTransition(State.Allocated, Event.ReservationRequested, State.Reserving);
|
s_fsm.addTransition(State.Allocated, Event.ReservationRequested, State.Reserving);
|
||||||
s_fsm.addTransition(State.Reserving, Event.CancelRequested, State.Allocated);
|
s_fsm.addTransition(State.Reserving, Event.CancelRequested, State.Allocated);
|
||||||
s_fsm.addTransition(State.Reserving, Event.OperationCompleted, State.Reserved);
|
s_fsm.addTransition(State.Reserving, Event.OperationCompleted, State.Reserved);
|
||||||
s_fsm.addTransition(State.Reserving, Event.OperationFailed, State.Allocated);
|
s_fsm.addTransition(State.Reserving, Event.OperationFailed, State.Allocated);
|
||||||
|
s_fsm.addTransition(State.Reserved, Event.ReleaseRequested, State.Releasing);
|
||||||
|
s_fsm.addTransition(State.Releasing, Event.OperationCompleted, State.Allocated);
|
||||||
|
s_fsm.addTransition(State.Releasing, Event.OperationFailed, State.Reserved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class Storage {
|
|||||||
RAW(false, false, false),
|
RAW(false, false, false),
|
||||||
VHD(true, true, true),
|
VHD(true, true, true),
|
||||||
ISO(false, false, false),
|
ISO(false, false, false),
|
||||||
VMDK(true, true, true, "vmw.tar");
|
OVA(true, true, true, "ova");
|
||||||
|
|
||||||
private final boolean thinProvisioned;
|
private final boolean thinProvisioned;
|
||||||
private final boolean supportSparse;
|
private final boolean supportSparse;
|
||||||
@ -79,6 +79,11 @@ public class Storage {
|
|||||||
hfsp
|
hfsp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static enum TemplateType {
|
||||||
|
SYSTEM,
|
||||||
|
BUILTIN
|
||||||
|
}
|
||||||
|
|
||||||
public static enum StoragePoolType {
|
public static enum StoragePoolType {
|
||||||
Filesystem(false), //local directory
|
Filesystem(false), //local directory
|
||||||
NetworkFilesystem(true), //NFS or CIFS
|
NetworkFilesystem(true), //NFS or CIFS
|
||||||
|
|||||||
30
api/src/com/cloud/storage/StorageGuru.java
Normal file
30
api/src/com/cloud/storage/StorageGuru.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.storage;
|
||||||
|
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StorageGuru understands about how to implement different
|
||||||
|
* types of storage pools.
|
||||||
|
*/
|
||||||
|
public interface StorageGuru extends Adapter {
|
||||||
|
void createVolume();
|
||||||
|
void prepareVolume();
|
||||||
|
void destroyVolume();
|
||||||
|
}
|
||||||
@ -101,4 +101,8 @@ public interface StoragePool {
|
|||||||
* @return the storage pool status
|
* @return the storage pool status
|
||||||
*/
|
*/
|
||||||
Status getStatus();
|
Status getStatus();
|
||||||
|
|
||||||
|
int getPort();
|
||||||
|
|
||||||
|
Long getPodId();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,10 +18,14 @@
|
|||||||
package com.cloud.storage;
|
package com.cloud.storage;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.cloud.domain.PartOf;
|
import com.cloud.domain.PartOf;
|
||||||
import com.cloud.template.BasedOn;
|
import com.cloud.template.BasedOn;
|
||||||
import com.cloud.user.OwnedBy;
|
import com.cloud.user.OwnedBy;
|
||||||
|
import com.cloud.utils.fsm.FiniteState;
|
||||||
|
import com.cloud.utils.fsm.StateMachine;
|
||||||
|
|
||||||
|
|
||||||
public interface Volume extends PartOf, OwnedBy, BasedOn {
|
public interface Volume extends PartOf, OwnedBy, BasedOn {
|
||||||
@ -29,14 +33,69 @@ public interface Volume extends PartOf, OwnedBy, BasedOn {
|
|||||||
|
|
||||||
enum MirrorState {NOT_MIRRORED, ACTIVE, DEFUNCT};
|
enum MirrorState {NOT_MIRRORED, ACTIVE, DEFUNCT};
|
||||||
|
|
||||||
enum State {
|
enum State implements FiniteState<State, Event> {
|
||||||
Allocated,
|
Allocated("The volume is allocated but has not been created yet."),
|
||||||
Creating,
|
Creating("The volume is being created. getPoolId() should reflect the pool where it is being created."),
|
||||||
Created,
|
Ready("The volume is ready to be used."),
|
||||||
Corrupted,
|
Destroy("The volume is set to be desctroyed but can be recovered."),
|
||||||
ToBeDestroyed,
|
Expunging("The volume is being destroyed. There's no way to recover."),
|
||||||
Expunging,
|
Destroyed("The volume is destroyed. Should be removed.");
|
||||||
Destroyed
|
|
||||||
|
String _description;
|
||||||
|
|
||||||
|
private State(String description) {
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StateMachine<State, Event> getStateMachine() {
|
||||||
|
return s_fsm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public State getNextState(Event event) {
|
||||||
|
return s_fsm.getNextState(this, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<State> getFromStates(Event event) {
|
||||||
|
return s_fsm.getFromStates(this, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Event> getPossibleEvents() {
|
||||||
|
return s_fsm.getPossibleEvents(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static StateMachine<State, Event> s_fsm = new StateMachine<State, Event>();
|
||||||
|
static {
|
||||||
|
s_fsm.addTransition(Allocated, Event.Create, Creating);
|
||||||
|
s_fsm.addTransition(Allocated, Event.Destroy, Destroyed);
|
||||||
|
s_fsm.addTransition(Creating, Event.OperationRetry, Creating);
|
||||||
|
s_fsm.addTransition(Creating, Event.OperationFailed, Allocated);
|
||||||
|
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
|
||||||
|
s_fsm.addTransition(Creating, Event.Destroy, Expunging);
|
||||||
|
s_fsm.addTransition(Ready, Event.Destroy, Destroy);
|
||||||
|
s_fsm.addTransition(Destroy, Event.Expunge, Expunging);
|
||||||
|
s_fsm.addTransition(Destroy, Event.Recover, Ready);
|
||||||
|
s_fsm.addTransition(Expunging, Event.OperationSucceeded, Destroyed);
|
||||||
|
s_fsm.addTransition(Expunging, Event.OperationFailed, Destroy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Event {
|
||||||
|
Create,
|
||||||
|
OperationFailed,
|
||||||
|
OperationSucceeded,
|
||||||
|
OperationRetry,
|
||||||
|
Destroy,
|
||||||
|
Recover,
|
||||||
|
Expunge;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SourceType {
|
enum SourceType {
|
||||||
|
|||||||
@ -37,10 +37,5 @@ public interface VirtualMachineTemplate {
|
|||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the file system for this template.
|
|
||||||
*/
|
|
||||||
FileSystem getFileSystem();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.cloud.vm;
|
package com.cloud.vm;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.offering.DiskOffering;
|
import com.cloud.offering.DiskOffering;
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ public class DiskProfile {
|
|||||||
private long volumeId;
|
private long volumeId;
|
||||||
private Volume vol;
|
private Volume vol;
|
||||||
private DiskOffering offering;
|
private DiskOffering offering;
|
||||||
|
private HypervisorType hyperType;
|
||||||
|
|
||||||
protected DiskProfile() {
|
protected DiskProfile() {
|
||||||
}
|
}
|
||||||
@ -54,10 +56,11 @@ public class DiskProfile {
|
|||||||
this.volumeId = volumeId;
|
this.volumeId = volumeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskProfile(Volume vol, DiskOffering offering) {
|
public DiskProfile(Volume vol, DiskOffering offering, HypervisorType hyperType) {
|
||||||
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.getUseLocalStorage(), vol.getSize());
|
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.getUseLocalStorage(), vol.getSize());
|
||||||
this.vol = vol;
|
this.vol = vol;
|
||||||
this.offering = offering;
|
this.offering = offering;
|
||||||
|
this.hyperType = hyperType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,4 +131,12 @@ public class DiskProfile {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringBuilder("DskChr[").append(type).append("|").append(size).append("|").append("]").toString();
|
return new StringBuilder("DskChr[").append(type).append("|").append(size).append("|").append("]").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHyperType(HypervisorType hyperType) {
|
||||||
|
this.hyperType = hyperType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HypervisorType getHypersorType() {
|
||||||
|
return this.hyperType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,30 @@ public class NicProfile {
|
|||||||
URI broadcastUri;
|
URI broadcastUri;
|
||||||
ReservationStrategy strategy;
|
ReservationStrategy strategy;
|
||||||
String reservationId;
|
String reservationId;
|
||||||
|
boolean defaultNic;
|
||||||
|
Integer deviceId;
|
||||||
|
String dns1;
|
||||||
|
String dns2;
|
||||||
|
|
||||||
|
public String getDns1() {
|
||||||
|
return dns1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDns2() {
|
||||||
|
return dns2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDns1(String dns1) {
|
||||||
|
this.dns1 = dns1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDns2(String dns2) {
|
||||||
|
this.dns2 = dns2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefaultNic() {
|
||||||
|
return defaultNic;
|
||||||
|
}
|
||||||
|
|
||||||
public String getNetmask() {
|
public String getNetmask() {
|
||||||
return netmask;
|
return netmask;
|
||||||
@ -54,6 +78,10 @@ public class NicProfile {
|
|||||||
return isolationUri;
|
return isolationUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStrategy(ReservationStrategy strategy) {
|
||||||
|
this.strategy = strategy;
|
||||||
|
}
|
||||||
|
|
||||||
public BroadcastDomainType getType() {
|
public BroadcastDomainType getType() {
|
||||||
return broadcastType;
|
return broadcastType;
|
||||||
}
|
}
|
||||||
@ -69,6 +97,18 @@ public class NicProfile {
|
|||||||
public void setVmId(long vmId) {
|
public void setVmId(long vmId) {
|
||||||
this.vmId = vmId;
|
this.vmId = vmId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(int deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultNic(boolean defaultNic) {
|
||||||
|
this.defaultNic = defaultNic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setGateway(String gateway) {
|
public void setGateway(String gateway) {
|
||||||
this.gateway = gateway;
|
this.gateway = gateway;
|
||||||
@ -142,7 +182,7 @@ public class NicProfile {
|
|||||||
this.ip4Address = ip4Address;
|
this.ip4Address = ip4Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NicProfile(Nic nic, NetworkConfiguration network) {
|
public NicProfile(Nic nic, NetworkConfiguration network, URI broadcastUri, URI isolationUri) {
|
||||||
this.id = nic.getId();
|
this.id = nic.getId();
|
||||||
this.gateway = network.getGateway();
|
this.gateway = network.getGateway();
|
||||||
this.mode = network.getMode();
|
this.mode = network.getMode();
|
||||||
@ -171,6 +211,9 @@ public class NicProfile {
|
|||||||
this.netmask = netmask;
|
this.netmask = netmask;
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NicProfile() {
|
||||||
|
}
|
||||||
|
|
||||||
public ReservationStrategy getReservationStrategy() {
|
public ReservationStrategy getReservationStrategy() {
|
||||||
return strategy;
|
return strategy;
|
||||||
|
|||||||
@ -26,21 +26,28 @@ import com.cloud.utils.fsm.StateMachine;
|
|||||||
import com.cloud.vm.VirtualMachine.Event;
|
import com.cloud.vm.VirtualMachine.Event;
|
||||||
|
|
||||||
public enum State implements FiniteState<State, Event> {
|
public enum State implements FiniteState<State, Event> {
|
||||||
Creating(true),
|
Creating(true, "VM is being created"),
|
||||||
Starting(true),
|
Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."),
|
||||||
Running(false),
|
Running(false, "VM is running. host id has the host that it is running on."),
|
||||||
Stopping(true),
|
Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."),
|
||||||
Stopped(false),
|
Stopped(false, "VM is stopped. host id should be null."),
|
||||||
Destroyed(false),
|
Destroyed(false, "VM is marked for destroy."),
|
||||||
Expunging(true),
|
Expunging(true, "VM is being expunged."),
|
||||||
Migrating(true),
|
Migrating(true, "VM is being migrated. host id holds to from host"),
|
||||||
Error(false),
|
Error(false, "VM is in error"),
|
||||||
Unknown(false);
|
Unknown(false, "VM state is unknown.");
|
||||||
|
|
||||||
private final boolean _transitional;
|
private final boolean _transitional;
|
||||||
|
String _description;
|
||||||
|
|
||||||
private State(boolean transitional) {
|
private State(boolean transitional, String description) {
|
||||||
_transitional = transitional;
|
_transitional = transitional;
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return _description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTransitional() {
|
public boolean isTransitional() {
|
||||||
@ -67,6 +74,7 @@ public enum State implements FiniteState<State, Event> {
|
|||||||
return s_fsm;
|
return s_fsm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static final StateMachine<State, VirtualMachine.Event> s_fsm = new StateMachine<State, VirtualMachine.Event>();
|
protected static final StateMachine<State, VirtualMachine.Event> s_fsm = new StateMachine<State, VirtualMachine.Event>();
|
||||||
static {
|
static {
|
||||||
s_fsm.addTransition(null, VirtualMachine.Event.CreateRequested, State.Creating);
|
s_fsm.addTransition(null, VirtualMachine.Event.CreateRequested, State.Creating);
|
||||||
|
|||||||
@ -20,25 +20,34 @@ package com.cloud.vm;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.offering.ServiceOffering;
|
import com.cloud.offering.ServiceOffering;
|
||||||
|
|
||||||
public class VirtualMachineProfile {
|
public class VirtualMachineProfile {
|
||||||
VirtualMachine _vm;
|
VirtualMachine _vm;
|
||||||
int _cpus;
|
Integer _cpus;
|
||||||
int _speed; // in mhz
|
Integer _speed; // in mhz
|
||||||
long _ram; // in bytes
|
long _ram; // in bytes
|
||||||
Hypervisor.Type _hypervisorType;
|
HypervisorType _hypervisorType;
|
||||||
VirtualMachine.Type _type;
|
VirtualMachine.Type _type;
|
||||||
Map<String, String> _params;
|
Map<String, String> _params;
|
||||||
Long _templateId;
|
Long _templateId;
|
||||||
List<DiskProfile> _disks;
|
List<DiskProfile> _disks;
|
||||||
List<NicProfile> _nics;
|
List<NicProfile> _nics;
|
||||||
|
String _os;
|
||||||
|
|
||||||
public VirtualMachineProfile(VirtualMachine.Type type) {
|
public VirtualMachineProfile(VirtualMachine.Type type) {
|
||||||
this._type = type;
|
this._type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return _vm.getInstanceName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOs() {
|
||||||
|
return _os;
|
||||||
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return _vm.getId();
|
return _vm.getId();
|
||||||
}
|
}
|
||||||
@ -51,11 +60,11 @@ public class VirtualMachineProfile {
|
|||||||
return _templateId;
|
return _templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCpus() {
|
public Integer getCpus() {
|
||||||
return _cpus;
|
return _cpus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSpeed() {
|
public Integer getSpeed() {
|
||||||
return _speed;
|
return _speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +88,7 @@ public class VirtualMachineProfile {
|
|||||||
return _disks;
|
return _disks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hypervisor.Type getHypervisorType() {
|
public HypervisorType getHypervisorType() {
|
||||||
return _hypervisorType;
|
return _hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,22 +96,15 @@ public class VirtualMachineProfile {
|
|||||||
return _vm;
|
return _vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VirtualMachineProfile(long id, int core, int speed, long ram, Long templateId, Hypervisor.Type type, Map<String, String> params) {
|
public VirtualMachineProfile(VirtualMachine vm, ServiceOffering offering, String os, HypervisorType hypervisorType) {
|
||||||
this._cpus = core;
|
|
||||||
this._speed = speed;
|
|
||||||
this._ram = ram;
|
|
||||||
this._hypervisorType = type;
|
|
||||||
this._params = params;
|
|
||||||
this._templateId = templateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VirtualMachineProfile(VirtualMachine vm, ServiceOffering offering) {
|
|
||||||
this._cpus = offering.getCpu();
|
this._cpus = offering.getCpu();
|
||||||
this._speed = offering.getSpeed();
|
this._speed = offering.getSpeed();
|
||||||
this._ram = offering.getRamSize();
|
this._ram = offering.getRamSize() * 1024l * 1024l;
|
||||||
this._templateId = vm.getTemplateId();
|
this._templateId = vm.getTemplateId();
|
||||||
this._type = vm.getType();
|
this._type = vm.getType();
|
||||||
this._vm = vm;
|
this._vm = vm;
|
||||||
|
this._os = os;
|
||||||
|
this._hypervisorType = hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VirtualMachineProfile() {
|
protected VirtualMachineProfile() {
|
||||||
@ -112,4 +114,4 @@ public class VirtualMachineProfile {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "VM-" + _type + "-" + _vm.getId();
|
return "VM-" + _type + "-" + _vm.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -518,15 +518,15 @@
|
|||||||
<target name="build-systemvm-patch" depends="-init">
|
<target name="build-systemvm-patch" depends="-init">
|
||||||
<mkdir dir="${dist.dir}" />
|
<mkdir dir="${dist.dir}" />
|
||||||
<tar destfile="${dist.dir}/patch.tar">
|
<tar destfile="${dist.dir}/patch.tar">
|
||||||
<tarfileset dir="${base.dir}/patches/systemvm" filemode="755">
|
<tarfileset dir="${base.dir}/patches/systemvm/debian/config/" filemode="755">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
<exclude name="**/wscript_build" />
|
<exclude name="**/wscript_build" />
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
</tar>
|
</tar>
|
||||||
<copy file="${base.dir}/patches/systemvm/root/.ssh/authorized_keys" todir="${dist.dir}/"/>
|
<copy file="${base.dir}/patches/systemvm/debian/config/root/.ssh/authorized_keys" todir="${dist.dir}/"/>
|
||||||
<gzip destfile="${dist.dir}/patch.tgz" src="${dist.dir}/patch.tar"/>
|
<gzip destfile="${dist.dir}/cloud-scripts.tgz" src="${dist.dir}/patch.tar"/>
|
||||||
<delete file="${dist.dir}/patch.tar"/>
|
<delete file="${dist.dir}/patch.tar"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|||||||
@ -160,24 +160,8 @@
|
|||||||
<available file="${setup.db.dir}/override/server-setup.xml" />
|
<available file="${setup.db.dir}/override/server-setup.xml" />
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="kvm.templates.file" value="override/templates.kvm.sql" else="templates.kvm.sql">
|
<condition property="templates.file" value="override/templates.sql" else="templates.sql" >
|
||||||
<available file="${setup.db.dir}/override/templates.kvm.sql" />
|
<available file="${setup.db.dir}/override/templates.sql" />
|
||||||
</condition>
|
|
||||||
|
|
||||||
<condition property="xenserver.templates.file" value="override/templates.xenserver.sql" else="templates.xenserver.sql">
|
|
||||||
<available file="${setup.db.dir}/override/templates.xenserver.sql" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<condition property="vmware.templates.file" value="override/templates.vmware.sql" else="templates.vmware.sql">
|
|
||||||
<available file="${setup.db.dir}/override/templates.vmware.sql" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<condition property="templates.file.intermediate" value="${kvm.templates.file}" else="${xenserver.templates.file}" >
|
|
||||||
<isset property="KVM"/>
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<condition property="templates.file" value="${vmware.templates.file}" else="${templates.file.intermediate}" >
|
|
||||||
<isset property="vmware"/>
|
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<echo message="deploydb ${server-setup.file} ${templates.file} ${DBROOTPW}" />
|
<echo message="deploydb ${server-setup.file} ${templates.file} ${DBROOTPW}" />
|
||||||
|
|||||||
@ -1 +1,95 @@
|
|||||||
Details = Details
|
actions = Actions
|
||||||
|
add = Add
|
||||||
|
help = Help
|
||||||
|
advanced = Advanced
|
||||||
|
version = Version
|
||||||
|
|
||||||
|
dashboard = Dashboard
|
||||||
|
instance = Instance
|
||||||
|
router = Router
|
||||||
|
storage = Storage
|
||||||
|
volume = Volume
|
||||||
|
snapshot = Snapshot
|
||||||
|
ip.address = IP Address
|
||||||
|
template = Template
|
||||||
|
my.template = My Template
|
||||||
|
featured.template = Featured Template
|
||||||
|
community.template = Community Template
|
||||||
|
iso = ISO
|
||||||
|
my.iso = My ISO
|
||||||
|
featured.iso = Featured ISO
|
||||||
|
community.iso = Community ISO
|
||||||
|
account = Account
|
||||||
|
domain = Domain
|
||||||
|
event = Event
|
||||||
|
alert = Alert
|
||||||
|
system = System
|
||||||
|
global.settings = Global Settings
|
||||||
|
resources = Resources
|
||||||
|
service.offerings = Service Offerings
|
||||||
|
disk.offerings = Disk Offerings
|
||||||
|
|
||||||
|
details = Details
|
||||||
|
network = Network
|
||||||
|
secondary.storage = Secondary Storage
|
||||||
|
|
||||||
|
no.available.actions = No available actions
|
||||||
|
|
||||||
|
ID = ID
|
||||||
|
name = Name
|
||||||
|
display.text = Display Text
|
||||||
|
os.type = OS Type
|
||||||
|
public = Public
|
||||||
|
instance.name = Instance Name
|
||||||
|
group.name = Group Name
|
||||||
|
service.offering = Service Offering
|
||||||
|
password.enabled = Password Enabled
|
||||||
|
instance.limit = Instance Limit
|
||||||
|
public.ip.limit = Public IP Limit
|
||||||
|
disk.volume.limit = Disk Volume Limit
|
||||||
|
snapshot.limit = Snapshot Limit
|
||||||
|
template.limit = Template Limit
|
||||||
|
URL = URL
|
||||||
|
zone = Zone
|
||||||
|
bootable = Bootable
|
||||||
|
group = Group
|
||||||
|
storage.type = Storage Type
|
||||||
|
CPU = CPU
|
||||||
|
memory = Memory
|
||||||
|
offer.HA = Offer HA
|
||||||
|
network.type = Network Type
|
||||||
|
created = Created
|
||||||
|
disk.size = Disk Size
|
||||||
|
value = Value
|
||||||
|
description = Description
|
||||||
|
|
||||||
|
disk.offering = Disk Offering
|
||||||
|
copy.ISO.to = Copy ISO to
|
||||||
|
no.available.iso = No Available ISO
|
||||||
|
please.wait = Please wait
|
||||||
|
|
||||||
|
your.session.has.expired = Your session has expired
|
||||||
|
internet.name.can.not.be.resolved = Internet name can not be resolved
|
||||||
|
management.server.is.not.accessible = Management server is not accessible
|
||||||
|
please.select.at.least.one.item.in.middle.menu = Please select at least one item in middle menu
|
||||||
|
please.confirm.you.want.to.detach.an.iso.from.the.virtual.machine = Please confirm you want to detach an ISO from the virtual machine
|
||||||
|
please.specify.the.iso.you.wish.to.attach.to.virtual.machine = Please specify the ISO you wish to attach to virtual instance
|
||||||
|
please.specify.the.new.name.you.want.to.change.for.the.virtual.machine = Please specify the new name you want to change for the virtual instance
|
||||||
|
please.specify.the.new.group.you.want.to.assign.the.virtual.machine.to = Please specify the new group you want to assign the virtual machine to
|
||||||
|
after.changing.service.offering.you.must.restart.the.virtual.machine.for.new.service.offering.to.take.effect = After changing service offering, you must restart the virtual machine for the new service offering to take effect.
|
||||||
|
creating.a.template.of.disk.volume.could.take.up.to.several.hours.depending.on.the.size.of.the.disk.volume = Creating a template of disk volume could take up to several hours depending on the size of the disk volume
|
||||||
|
please.confirm.you.want.to.change.the.root.password.for.the.virtual.machine = Please confirm you want to change the ROOT password for the virtual machine
|
||||||
|
please.confirm.you.want.to.enable.HA.for.your.virtual.machine.once.HA.is.enabled.your.virtual.machine.will.be.automatically.restarted.in.the.event.it.is.detected.to.have.failed = Please confirm you want to enable HA for your virtual machine. Once HA is enabled, your virtual machine will be automatically restarted in the event it is detected to have failed.
|
||||||
|
please.confirm.you.want.to.disable.HA.for.the.virtual.machine.once.HA.is.disabled.the.virtual.machine.will.no.longer.be.automatically.restarted.in.the.event.of.a.failure = Please confirm you want to disable HA for the virtual machine. Once HA is disabled, the virtual machine will no longer be be automatically restarted in the event of a failure.
|
||||||
|
the.ISO.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones = The ISO is used by all zones. Please confirm you want to delete it from all zones.
|
||||||
|
please.confirm.you.want.to.delete.the.ISO = Please confirm you want to delete the ISO
|
||||||
|
the.template.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones = The template is used by all zones. Please confirm you want to delete it from all zones.
|
||||||
|
please.confirm.you.want.to.delete.the.template = Please confirm you want to delete the template
|
||||||
|
please.specify.limits.to.the.various.resources.-1.means.the.resource.has.no.limits = Please specify limits to the various resources. -1 means the resource has no limits.
|
||||||
|
please.confirm.you.want.to.disable.account.that.will.prevent.account.access.to.the.cloud.and.shut.down.all.existing.virtual.machines = Please confirm you want to disable account that will prevent account access to the cloud and shut down all existing virtual machines.
|
||||||
|
please.confirm.you.want.to.lock.account.that.will.prevent.account.access.to.the.cloud = Please confirm you want to lock account that will prevent account access to the cloud.
|
||||||
|
please.confirm.you.want.to.enable.account = Please confirm you want to enable account.
|
||||||
|
please.select.an.available.zone.to.associate.your.new.ip.with..acquiring.additional.ip.may.cost.you.an.additional.dollars.per.month. = Please select an availability zone to associate your new IP with. Acquiring additional IP may cost you an additional dollars per month.
|
||||||
|
please.confirm.you.want.to.release.this.IP.address = Please confirm you want to release this IP address
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,29 @@
|
|||||||
|
actions = 功能
|
||||||
|
add = 增加
|
||||||
|
help = 幫助
|
||||||
|
advanced = 進階
|
||||||
|
version = 版本
|
||||||
|
|
||||||
|
dashboard = 儀器板
|
||||||
|
instance = 實例
|
||||||
|
router = 路由器
|
||||||
|
storage = 貯藏
|
||||||
|
volume = 容積
|
||||||
|
snapshot = 快照
|
||||||
|
ip.address = 網路地址
|
||||||
|
template = 模板
|
||||||
|
my.template = 我的模板
|
||||||
|
featured.template = 特色模板
|
||||||
|
community.template = 共有模板
|
||||||
|
iso = 空白模板
|
||||||
|
my.iso = 我的空白模板
|
||||||
|
featured.iso = 特色空白模板
|
||||||
|
community.iso = 共有空白模板
|
||||||
|
account = 帳戶
|
||||||
|
domain = 領土
|
||||||
|
event = 事件
|
||||||
|
alert = 警報
|
||||||
|
|
||||||
Details = 詳述
|
Details = 詳述
|
||||||
Volume = 容積
|
Volume = 容積
|
||||||
Statistics = 統計
|
Statistics = 統計
|
||||||
@ -7,7 +33,6 @@ Service = 服務
|
|||||||
HA = 高的可用性
|
HA = 高的可用性
|
||||||
Created = 產生日期
|
Created = 產生日期
|
||||||
Account = 帳戶
|
Account = 帳戶
|
||||||
Domain = 領土
|
|
||||||
Host = 主機
|
Host = 主機
|
||||||
ISO = 空白模板
|
ISO = 空白模板
|
||||||
|
|
||||||
|
|||||||
@ -129,6 +129,7 @@ listLoadBalancerRuleInstances=com.cloud.api.commands.ListLoadBalancerRuleInstanc
|
|||||||
startRouter=com.cloud.api.commands.StartRouterCmd;3
|
startRouter=com.cloud.api.commands.StartRouterCmd;3
|
||||||
rebootRouter=com.cloud.api.commands.RebootRouterCmd;3
|
rebootRouter=com.cloud.api.commands.RebootRouterCmd;3
|
||||||
stopRouter=com.cloud.api.commands.StopRouterCmd;3
|
stopRouter=com.cloud.api.commands.StopRouterCmd;3
|
||||||
|
changeServiceForRouter=com.cloud.api.commands.UpgradeRouterCmd;3
|
||||||
listRouters=com.cloud.api.commands.ListRoutersCmd;7
|
listRouters=com.cloud.api.commands.ListRoutersCmd;7
|
||||||
|
|
||||||
#### system vm commands
|
#### system vm commands
|
||||||
@ -213,9 +214,14 @@ registerPreallocatedLun=com.cloud.server.api.commands.RegisterPreallocatedLunCmd
|
|||||||
deletePreallocatedLun=com.cloud.server.api.commands.DeletePreallocatedLunCmd;1
|
deletePreallocatedLun=com.cloud.server.api.commands.DeletePreallocatedLunCmd;1
|
||||||
listPreallocatedLuns=com.cloud.api.commands.ListPreallocatedLunsCmd;1
|
listPreallocatedLuns=com.cloud.api.commands.ListPreallocatedLunsCmd;1
|
||||||
|
|
||||||
|
|
||||||
#### vm group commands
|
#### vm group commands
|
||||||
createInstanceGroup=com.cloud.api.commands.CreateVMGroupCmd;15
|
createInstanceGroup=com.cloud.api.commands.CreateVMGroupCmd;15
|
||||||
deleteInstanceGroup=com.cloud.api.commands.DeleteVMGroupCmd;15
|
deleteInstanceGroup=com.cloud.api.commands.DeleteVMGroupCmd;15
|
||||||
updateInstanceGroup=com.cloud.api.commands.UpdateVMGroupCmd;15
|
updateInstanceGroup=com.cloud.api.commands.UpdateVMGroupCmd;15
|
||||||
listInstanceGroups=com.cloud.api.commands.ListVMGroupsCmd;15
|
listInstanceGroups=com.cloud.api.commands.ListVMGroupsCmd;15
|
||||||
|
|
||||||
|
### Certificate commands
|
||||||
|
uploadCustomCertificate=com.cloud.api.commands.UploadCustomCertificateCmd;15
|
||||||
|
|
||||||
|
### other commands
|
||||||
|
listHypervisors=com.cloud.api.commands.ListHypervisorsCmd;15
|
||||||
@ -89,6 +89,7 @@
|
|||||||
<dao name="UserAccount" class="com.cloud.user.dao.UserAccountDaoImpl"/>
|
<dao name="UserAccount" class="com.cloud.user.dao.UserAccountDaoImpl"/>
|
||||||
<dao name="VM Template Host" class="com.cloud.storage.dao.VMTemplateHostDaoImpl"/>
|
<dao name="VM Template Host" class="com.cloud.storage.dao.VMTemplateHostDaoImpl"/>
|
||||||
<dao name="Upload" class="com.cloud.storage.dao.UploadDaoImpl"/>
|
<dao name="Upload" class="com.cloud.storage.dao.UploadDaoImpl"/>
|
||||||
|
<dao name="Certificate" class="com.cloud.certificate.dao.CertificateDaoImpl"/>
|
||||||
<dao name="VM Template Pool" class="com.cloud.storage.dao.VMTemplatePoolDaoImpl"/>
|
<dao name="VM Template Pool" class="com.cloud.storage.dao.VMTemplatePoolDaoImpl"/>
|
||||||
<dao name="VM Template Zone" class="com.cloud.storage.dao.VMTemplateZoneDaoImpl"/>
|
<dao name="VM Template Zone" class="com.cloud.storage.dao.VMTemplateZoneDaoImpl"/>
|
||||||
<dao name="Launch Permission" class="com.cloud.storage.dao.LaunchPermissionDaoImpl"/>
|
<dao name="Launch Permission" class="com.cloud.storage.dao.LaunchPermissionDaoImpl"/>
|
||||||
@ -101,7 +102,6 @@
|
|||||||
<dao name="Management Server Host" class="com.cloud.cluster.dao.ManagementServerHostDaoImpl"/>
|
<dao name="Management Server Host" class="com.cloud.cluster.dao.ManagementServerHostDaoImpl"/>
|
||||||
<dao name="Snapshot" class="com.cloud.storage.dao.SnapshotDaoImpl"/>
|
<dao name="Snapshot" class="com.cloud.storage.dao.SnapshotDaoImpl"/>
|
||||||
<dao name="SnapshotPolicyDao" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl"/>
|
<dao name="SnapshotPolicyDao" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl"/>
|
||||||
<dao name="SnapshotPolicyRefDao" class="com.cloud.storage.dao.SnapshotPolicyRefDaoImpl"/>
|
|
||||||
<dao name="SnapshotScheduleDao" class="com.cloud.storage.dao.SnapshotScheduleDaoImpl"/>
|
<dao name="SnapshotScheduleDao" class="com.cloud.storage.dao.SnapshotScheduleDaoImpl"/>
|
||||||
<dao name="AsyncJobDao" class="com.cloud.async.dao.AsyncJobDaoImpl"/>
|
<dao name="AsyncJobDao" class="com.cloud.async.dao.AsyncJobDaoImpl"/>
|
||||||
<dao name="SyncQueueDao" class="com.cloud.async.dao.SyncQueueDaoImpl"/>
|
<dao name="SyncQueueDao" class="com.cloud.async.dao.SyncQueueDaoImpl"/>
|
||||||
|
|||||||
@ -522,6 +522,9 @@ fi
|
|||||||
%files python
|
%files python
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_prefix}/lib*/python*/site-packages/%{name}*
|
%{_prefix}/lib*/python*/site-packages/%{name}*
|
||||||
|
%attr(0755,root,root) %{_bindir}/cloud-external-ipallocator.py
|
||||||
|
%attr(0755,root,root) %{_initrddir}/cloud-ipallocator
|
||||||
|
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/ipallocator
|
||||||
|
|
||||||
%files setup
|
%files setup
|
||||||
%attr(0755,root,root) %{_bindir}/%{name}-setup-databases
|
%attr(0755,root,root) %{_bindir}/%{name}-setup-databases
|
||||||
@ -532,6 +535,7 @@ fi
|
|||||||
%{_datadir}/%{name}/setup/create-schema.sql
|
%{_datadir}/%{name}/setup/create-schema.sql
|
||||||
%{_datadir}/%{name}/setup/server-setup.sql
|
%{_datadir}/%{name}/setup/server-setup.sql
|
||||||
%{_datadir}/%{name}/setup/templates.*.sql
|
%{_datadir}/%{name}/setup/templates.*.sql
|
||||||
|
%{_datadir}/%{name}/setup/templates.sql
|
||||||
%{_datadir}/%{name}/setup/deploy-db-dev.sh
|
%{_datadir}/%{name}/setup/deploy-db-dev.sh
|
||||||
%{_datadir}/%{name}/setup/server-setup.xml
|
%{_datadir}/%{name}/setup/server-setup.xml
|
||||||
%{_datadir}/%{name}/setup/data-20to21.sql
|
%{_datadir}/%{name}/setup/data-20to21.sql
|
||||||
@ -602,6 +606,7 @@ fi
|
|||||||
%attr(0755,root,root) %{_bindir}/%{name}-setup-agent
|
%attr(0755,root,root) %{_bindir}/%{name}-setup-agent
|
||||||
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/agent
|
%dir %attr(770,root,root) %{_localstatedir}/log/%{name}/agent
|
||||||
|
|
||||||
|
|
||||||
%files console-proxy
|
%files console-proxy
|
||||||
%defattr(0644,root,root,0755)
|
%defattr(0644,root,root,0755)
|
||||||
%{_javadir}/%{name}-console*.jar
|
%{_javadir}/%{name}-console*.jar
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
instance=ConsoleProxy
|
instance=ConsoleProxy
|
||||||
consoleproxy.httpListenPort=8002
|
consoleproxy.httpListenPort=8002
|
||||||
|
public.ip=65.19.181.3
|
||||||
|
|
||||||
#resource= the java class, which agent load to execute
|
#resource= the java class, which agent load to execute
|
||||||
resource=com.cloud.agent.resource.consoleproxy.ConsoleProxyResource
|
resource=com.cloud.agent.resource.consoleproxy.ConsoleProxyResource
|
||||||
|
|||||||
@ -14,12 +14,9 @@ do
|
|||||||
CP=${CP}:$file
|
CP=${CP}:$file
|
||||||
done
|
done
|
||||||
keyvalues=
|
keyvalues=
|
||||||
if [ -f /mnt/cmdline ]
|
|
||||||
then
|
CMDLINE=$(cat /var/cache/cloud/cmdline)
|
||||||
CMDLINE=$(cat /mnt/cmdline)
|
|
||||||
else
|
|
||||||
CMDLINE=$(cat /proc/cmdline)
|
|
||||||
fi
|
|
||||||
#CMDLINE="graphical utf8 eth0ip=0.0.0.0 eth0mask=255.255.255.0 eth1ip=192.168.140.40 eth1mask=255.255.255.0 eth2ip=172.24.0.50 eth2mask=255.255.0.0 gateway=172.24.0.1 dns1=72.52.126.11 template=domP dns2=72.52.126.12 host=192.168.1.142 port=8250 mgmtcidr=192.168.1.0/24 localgw=192.168.140.1 zone=5 pod=5"
|
#CMDLINE="graphical utf8 eth0ip=0.0.0.0 eth0mask=255.255.255.0 eth1ip=192.168.140.40 eth1mask=255.255.255.0 eth2ip=172.24.0.50 eth2mask=255.255.0.0 gateway=172.24.0.1 dns1=72.52.126.11 template=domP dns2=72.52.126.12 host=192.168.1.142 port=8250 mgmtcidr=192.168.1.0/24 localgw=192.168.140.1 zone=5 pod=5"
|
||||||
for i in $CMDLINE
|
for i in $CMDLINE
|
||||||
do
|
do
|
||||||
|
|||||||
@ -180,14 +180,14 @@ public class ConsoleProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean authenticateConsoleAccess(String vmId, String sid) {
|
public static boolean authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket) {
|
||||||
if(standaloneStart)
|
if(standaloneStart)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(authMethod != null) {
|
if(authMethod != null) {
|
||||||
Object result;
|
Object result;
|
||||||
try {
|
try {
|
||||||
result = authMethod.invoke(ConsoleProxy.context, vmId, sid);
|
result = authMethod.invoke(ConsoleProxy.context, host, port, vmId, sid, ticket);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
s_logger.error("Unable to invoke authenticateConsoleAccess due to IllegalAccessException" + " for vm: " + vmId, e);
|
s_logger.error("Unable to invoke authenticateConsoleAccess due to IllegalAccessException" + " for vm: " + vmId, e);
|
||||||
return false;
|
return false;
|
||||||
@ -252,7 +252,7 @@ public class ConsoleProxy {
|
|||||||
ConsoleProxy.context = context;
|
ConsoleProxy.context = context;
|
||||||
try {
|
try {
|
||||||
Class<?> contextClazz = Class.forName("com.cloud.agent.resource.consoleproxy.ConsoleProxyResource");
|
Class<?> contextClazz = Class.forName("com.cloud.agent.resource.consoleproxy.ConsoleProxyResource");
|
||||||
authMethod = contextClazz.getDeclaredMethod("authenticateConsoleAccess", String.class, String.class);
|
authMethod = contextClazz.getDeclaredMethod("authenticateConsoleAccess", String.class, String.class, String.class, String.class, String.class);
|
||||||
reportMethod = contextClazz.getDeclaredMethod("reportLoadInfo", String.class);
|
reportMethod = contextClazz.getDeclaredMethod("reportLoadInfo", String.class);
|
||||||
ensureRouteMethod = contextClazz.getDeclaredMethod("ensureRoute", String.class);
|
ensureRouteMethod = contextClazz.getDeclaredMethod("ensureRoute", String.class);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
@ -419,8 +419,8 @@ public class ConsoleProxy {
|
|||||||
return viewer;
|
return viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initViewer(ConsoleProxyViewer viewer, String host, int port, String tag, String sid) throws AuthenticationException {
|
static void initViewer(ConsoleProxyViewer viewer, String host, int port, String tag, String sid, String ticket) throws AuthenticationException {
|
||||||
ConsoleProxyViewer.authenticationExternally(tag, sid);
|
ConsoleProxyViewer.authenticationExternally(host, String.valueOf(port), tag, sid, ticket);
|
||||||
|
|
||||||
viewer.host = host;
|
viewer.host = host;
|
||||||
viewer.port = port;
|
viewer.port = port;
|
||||||
@ -430,7 +430,7 @@ public class ConsoleProxy {
|
|||||||
viewer.init();
|
viewer.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConsoleProxyViewer getVncViewer(String host, int port, String sid, String tag) throws Exception {
|
static ConsoleProxyViewer getVncViewer(String host, int port, String sid, String tag, String ticket) throws Exception {
|
||||||
ConsoleProxyViewer viewer = null;
|
ConsoleProxyViewer viewer = null;
|
||||||
|
|
||||||
boolean reportLoadChange = false;
|
boolean reportLoadChange = false;
|
||||||
@ -438,7 +438,7 @@ public class ConsoleProxy {
|
|||||||
viewer = connectionMap.get(host + ":" + port);
|
viewer = connectionMap.get(host + ":" + port);
|
||||||
if (viewer == null) {
|
if (viewer == null) {
|
||||||
viewer = createViewer();
|
viewer = createViewer();
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
connectionMap.put(host + ":" + port, viewer);
|
connectionMap.put(host + ":" + port, viewer);
|
||||||
s_logger.info("Added viewer object " + viewer);
|
s_logger.info("Added viewer object " + viewer);
|
||||||
|
|
||||||
@ -446,12 +446,12 @@ public class ConsoleProxy {
|
|||||||
} else if (!viewer.rfbThread.isAlive()) {
|
} else if (!viewer.rfbThread.isAlive()) {
|
||||||
s_logger.info("The rfb thread died, reinitializing the viewer " +
|
s_logger.info("The rfb thread died, reinitializing the viewer " +
|
||||||
viewer);
|
viewer);
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
|
|
||||||
reportLoadChange = true;
|
reportLoadChange = true;
|
||||||
} else if (!sid.equals(viewer.passwordParam)) {
|
} else if (!sid.equals(viewer.passwordParam)) {
|
||||||
s_logger.warn("Bad sid detected(VNC port may be reused). sid in session: " + viewer.passwordParam + ", sid in request: " + sid);
|
s_logger.warn("Bad sid detected(VNC port may be reused). sid in session: " + viewer.passwordParam + ", sid in request: " + sid);
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
|
|
||||||
reportLoadChange = true;
|
reportLoadChange = true;
|
||||||
|
|
||||||
@ -484,7 +484,7 @@ public class ConsoleProxy {
|
|||||||
return viewer;
|
return viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConsoleProxyViewer getAjaxVncViewer(String host, int port, String sid, String tag) throws Exception {
|
static ConsoleProxyViewer getAjaxVncViewer(String host, int port, String sid, String tag, String ticket, String ajaxSession) throws Exception {
|
||||||
boolean reportLoadChange = false;
|
boolean reportLoadChange = false;
|
||||||
synchronized (connectionMap) {
|
synchronized (connectionMap) {
|
||||||
ConsoleProxyViewer viewer = connectionMap.get(host + ":" + port);
|
ConsoleProxyViewer viewer = connectionMap.get(host + ":" + port);
|
||||||
@ -494,25 +494,29 @@ public class ConsoleProxy {
|
|||||||
viewer = createViewer();
|
viewer = createViewer();
|
||||||
viewer.ajaxViewer = true;
|
viewer.ajaxViewer = true;
|
||||||
|
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
connectionMap.put(host + ":" + port, viewer);
|
connectionMap.put(host + ":" + port, viewer);
|
||||||
s_logger.info("Added viewer object " + viewer);
|
s_logger.info("Added viewer object " + viewer);
|
||||||
reportLoadChange = true;
|
reportLoadChange = true;
|
||||||
} else if (!viewer.rfbThread.isAlive()) {
|
} else if (!viewer.rfbThread.isAlive()) {
|
||||||
s_logger.info("The rfb thread died, reinitializing the viewer " +
|
s_logger.info("The rfb thread died, reinitializing the viewer " +
|
||||||
viewer);
|
viewer);
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
reportLoadChange = true;
|
reportLoadChange = true;
|
||||||
} else if (!sid.equals(viewer.passwordParam)) {
|
} else if (!sid.equals(viewer.passwordParam)) {
|
||||||
s_logger.warn("Bad sid detected(VNC port may be reused). sid in session: " + viewer.passwordParam + ", sid in request: " + sid);
|
s_logger.warn("Bad sid detected(VNC port may be reused). sid in session: " + viewer.passwordParam + ", sid in request: " + sid);
|
||||||
initViewer(viewer, host, port, tag, sid);
|
initViewer(viewer, host, port, tag, sid, ticket);
|
||||||
reportLoadChange = true;
|
reportLoadChange = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
throw new AuthenticationException ("Cannot use the existing viewer " +
|
throw new AuthenticationException ("Cannot use the existing viewer " +
|
||||||
viewer + ": bad sid");
|
viewer + ": bad sid");
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
|
if(ajaxSession == null || ajaxSession.isEmpty())
|
||||||
|
ConsoleProxyViewer.authenticationExternally(host, String.valueOf(port), tag, sid, ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewer.status == ConsoleProxyViewer.STATUS_NORMAL_OPERATION) {
|
if (viewer.status == ConsoleProxyViewer.STATUS_NORMAL_OPERATION) {
|
||||||
// Do not update lastUsedTime if the viewer is in the process of starting up
|
// Do not update lastUsedTime if the viewer is in the process of starting up
|
||||||
// or if it failed to authenticate.
|
// or if it failed to authenticate.
|
||||||
|
|||||||
@ -72,7 +72,8 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
|
|||||||
String host = queryMap.get("host");
|
String host = queryMap.get("host");
|
||||||
String portStr = queryMap.get("port");
|
String portStr = queryMap.get("port");
|
||||||
String sid = queryMap.get("sid");
|
String sid = queryMap.get("sid");
|
||||||
String tag = queryMap.get("tag");
|
String tag = queryMap.get("tag");
|
||||||
|
String ticket = queryMap.get("ticket");
|
||||||
String ajaxSessionIdStr = queryMap.get("sess");
|
String ajaxSessionIdStr = queryMap.get("sess");
|
||||||
String eventStr = queryMap.get("event");
|
String eventStr = queryMap.get("event");
|
||||||
if(tag == null)
|
if(tag == null)
|
||||||
@ -113,7 +114,7 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
|
|||||||
|
|
||||||
ConsoleProxyViewer viewer = null;
|
ConsoleProxyViewer viewer = null;
|
||||||
try {
|
try {
|
||||||
viewer = ConsoleProxy.getAjaxVncViewer(host, port, sid, tag);
|
viewer = ConsoleProxy.getAjaxVncViewer(host, port, sid, tag, ticket, ajaxSessionIdStr);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -62,7 +62,8 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler {
|
|||||||
String host = queryMap.get("host");
|
String host = queryMap.get("host");
|
||||||
String portStr = queryMap.get("port");
|
String portStr = queryMap.get("port");
|
||||||
String sid = queryMap.get("sid");
|
String sid = queryMap.get("sid");
|
||||||
String tag = queryMap.get("tag");
|
String tag = queryMap.get("tag");
|
||||||
|
String ticket = queryMap.get("ticket");
|
||||||
String keyStr = queryMap.get("key");
|
String keyStr = queryMap.get("key");
|
||||||
int key = 0;
|
int key = 0;
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ public class ConsoleProxyAjaxImageHandler implements HttpHandler {
|
|||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, tag);
|
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, tag, ticket);
|
||||||
byte[] img = viewer.getAjaxImageCache().getImage(key);
|
byte[] img = viewer.getAjaxImageCache().getImage(key);
|
||||||
if(img != null) {
|
if(img != null) {
|
||||||
Headers hds = t.getResponseHeaders();
|
Headers hds = t.getResponseHeaders();
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public class ConsoleProxyClientHandler extends Thread {
|
|||||||
String host = stk.nextToken();
|
String host = stk.nextToken();
|
||||||
int port = Integer.parseInt(stk.nextToken());
|
int port = Integer.parseInt(stk.nextToken());
|
||||||
String sid = stk.nextToken();
|
String sid = stk.nextToken();
|
||||||
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, "");
|
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, "", "");
|
||||||
|
|
||||||
ConsoleProxy.waitForViewerToStart(viewer);
|
ConsoleProxy.waitForViewerToStart(viewer);
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,8 @@ public class ConsoleProxyThumbnailHandler implements HttpHandler {
|
|||||||
String host = queryMap.get("host");
|
String host = queryMap.get("host");
|
||||||
String portStr = queryMap.get("port");
|
String portStr = queryMap.get("port");
|
||||||
String sid = queryMap.get("sid");
|
String sid = queryMap.get("sid");
|
||||||
String tag = queryMap.get("tag");
|
String tag = queryMap.get("tag");
|
||||||
|
String ticket = queryMap.get("ticket");
|
||||||
if(tag == null)
|
if(tag == null)
|
||||||
tag = "";
|
tag = "";
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ public class ConsoleProxyThumbnailHandler implements HttpHandler {
|
|||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, tag);
|
ConsoleProxyViewer viewer = ConsoleProxy.getVncViewer(host, port, sid, tag, ticket);
|
||||||
|
|
||||||
if (viewer.status != ConsoleProxyViewer.STATUS_NORMAL_OPERATION) {
|
if (viewer.status != ConsoleProxyViewer.STATUS_NORMAL_OPERATION) {
|
||||||
// use generated image instead of static
|
// use generated image instead of static
|
||||||
|
|||||||
@ -315,7 +315,7 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void authenticationExternally(String tag, String sid) throws AuthenticationException {
|
static void authenticationExternally(String host, String port, String tag, String sid, String ticket) throws AuthenticationException {
|
||||||
/*
|
/*
|
||||||
if(ConsoleProxy.management_host != null) {
|
if(ConsoleProxy.management_host != null) {
|
||||||
try {
|
try {
|
||||||
@ -352,7 +352,7 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
|
|||||||
s_logger.warn("No external authentication source being setup.");
|
s_logger.warn("No external authentication source being setup.");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if(!ConsoleProxy.authenticateConsoleAccess(tag, sid)) {
|
if(!ConsoleProxy.authenticateConsoleAccess(host, port, tag, sid, ticket)) {
|
||||||
s_logger.warn("External authenticator failed authencation request for vm " + tag + " with sid " + sid);
|
s_logger.warn("External authenticator failed authencation request for vm " + tag + " with sid " + sid);
|
||||||
|
|
||||||
throw new AuthenticationException("External authenticator failed request for vm " + tag + " with sid " + sid);
|
throw new AuthenticationException("External authenticator failed request for vm " + tag + " with sid " + sid);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ package com.cloud.agent.api;
|
|||||||
public class AttachIsoCommand extends Command {
|
public class AttachIsoCommand extends Command {
|
||||||
|
|
||||||
private String vmName;
|
private String vmName;
|
||||||
|
private String storeUrl;
|
||||||
private String isoPath;
|
private String isoPath;
|
||||||
private boolean attach;
|
private boolean attach;
|
||||||
|
|
||||||
@ -49,4 +50,12 @@ public class AttachIsoCommand extends Command {
|
|||||||
public boolean isAttach() {
|
public boolean isAttach() {
|
||||||
return attach;
|
return attach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStoreUrl() {
|
||||||
|
return storeUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreUrl(String url) {
|
||||||
|
storeUrl = url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public class AttachVolumeCommand extends Command {
|
|||||||
boolean attach;
|
boolean attach;
|
||||||
String vmName;
|
String vmName;
|
||||||
StoragePoolType pooltype;
|
StoragePoolType pooltype;
|
||||||
|
String poolUuid;
|
||||||
String volumeFolder;
|
String volumeFolder;
|
||||||
String volumePath;
|
String volumePath;
|
||||||
String volumeName;
|
String volumeName;
|
||||||
@ -83,5 +84,12 @@ public class AttachVolumeCommand extends Command {
|
|||||||
public void setDeviceId(Long deviceId) {
|
public void setDeviceId(Long deviceId) {
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPoolUuid() {
|
||||||
|
return poolUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoolUuid(String poolUuid) {
|
||||||
|
this.poolUuid = poolUuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ package com.cloud.agent.api;
|
|||||||
public class BackupSnapshotCommand extends SnapshotCommand {
|
public class BackupSnapshotCommand extends SnapshotCommand {
|
||||||
private String prevSnapshotUuid;
|
private String prevSnapshotUuid;
|
||||||
private String prevBackupUuid;
|
private String prevBackupUuid;
|
||||||
private boolean isFirstSnapshotOfRootVolume;
|
|
||||||
private boolean isVolumeInactive;
|
private boolean isVolumeInactive;
|
||||||
private String firstBackupUuid;
|
private String firstBackupUuid;
|
||||||
private String vmName;
|
private String vmName;
|
||||||
@ -56,7 +55,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
String prevSnapshotUuid,
|
String prevSnapshotUuid,
|
||||||
String prevBackupUuid,
|
String prevBackupUuid,
|
||||||
String firstBackupUuid,
|
String firstBackupUuid,
|
||||||
boolean isFirstSnapshotOfRootVolume,
|
|
||||||
boolean isVolumeInactive,
|
boolean isVolumeInactive,
|
||||||
String vmName)
|
String vmName)
|
||||||
{
|
{
|
||||||
@ -64,7 +62,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
this.prevSnapshotUuid = prevSnapshotUuid;
|
this.prevSnapshotUuid = prevSnapshotUuid;
|
||||||
this.prevBackupUuid = prevBackupUuid;
|
this.prevBackupUuid = prevBackupUuid;
|
||||||
this.firstBackupUuid = firstBackupUuid;
|
this.firstBackupUuid = firstBackupUuid;
|
||||||
this.isFirstSnapshotOfRootVolume = isFirstSnapshotOfRootVolume;
|
|
||||||
this.isVolumeInactive = isVolumeInactive;
|
this.isVolumeInactive = isVolumeInactive;
|
||||||
this.vmName = vmName;
|
this.vmName = vmName;
|
||||||
}
|
}
|
||||||
@ -81,10 +78,6 @@ public class BackupSnapshotCommand extends SnapshotCommand {
|
|||||||
return firstBackupUuid;
|
return firstBackupUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFirstSnapshotOfRootVolume() {
|
|
||||||
return isFirstSnapshotOfRootVolume;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVolumeInactive() {
|
public boolean isVolumeInactive() {
|
||||||
return isVolumeInactive;
|
return isVolumeInactive;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,17 +19,31 @@
|
|||||||
package com.cloud.agent.api;
|
package com.cloud.agent.api;
|
||||||
|
|
||||||
public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
|
public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
|
||||||
|
|
||||||
|
private String _host;
|
||||||
|
private String _port;
|
||||||
private String _vmId;
|
private String _vmId;
|
||||||
private String _sid;
|
private String _sid;
|
||||||
|
private String _ticket;
|
||||||
|
|
||||||
public ConsoleAccessAuthenticationCommand() {
|
public ConsoleAccessAuthenticationCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsoleAccessAuthenticationCommand(String vmId, String sid) {
|
public ConsoleAccessAuthenticationCommand(String host, String port, String vmId, String sid, String ticket) {
|
||||||
|
_host = host;
|
||||||
|
_port = port;
|
||||||
_vmId = vmId;
|
_vmId = vmId;
|
||||||
_sid = sid;
|
_sid = sid;
|
||||||
|
_ticket = ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return _host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPort() {
|
||||||
|
return _port;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVmId() {
|
public String getVmId() {
|
||||||
return _vmId;
|
return _vmId;
|
||||||
@ -37,5 +51,9 @@ public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
|
|||||||
|
|
||||||
public String getSid() {
|
public String getSid() {
|
||||||
return _sid;
|
return _sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTicket() {
|
||||||
|
return _ticket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cloud.agent.api;
|
||||||
|
|
||||||
|
public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
|
||||||
|
private String _volumePath;
|
||||||
|
private String _userSpecifiedName;
|
||||||
|
private String _uniqueName;
|
||||||
|
private long _templateId;
|
||||||
|
private long _accountId;
|
||||||
|
// For XenServer
|
||||||
|
private String _secondaryStorageURL;
|
||||||
|
|
||||||
|
|
||||||
|
public CreatePrivateTemplateFromVolumeCommand() {}
|
||||||
|
|
||||||
|
public CreatePrivateTemplateFromVolumeCommand(String secondaryStorageURL, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath) {
|
||||||
|
_secondaryStorageURL = secondaryStorageURL;
|
||||||
|
_templateId = templateId;
|
||||||
|
_accountId = accountId;
|
||||||
|
_userSpecifiedName = userSpecifiedName;
|
||||||
|
_uniqueName = uniqueName;
|
||||||
|
_volumePath = volumePath;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean executeInSequence() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSecondaryStorageURL() {
|
||||||
|
return _secondaryStorageURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplateName() {
|
||||||
|
return _userSpecifiedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUniqueName() {
|
||||||
|
return _uniqueName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTemplateId() {
|
||||||
|
return _templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolumePath(String _volumePath) {
|
||||||
|
this._volumePath = _volumePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVolumePath() {
|
||||||
|
return _volumePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAccountId() {
|
||||||
|
return _accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemplateId(long templateId) {
|
||||||
|
_templateId = templateId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,7 +22,6 @@ package com.cloud.agent.api;
|
|||||||
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
|
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
|
||||||
*/
|
*/
|
||||||
public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
|
public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
|
||||||
private String templatePath;
|
|
||||||
|
|
||||||
protected CreateVolumeFromSnapshotCommand() {
|
protected CreateVolumeFromSnapshotCommand() {
|
||||||
|
|
||||||
@ -51,18 +50,9 @@ public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
|
|||||||
Long accountId,
|
Long accountId,
|
||||||
Long volumeId,
|
Long volumeId,
|
||||||
String backedUpSnapshotUuid,
|
String backedUpSnapshotUuid,
|
||||||
String backedUpSnapshotName,
|
String backedUpSnapshotName)
|
||||||
String templatePath)
|
|
||||||
{
|
{
|
||||||
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
|
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
|
||||||
this.templatePath = templatePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the templatePath
|
|
||||||
*/
|
|
||||||
public String getTemplatePath() {
|
|
||||||
return templatePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -22,8 +22,7 @@ package com.cloud.agent.api;
|
|||||||
* This currently assumes that the secondary storage are mounted on the XenServer.
|
* This currently assumes that the secondary storage are mounted on the XenServer.
|
||||||
*/
|
*/
|
||||||
public class DeleteSnapshotBackupCommand extends SnapshotCommand {
|
public class DeleteSnapshotBackupCommand extends SnapshotCommand {
|
||||||
private String childUUID;
|
|
||||||
|
|
||||||
protected DeleteSnapshotBackupCommand() {
|
protected DeleteSnapshotBackupCommand() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,18 +58,8 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
|
|||||||
Long accountId,
|
Long accountId,
|
||||||
Long volumeId,
|
Long volumeId,
|
||||||
String backupUUID,
|
String backupUUID,
|
||||||
String backupName,
|
String backupName)
|
||||||
String childUUID)
|
|
||||||
{
|
{
|
||||||
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backupUUID, backupName, dcId, accountId, volumeId);
|
super(primaryStoragePoolNameLabel, secondaryStoragePoolURL, backupUUID, backupName, dcId, accountId, volumeId);
|
||||||
this.childUUID = childUUID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the childUUID
|
|
||||||
*/
|
|
||||||
public String getChildUUID() {
|
|
||||||
return childUUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -38,19 +38,21 @@ public class ManageSnapshotCommand extends Command {
|
|||||||
|
|
||||||
public ManageSnapshotCommand() {}
|
public ManageSnapshotCommand() {}
|
||||||
|
|
||||||
public ManageSnapshotCommand(String commandSwitch, long snapshotId, String path, String snapshotName, String vmName) {
|
public ManageSnapshotCommand(long snapshotId, String volumePath, String preSnapshotPath ,String snapshotName, String vmName) {
|
||||||
_commandSwitch = commandSwitch;
|
_commandSwitch = ManageSnapshotCommand.CREATE_SNAPSHOT;
|
||||||
if (commandSwitch.equals(ManageSnapshotCommand.CREATE_SNAPSHOT)) {
|
_volumePath = volumePath;
|
||||||
_volumePath = path;
|
_snapshotPath = preSnapshotPath;
|
||||||
}
|
|
||||||
else if (commandSwitch.equals(ManageSnapshotCommand.DESTROY_SNAPSHOT)) {
|
|
||||||
_snapshotPath = path;
|
|
||||||
}
|
|
||||||
_snapshotName = snapshotName;
|
_snapshotName = snapshotName;
|
||||||
_snapshotId = snapshotId;
|
_snapshotId = snapshotId;
|
||||||
_vmName = vmName;
|
_vmName = vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ManageSnapshotCommand(long snapshotId, String snapshotPath) {
|
||||||
|
_commandSwitch = ManageSnapshotCommand.DESTROY_SNAPSHOT;
|
||||||
|
_snapshotPath = snapshotPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean executeInSequence() {
|
public boolean executeInSequence() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -20,20 +20,26 @@ package com.cloud.agent.api;
|
|||||||
|
|
||||||
public class NetworkUsageCommand extends Command {
|
public class NetworkUsageCommand extends Command {
|
||||||
private String privateIP;
|
private String privateIP;
|
||||||
|
private String domRName;
|
||||||
|
|
||||||
protected NetworkUsageCommand() {
|
protected NetworkUsageCommand() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkUsageCommand(String privateIP)
|
public NetworkUsageCommand(String privateIP, String domRName)
|
||||||
{
|
{
|
||||||
this.privateIP = privateIP;
|
this.privateIP = privateIP;
|
||||||
|
this.domRName = domRName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateIP() {
|
public String getPrivateIP() {
|
||||||
return privateIP;
|
return privateIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDomRName() {
|
||||||
|
return domRName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -12,51 +12,15 @@ public class Start2Command extends Command {
|
|||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
long id;
|
|
||||||
String guestIpAddress;
|
|
||||||
String gateway;
|
|
||||||
int ramSize;
|
|
||||||
String imagePath;
|
|
||||||
String guestNetworkId;
|
|
||||||
String guestMacAddress;
|
|
||||||
String vncPassword;
|
|
||||||
String externalVlan;
|
|
||||||
String externalMacAddress;
|
|
||||||
int utilization;
|
|
||||||
int cpuWeight;
|
|
||||||
int cpu;
|
|
||||||
int networkRateMbps;
|
|
||||||
int networkRateMulticastMbps;
|
|
||||||
String hostName;
|
|
||||||
String arch;
|
|
||||||
String isoPath;
|
|
||||||
boolean bootFromISO;
|
|
||||||
String guestOSDescription;
|
|
||||||
|
|
||||||
---->console proxy
|
|
||||||
private ConsoleProxyVO proxy;
|
|
||||||
private int proxyCmdPort;
|
|
||||||
private String vncPort;
|
|
||||||
private String urlPort;
|
|
||||||
private String mgmt_host;
|
|
||||||
private int mgmt_port;
|
|
||||||
private boolean sslEnabled;
|
|
||||||
|
|
||||||
----->abstract
|
|
||||||
protected String vmName;
|
|
||||||
protected String storageHosts[] = new String[2];
|
|
||||||
protected List<VolumeVO> volumes;
|
|
||||||
protected boolean mirroredVols = false;
|
|
||||||
protected BootloaderType bootloader = BootloaderType.PyGrub;
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean executeInSequence() {
|
public boolean executeInSequence() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Start2Command() {
|
protected Start2Command() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Start2Command(VirtualMachineTO vm) {
|
||||||
|
this.vm = vm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,14 +33,16 @@ public class StartConsoleProxyCommand extends AbstractStartCommand {
|
|||||||
private String urlPort;
|
private String urlPort;
|
||||||
private String mgmt_host;
|
private String mgmt_host;
|
||||||
private int mgmt_port;
|
private int mgmt_port;
|
||||||
private boolean sslEnabled;
|
private boolean sslEnabled;
|
||||||
|
private String guestOSDescription;
|
||||||
|
|
||||||
protected StartConsoleProxyCommand() {
|
protected StartConsoleProxyCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartConsoleProxyCommand(int networkRateMbps, int networkRateMulticastMbps, int proxyCmdPort,
|
public StartConsoleProxyCommand(int networkRateMbps, int networkRateMulticastMbps, int proxyCmdPort,
|
||||||
ConsoleProxyVO proxy, String vmName, String storageHost,
|
ConsoleProxyVO proxy, String vmName, String storageHost,
|
||||||
List<VolumeVO> vols, String vncPort, String urlPort, String mgmtHost, int mgmtPort, boolean sslEnabled) {
|
List<VolumeVO> vols, String vncPort, String urlPort, String mgmtHost, int mgmtPort,
|
||||||
|
boolean sslEnabled, String guestOSDescription) {
|
||||||
super(vmName, storageHost, vols);
|
super(vmName, storageHost, vols);
|
||||||
this.networkRateMbps = networkRateMbps;
|
this.networkRateMbps = networkRateMbps;
|
||||||
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
||||||
@ -50,7 +52,8 @@ public class StartConsoleProxyCommand extends AbstractStartCommand {
|
|||||||
this.urlPort = urlPort;
|
this.urlPort = urlPort;
|
||||||
this.mgmt_host = mgmtHost;
|
this.mgmt_host = mgmtHost;
|
||||||
this.mgmt_port = mgmtPort;
|
this.mgmt_port = mgmtPort;
|
||||||
this.sslEnabled = sslEnabled;
|
this.sslEnabled = sslEnabled;
|
||||||
|
this.guestOSDescription = guestOSDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,6 +69,10 @@ public class StartConsoleProxyCommand extends AbstractStartCommand {
|
|||||||
return networkRateMbps;
|
return networkRateMbps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuestOSDescription() {
|
||||||
|
return guestOSDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public int getNetworkRateMulticastMbps() {
|
public int getNetworkRateMulticastMbps() {
|
||||||
return networkRateMulticastMbps;
|
return networkRateMulticastMbps;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public class StartRouterCommand extends AbstractStartCommand {
|
|||||||
DomainRouterVO router;
|
DomainRouterVO router;
|
||||||
int networkRateMbps;
|
int networkRateMbps;
|
||||||
int networkRateMulticastMbps;
|
int networkRateMulticastMbps;
|
||||||
|
private String guestOSDescription;
|
||||||
|
|
||||||
protected StartRouterCommand() {
|
protected StartRouterCommand() {
|
||||||
super();
|
super();
|
||||||
@ -41,11 +42,13 @@ public class StartRouterCommand extends AbstractStartCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StartRouterCommand(DomainRouterVO router, int networkRateMbps, int networkRateMulticastMbps,
|
public StartRouterCommand(DomainRouterVO router, int networkRateMbps, int networkRateMulticastMbps,
|
||||||
String routerName, String[] storageIps, List<VolumeVO> vols, boolean mirroredVols) {
|
String routerName, String[] storageIps, List<VolumeVO> vols, boolean mirroredVols,
|
||||||
|
String guestOSDescription ) {
|
||||||
super(routerName, storageIps, vols, mirroredVols);
|
super(routerName, storageIps, vols, mirroredVols);
|
||||||
this.router = router;
|
this.router = router;
|
||||||
this.networkRateMbps = networkRateMbps;
|
this.networkRateMbps = networkRateMbps;
|
||||||
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
||||||
|
this.guestOSDescription = guestOSDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainRouter getRouter() {
|
public DomainRouter getRouter() {
|
||||||
@ -56,6 +59,10 @@ public class StartRouterCommand extends AbstractStartCommand {
|
|||||||
return networkRateMbps;
|
return networkRateMbps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuestOSDescription() {
|
||||||
|
return guestOSDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public int getNetworkRateMulticastMbps() {
|
public int getNetworkRateMulticastMbps() {
|
||||||
return networkRateMulticastMbps;
|
return networkRateMulticastMbps;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,14 +33,15 @@ public class StartSecStorageVmCommand extends AbstractStartCommand {
|
|||||||
private int proxyCmdPort;
|
private int proxyCmdPort;
|
||||||
private String mgmt_host;
|
private String mgmt_host;
|
||||||
private int mgmt_port;
|
private int mgmt_port;
|
||||||
private boolean sslCopy;
|
private boolean sslCopy;
|
||||||
|
private String guestOSDescription;
|
||||||
|
|
||||||
protected StartSecStorageVmCommand() {
|
protected StartSecStorageVmCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartSecStorageVmCommand(int networkRateMbps, int networkRateMulticastMbps, int proxyCmdPort,
|
public StartSecStorageVmCommand(int networkRateMbps, int networkRateMulticastMbps, int proxyCmdPort,
|
||||||
SecondaryStorageVmVO secStorageVm, String vmName, String storageHost,
|
SecondaryStorageVmVO secStorageVm, String vmName, String storageHost,
|
||||||
List<VolumeVO> vols, String mgmtHost, int mgmtPort, boolean sslCopy) {
|
List<VolumeVO> vols, String mgmtHost, int mgmtPort, boolean sslCopy, String guestOSDescription) {
|
||||||
super(vmName, storageHost, vols);
|
super(vmName, storageHost, vols);
|
||||||
this.networkRateMbps = networkRateMbps;
|
this.networkRateMbps = networkRateMbps;
|
||||||
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
this.networkRateMulticastMbps = networkRateMulticastMbps;
|
||||||
@ -49,7 +50,8 @@ public class StartSecStorageVmCommand extends AbstractStartCommand {
|
|||||||
|
|
||||||
this.mgmt_host = mgmtHost;
|
this.mgmt_host = mgmtHost;
|
||||||
this.mgmt_port = mgmtPort;
|
this.mgmt_port = mgmtPort;
|
||||||
this.sslCopy = sslCopy;
|
this.sslCopy = sslCopy;
|
||||||
|
this.guestOSDescription = guestOSDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,6 +67,10 @@ public class StartSecStorageVmCommand extends AbstractStartCommand {
|
|||||||
return networkRateMbps;
|
return networkRateMbps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuestOSDescription() {
|
||||||
|
return guestOSDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public int getNetworkRateMulticastMbps() {
|
public int getNetworkRateMulticastMbps() {
|
||||||
return networkRateMulticastMbps;
|
return networkRateMulticastMbps;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
import com.cloud.hypervisor.Hypervisor.Type;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy;
|
import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||||||
Map<String, State> vms;
|
Map<String, State> vms;
|
||||||
String caps;
|
String caps;
|
||||||
String pool;
|
String pool;
|
||||||
Hypervisor.Type hypervisorType;
|
HypervisorType hypervisorType;
|
||||||
Map<String, String> hostDetails; //stuff like host os, cpu capabilities
|
Map<String, String> hostDetails; //stuff like host os, cpu capabilities
|
||||||
|
|
||||||
public StartupRoutingCommand() {
|
public StartupRoutingCommand() {
|
||||||
@ -47,7 +47,7 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||||||
long memory,
|
long memory,
|
||||||
long dom0MinMemory,
|
long dom0MinMemory,
|
||||||
String caps,
|
String caps,
|
||||||
Hypervisor.Type hypervisorType,
|
HypervisorType hypervisorType,
|
||||||
RouterPrivateIpStrategy privIpStrategy,
|
RouterPrivateIpStrategy privIpStrategy,
|
||||||
Map<String, State> vms) {
|
Map<String, State> vms) {
|
||||||
this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, vms);
|
this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, vms);
|
||||||
@ -59,7 +59,7 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||||||
long memory,
|
long memory,
|
||||||
long dom0MinMemory,
|
long dom0MinMemory,
|
||||||
final String caps,
|
final String caps,
|
||||||
final Hypervisor.Type hypervisorType,
|
final HypervisorType hypervisorType,
|
||||||
|
|
||||||
final Map<String, String> hostDetails,
|
final Map<String, String> hostDetails,
|
||||||
Map<String, State> vms) {
|
Map<String, State> vms) {
|
||||||
@ -75,7 +75,7 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StartupRoutingCommand(int cpus2, long speed2, long memory2,
|
public StartupRoutingCommand(int cpus2, long speed2, long memory2,
|
||||||
long dom0MinMemory2, String caps2, Hypervisor.Type hypervisorType2,
|
long dom0MinMemory2, String caps2, HypervisorType hypervisorType2,
|
||||||
Map<String, State> vms2) {
|
Map<String, State> vms2) {
|
||||||
this(cpus2, speed2, memory2, dom0MinMemory2, caps2, hypervisorType2, new HashMap<String,String>(), vms2);
|
this(cpus2, speed2, memory2, dom0MinMemory2, caps2, hypervisorType2, new HashMap<String,String>(), vms2);
|
||||||
}
|
}
|
||||||
@ -136,11 +136,11 @@ public class StartupRoutingCommand extends StartupCommand {
|
|||||||
this.pool = pool;
|
this.pool = pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hypervisor.Type getHypervisorType() {
|
public HypervisorType getHypervisorType() {
|
||||||
return hypervisorType;
|
return hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHypervisorType(Hypervisor.Type hypervisorType) {
|
public void setHypervisorType(HypervisorType hypervisorType) {
|
||||||
this.hypervisorType = hypervisorType;
|
this.hypervisorType = hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,9 @@ public abstract class AbstractDownloadCommand extends StorageCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractDownloadCommand(String name, String url, ImageFormat format, long accountId) {
|
protected AbstractDownloadCommand(String name, String url, ImageFormat format, long accountId) {
|
||||||
|
assert(url != null);
|
||||||
|
url = url.replace('\\', '/');
|
||||||
|
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
@ -62,6 +65,8 @@ public abstract class AbstractDownloadCommand extends StorageCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUrl(String url) {
|
public void setUrl(String url) {
|
||||||
|
assert(url != null);
|
||||||
|
url = url.replace('\\', '/');
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,11 @@ public class CreatePrivateTemplateAnswer extends Answer {
|
|||||||
_uniqueName = uniqueName;
|
_uniqueName = uniqueName;
|
||||||
_format = format;
|
_format = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result) {
|
||||||
|
super(cmd, success, result);
|
||||||
|
}
|
||||||
|
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return _path;
|
return _path;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
package com.cloud.agent.api.storage;
|
package com.cloud.agent.api.storage;
|
||||||
|
|
||||||
import com.cloud.agent.api.to.VolumeTO;
|
import com.cloud.agent.api.to.VolumeTO;
|
||||||
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
@ -33,7 +34,7 @@ public class DestroyCommand extends StorageCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DestroyCommand(StoragePoolVO pool, VMTemplateStoragePoolVO templatePoolRef) {
|
public DestroyCommand(StoragePoolVO pool, VMTemplateStoragePoolVO templatePoolRef) {
|
||||||
this.volume = new VolumeTO(templatePoolRef, pool);
|
volume = new VolumeTO(templatePoolRef.getId(), null, Storage.StorageResourceType.STORAGE_POOL, pool.getPoolType(), null, pool.getPath(), templatePoolRef.getInstallPath(), templatePoolRef.getTemplateSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeTO getVolume() {
|
public VolumeTO getVolume() {
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.cloud.agent.api.to;
|
|
||||||
|
|
||||||
public class NicTO extends NetworkTO {
|
|
||||||
int deviceId;
|
|
||||||
Integer controlPort;
|
|
||||||
Integer networkRateMbps;
|
|
||||||
Integer networkRateMulticastMbps;
|
|
||||||
|
|
||||||
public NicTO() {
|
|
||||||
super();
|
|
||||||
controlPort = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceId(int deviceId) {
|
|
||||||
this.deviceId = deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDeviceId() {
|
|
||||||
return deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getControlPort() {
|
|
||||||
return controlPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getNetworkRateMbps() {
|
|
||||||
return networkRateMbps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getNetworkRateMulticastMbps() {
|
|
||||||
return networkRateMulticastMbps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -491,7 +491,7 @@ public class VirtualRoutingResource implements Manager {
|
|||||||
_startTimeout = NumbersUtil.parseInt(value, 360) * 1000;
|
_startTimeout = NumbersUtil.parseInt(value, 360) * 1000;
|
||||||
|
|
||||||
value = (String)params.get("ssh.sleep");
|
value = (String)params.get("ssh.sleep");
|
||||||
_sleep = NumbersUtil.parseInt(value, 5) * 1000;
|
_sleep = NumbersUtil.parseInt(value, 10) * 1000;
|
||||||
|
|
||||||
value = (String)params.get("ssh.retry");
|
value = (String)params.get("ssh.retry");
|
||||||
_retry = NumbersUtil.parseInt(value, 24);
|
_retry = NumbersUtil.parseInt(value, 24);
|
||||||
|
|||||||
@ -15,43 +15,42 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
package com.cloud.certificate;
|
||||||
|
|
||||||
package com.cloud.storage;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
@Entity
|
|
||||||
@Table(name="snapshot_policy_ref")
|
@Entity
|
||||||
public class SnapshotPolicyRefVO {
|
@Table(name="certificate")
|
||||||
|
public class CertificateVO {
|
||||||
@Column(name="snap_id")
|
|
||||||
long snapshotId;
|
public CertificateVO(String cert)
|
||||||
|
{
|
||||||
@Column(name="volume_id")
|
this.certificate = cert;
|
||||||
long volumeId;
|
}
|
||||||
|
|
||||||
@Column(name="policy_id")
|
@Id
|
||||||
long policyId;
|
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||||
|
@Column(name="id")
|
||||||
public SnapshotPolicyRefVO() { }
|
private Long id = null;
|
||||||
|
|
||||||
public SnapshotPolicyRefVO(long snapshotId, long volumeId, long policyId) {
|
@Column(name="certificate",length=65535)
|
||||||
this.snapshotId = snapshotId;
|
private String certificate;
|
||||||
this.volumeId = volumeId;
|
|
||||||
this.policyId = policyId;
|
public CertificateVO() {}
|
||||||
}
|
|
||||||
|
public Long getId() {
|
||||||
public long getSnapshotId() {
|
return id;
|
||||||
return snapshotId;
|
}
|
||||||
}
|
|
||||||
|
public String getCertificate() {
|
||||||
public long getVolumeId() {
|
return certificate;
|
||||||
return snapshotId;
|
}
|
||||||
}
|
public void setCertificate(String certificate) {
|
||||||
|
this.certificate = certificate;
|
||||||
public long getPolicyId() {
|
}
|
||||||
return policyId;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -16,20 +16,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cloud.storage.dao;
|
package com.cloud.certificate.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import com.cloud.certificate.CertificateVO;
|
||||||
|
|
||||||
import com.cloud.storage.SnapshotPolicyRefVO;
|
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
public interface SnapshotPolicyRefDao extends GenericDao<SnapshotPolicyRefVO, Long> {
|
public interface CertificateDao extends GenericDao<CertificateVO, Long> {
|
||||||
|
public boolean persistCustomCertToDb(String certPath);
|
||||||
SnapshotPolicyRefVO findBySnapPolicy(long snapshotId, long policyId);
|
}
|
||||||
|
|
||||||
int removeSnapPolicy(long snapshotId, long policyId);
|
|
||||||
|
|
||||||
List<SnapshotPolicyRefVO> listByPolicyId(long policyId, long volumeId);
|
|
||||||
|
|
||||||
List<SnapshotPolicyRefVO> listBySnapshotId(long snapshotId);
|
|
||||||
}
|
|
||||||
51
core/src/com/cloud/certificate/dao/CertificateDaoImpl.java
Normal file
51
core/src/com/cloud/certificate/dao/CertificateDaoImpl.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package com.cloud.certificate.dao;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.certificate.CertificateVO;
|
||||||
|
import com.cloud.utils.db.DB;
|
||||||
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
|
|
||||||
|
@Local(value={CertificateDao.class}) @DB(txn=false)
|
||||||
|
public class CertificateDaoImpl extends GenericDaoBase<CertificateVO, Long> implements CertificateDao {
|
||||||
|
|
||||||
|
private static final Logger s_logger = Logger.getLogger(CertificateDaoImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean persistCustomCertToDb(String certPath){
|
||||||
|
|
||||||
|
String certStr = null;
|
||||||
|
byte[] buffer = new byte[(int) new File(certPath).length()];
|
||||||
|
BufferedInputStream f = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
f = new BufferedInputStream(new FileInputStream(certPath));
|
||||||
|
f.read(buffer);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
s_logger.warn("Unable to read the certificate: "+e);
|
||||||
|
return false;
|
||||||
|
} catch (IOException e) {
|
||||||
|
s_logger.warn("Unable to read the certificate: "+e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (f != null)
|
||||||
|
try { f.close(); } catch (IOException ignored) { }
|
||||||
|
}
|
||||||
|
certStr = new String(buffer);
|
||||||
|
|
||||||
|
CertificateVO certRec = new CertificateVO(certStr);
|
||||||
|
this.persist(certRec);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -133,12 +133,8 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationVO config = configurations.get(0);
|
ConfigurationVO config = configurations.get(0);
|
||||||
String value = config.getValue();
|
String value = config.getValue();
|
||||||
|
return value;
|
||||||
if (value == null) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import javax.persistence.GenerationType;
|
|||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.org.Cluster;
|
import com.cloud.org.Cluster;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
|
|
||||||
@ -45,6 +46,10 @@ public class ClusterVO implements Cluster {
|
|||||||
@Column(name="pod_id")
|
@Column(name="pod_id")
|
||||||
long podId;
|
long podId;
|
||||||
|
|
||||||
|
@Column(name="hypervisor_type")
|
||||||
|
String hypervisorType;
|
||||||
|
|
||||||
|
|
||||||
public ClusterVO() {
|
public ClusterVO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,4 +92,12 @@ public class ClusterVO implements Cluster {
|
|||||||
ClusterVO that = (ClusterVO)obj;
|
ClusterVO that = (ClusterVO)obj;
|
||||||
return this.id == that.id;
|
return this.id == that.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HypervisorType getHypervisorType() {
|
||||||
|
return HypervisorType.getType(hypervisorType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHypervisorType(String hy) {
|
||||||
|
hypervisorType = hy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||||||
try {
|
try {
|
||||||
txn.start();
|
txn.start();
|
||||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet);
|
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet);
|
||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i <= end; i++) {
|
||||||
stmt.setString(1, String.valueOf(i));
|
stmt.setString(1, String.valueOf(i));
|
||||||
stmt.setLong(2, dcId);
|
stmt.setLong(2, dcId);
|
||||||
stmt.addBatch();
|
stmt.addBatch();
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import javax.persistence.Temporal;
|
|||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class HostVO implements Host {
|
|||||||
|
|
||||||
@Column(name="hypervisor_type", updatable = true, nullable=false)
|
@Column(name="hypervisor_type", updatable = true, nullable=false)
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
private Hypervisor.Type hypervisorType;
|
private HypervisorType hypervisorType;
|
||||||
|
|
||||||
@Column(name="proxy_port")
|
@Column(name="proxy_port")
|
||||||
private Integer proxyPort;
|
private Integer proxyPort;
|
||||||
@ -617,12 +617,12 @@ public class HostVO implements Host {
|
|||||||
return new StringBuilder(type.toString()).append("-").append(Long.toString(id)).append("-").append(name).toString();
|
return new StringBuilder(type.toString()).append("-").append(Long.toString(id)).append("-").append(name).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHypervisorType(Hypervisor.Type hypervisorType) {
|
public void setHypervisorType(HypervisorType hypervisorType) {
|
||||||
this.hypervisorType = hypervisorType;
|
this.hypervisorType = hypervisorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Hypervisor.Type getHypervisorType() {
|
public HypervisorType getHypervisorType() {
|
||||||
return hypervisorType;
|
return hypervisorType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,4 +28,6 @@ public interface DetailsDao extends GenericDao<DetailVO, Long> {
|
|||||||
void persist(long hostId, Map<String, String> details);
|
void persist(long hostId, Map<String, String> details);
|
||||||
|
|
||||||
DetailVO findDetail(long hostId, String name);
|
DetailVO findDetail(long hostId, String name);
|
||||||
|
|
||||||
|
void deleteDetails(long hostId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,17 @@ public class DetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implements De
|
|||||||
}
|
}
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDetails(long hostId) {
|
||||||
|
SearchCriteria sc = HostSearch.create();
|
||||||
|
sc.setParameters("hostId", hostId);
|
||||||
|
|
||||||
|
List<DetailVO> results = search(sc, null);
|
||||||
|
for (DetailVO result : results) {
|
||||||
|
remove(result.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void persist(long hostId, Map<String, String> details) {
|
public void persist(long hostId, Map<String, String> details) {
|
||||||
|
|||||||
@ -35,7 +35,7 @@ import com.cloud.utils.db.GenericDao;
|
|||||||
public interface HostDao extends GenericDao<HostVO, Long> {
|
public interface HostDao extends GenericDao<HostVO, Long> {
|
||||||
List<HostVO> listBy(Host.Type type, Long clusterId, Long podId, long dcId);
|
List<HostVO> listBy(Host.Type type, Long clusterId, Long podId, long dcId);
|
||||||
|
|
||||||
long countBy(long podId, Status... statuses);
|
long countBy(long clusterId, Status... statuses);
|
||||||
|
|
||||||
List<HostVO> listByDataCenter(long dcId);
|
List<HostVO> listByDataCenter(long dcId);
|
||||||
List<HostVO> listByHostPod(long podId);
|
List<HostVO> listByHostPod(long podId);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||||||
protected final SearchBuilder<HostVO> SequenceSearch;
|
protected final SearchBuilder<HostVO> SequenceSearch;
|
||||||
protected final SearchBuilder<HostVO> DirectlyConnectedSearch;
|
protected final SearchBuilder<HostVO> DirectlyConnectedSearch;
|
||||||
protected final SearchBuilder<HostVO> UnmanagedDirectConnectSearch;
|
protected final SearchBuilder<HostVO> UnmanagedDirectConnectSearch;
|
||||||
protected final GenericSearchBuilder<HostVO, Long> MaintenanceCountSearch;
|
protected final SearchBuilder<HostVO> MaintenanceCountSearch;
|
||||||
protected final SearchBuilder<HostVO> ClusterSearch;
|
protected final SearchBuilder<HostVO> ClusterSearch;
|
||||||
|
|
||||||
protected final Attribute _statusAttr;
|
protected final Attribute _statusAttr;
|
||||||
@ -88,9 +88,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||||||
|
|
||||||
public HostDaoImpl() {
|
public HostDaoImpl() {
|
||||||
|
|
||||||
MaintenanceCountSearch = createSearchBuilder(Long.class);
|
MaintenanceCountSearch = createSearchBuilder();
|
||||||
MaintenanceCountSearch.and("pod", MaintenanceCountSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
MaintenanceCountSearch.and("cluster", MaintenanceCountSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||||
MaintenanceCountSearch.select(null, Func.COUNT, null);
|
|
||||||
MaintenanceCountSearch.and("status", MaintenanceCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
|
MaintenanceCountSearch.and("status", MaintenanceCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
|
||||||
MaintenanceCountSearch.done();
|
MaintenanceCountSearch.done();
|
||||||
|
|
||||||
@ -200,18 +199,14 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long countBy(long podId, Status... statuses) {
|
public long countBy(long clusterId, Status... statuses) {
|
||||||
SearchCriteria<Long> sc = MaintenanceCountSearch.create();
|
SearchCriteria<HostVO> sc = MaintenanceCountSearch.create();
|
||||||
|
|
||||||
sc.setParameters("status", (Object[])statuses);
|
sc.setParameters("status", (Object[])statuses);
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("cluster", clusterId);
|
||||||
|
|
||||||
List<Long> rs = searchIncludingRemoved(sc, null);
|
List<HostVO> hosts = listBy(sc);
|
||||||
if (rs.size() == 0) {
|
return hosts.size();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rs.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class KvmDummyResourceBase extends ServerResourceBase implements ServerRe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StartupCommand[] initialize() {
|
public StartupCommand[] initialize() {
|
||||||
StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.Type.KVM, new HashMap<String, String>(), new HashMap<String, State>());
|
StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.KVM, new HashMap<String, String>(), new HashMap<String, State>());
|
||||||
cmd.setDataCenter(_zoneId);
|
cmd.setDataCenter(_zoneId);
|
||||||
cmd.setPod(_podId);
|
cmd.setPod(_podId);
|
||||||
cmd.setCluster(_clusterId);
|
cmd.setCluster(_clusterId);
|
||||||
|
|||||||
@ -21,143 +21,157 @@ package com.cloud.hypervisor.xen.resource;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce bloat inside CitrixResourceBase
|
* Reduce bloat inside CitrixResourceBase
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CitrixHelper {
|
public class CitrixHelper {
|
||||||
private static final HashMap<String, String> _guestOsMap = new HashMap<String, String>(70);
|
private static final Logger s_logger = Logger.getLogger(CitrixHelper.class);
|
||||||
private static final ArrayList<String> _guestOsList = new ArrayList<String>(70);
|
private static final HashMap<String, String> _xcpGuestOsMap = new HashMap<String, String>(70);
|
||||||
|
private static final HashMap<String, String> _xenServerGuestOsMap = new HashMap<String, String>(70);
|
||||||
|
private static final ArrayList<String> _guestOsList = new ArrayList<String>(70);
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
_guestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5");
|
_xcpGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5");
|
||||||
_guestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6");
|
_xcpGuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6");
|
||||||
_guestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7");
|
_xcpGuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7");
|
||||||
_guestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8");
|
_xcpGuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8");
|
||||||
_guestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5.0");
|
_xcpGuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5.0");
|
||||||
_guestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5.0 x64");
|
_xcpGuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5.0 x64");
|
||||||
_guestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5.1");
|
_xcpGuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5.1");
|
||||||
_guestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5.1 x64");
|
_xcpGuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5.1 x64");
|
||||||
_guestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5.2");
|
_xcpGuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5.2");
|
||||||
_guestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5.2 x64");
|
_xcpGuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5.2 x64");
|
||||||
_guestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5.3");
|
_xcpGuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5.3");
|
||||||
_guestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5.3 x64");
|
_xcpGuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5.3 x64");
|
||||||
_guestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
|
_xcpGuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
|
||||||
_guestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5.4 x64");
|
_xcpGuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5.4 x64");
|
||||||
_guestOsMap.put("Debian Lenny 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
|
_xcpGuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5.0");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5.0");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5.0 x64");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5.0 x64");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5.1");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5.1");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5.1 x64");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5.1 x64");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5.2");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5.2");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5.2 x64");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5.2 x64");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5.3");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5.3");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5.3 x64");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5.3 x64");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5.4");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5.4");
|
||||||
_guestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5.4 x64");
|
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5.4 x64");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0 x64");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0 x64");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5.1 x64");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5.1 x64");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2 x64");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2 x64");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3 x64");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3 x64");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4");
|
||||||
_guestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4 x64");
|
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4 x64");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
|
||||||
_guestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
|
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
|
||||||
_guestOsMap.put("Windows 7 (32-bit)", "Windows 7");
|
_xcpGuestOsMap.put("Windows 7 (32-bit)", "Windows 7");
|
||||||
_guestOsMap.put("Windows 7 (64-bit)", "Windows 7 x64");
|
_xcpGuestOsMap.put("Windows 7 (64-bit)", "Windows 7 x64");
|
||||||
_guestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003");
|
_xcpGuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003");
|
||||||
_guestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 x64");
|
_xcpGuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 x64");
|
||||||
_guestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008");
|
_xcpGuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008");
|
||||||
_guestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 x64");
|
_xcpGuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 x64");
|
||||||
_guestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 x64");
|
_xcpGuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 x64");
|
||||||
_guestOsMap.put("Windows 2000 SP4 (32-bit)", "Windows 2000 SP4");
|
_xcpGuestOsMap.put("Windows 2000 SP4 (32-bit)", "Windows 2000 SP4");
|
||||||
_guestOsMap.put("Windows Vista (32-bit)", "Windows Vista");
|
_xcpGuestOsMap.put("Windows Vista (32-bit)", "Windows Vista");
|
||||||
_guestOsMap.put("Windows XP SP2 (32-bit)", "Windows XP SP2");
|
_xcpGuestOsMap.put("Windows XP SP2 (32-bit)", "Windows XP SP2");
|
||||||
_guestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3");
|
_xcpGuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3");
|
||||||
_guestOsMap.put("Other install media", "Other install media");
|
_xcpGuestOsMap.put("Other install media", "Other install media");
|
||||||
|
|
||||||
//access by index
|
|
||||||
_guestOsList.add("CentOS 4.5");
|
|
||||||
_guestOsList.add("CentOS 4.6");
|
|
||||||
_guestOsList.add("CentOS 4.7");
|
|
||||||
_guestOsList.add("CentOS 4.8");
|
|
||||||
_guestOsList.add("CentOS 5.0");
|
|
||||||
_guestOsList.add("CentOS 5.0 x64");
|
|
||||||
_guestOsList.add("CentOS 5.1");
|
|
||||||
_guestOsList.add("CentOS 5.1 x64");
|
|
||||||
_guestOsList.add("CentOS 5.2");
|
|
||||||
_guestOsList.add("CentOS 5.2 x64");
|
|
||||||
_guestOsList.add("CentOS 5.3");
|
|
||||||
_guestOsList.add("CentOS 5.3 x64");
|
|
||||||
_guestOsList.add("CentOS 5.4");
|
|
||||||
_guestOsList.add("CentOS 5.4 x64");
|
|
||||||
_guestOsList.add("Debian Lenny 5.0 (32-bit)");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.0");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.0 x64");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.1");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.1 x64");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.2");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.2 x64");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.3");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.3 x64");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.4");
|
|
||||||
_guestOsList.add("Oracle Enterprise Linux 5.4 x64");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 4.5");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 4.6");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 4.7");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 4.8");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.0");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.0 x64");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.1");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.1 x64");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.2");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.2 x64");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.3");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.3 x64");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.4");
|
|
||||||
_guestOsList.add("Red Hat Enterprise Linux 5.4 x64");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 9 SP4");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 10 SP1");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 10 SP1 x64");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 10 SP2");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 10 SP2 x64");
|
|
||||||
_guestOsList.add("Other install media");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 11");
|
|
||||||
_guestOsList.add("SUSE Linux Enterprise Server 11 x64");
|
|
||||||
_guestOsList.add("Windows 7");
|
|
||||||
_guestOsList.add("Windows 7 x64");
|
|
||||||
_guestOsList.add("Windows Server 2003");
|
|
||||||
_guestOsList.add("Windows Server 2003 x64");
|
|
||||||
_guestOsList.add("Windows Server 2008");
|
|
||||||
_guestOsList.add("Windows Server 2008 x64");
|
|
||||||
_guestOsList.add("Windows Server 2008 R2 x64");
|
|
||||||
_guestOsList.add("Windows 2000 SP4");
|
|
||||||
_guestOsList.add("Windows Vista");
|
|
||||||
_guestOsList.add("Windows XP SP2");
|
|
||||||
_guestOsList.add("Windows XP SP3");
|
|
||||||
_guestOsList.add("Other install media");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getGuestOsType(String stdType) {
|
static {
|
||||||
return _guestOsMap.get(stdType);
|
_xenServerGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5.0 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5.0 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5.1 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5.1 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5.2 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5.2 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5.3 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5.3 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5.4 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5.4 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5.0 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5.0 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5.1 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5.1 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5.2 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5.2 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5.3 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5.3 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5.4 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5.4 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5.1 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "SUSE Linux Enterprise Server 10 SP3 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows 2000 SP4 (32-bit)", "Windows 2000 SP4 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows XP SP2 (32-bit)", "Windows XP SP2 (32-bit)");
|
||||||
|
_xenServerGuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getGuestOsType(long guestOsId) {
|
public static String getXcpGuestOsType(String stdType) {
|
||||||
return _guestOsList.get((int) (guestOsId-1));
|
String guestOS = _xcpGuestOsMap.get(stdType);
|
||||||
|
if (guestOS == null) {
|
||||||
|
s_logger.debug("Can't find the guest os: " + stdType + " mapping into xenserver's guestOS type, start it as HVM guest");
|
||||||
|
guestOS = "Other install media";
|
||||||
|
}
|
||||||
|
return guestOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getXenServerGuestOsType(String stdType) {
|
||||||
|
String guestOS = _xenServerGuestOsMap.get(stdType);
|
||||||
|
if (guestOS == null) {
|
||||||
|
s_logger.debug("Can't find the guest os: " + stdType + " mapping into xenserver's guestOS type, start it as HVM guest");
|
||||||
|
guestOS = "Other install media";
|
||||||
|
}
|
||||||
|
return guestOS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -26,4 +26,9 @@ public class XcpServerResource extends CitrixResourceBase {
|
|||||||
public XcpServerResource() {
|
public XcpServerResource() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getGuestOsType(String stdType) {
|
||||||
|
return CitrixHelper.getXcpGuestOsType(stdType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class XenServerResource extends CitrixResourceBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getGuestOsType(String stdType) {
|
protected String getGuestOsType(String stdType) {
|
||||||
return stdType;
|
return CitrixHelper.getXenServerGuestOsType(stdType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -30,15 +30,22 @@ public class ConsoleProxyInfo {
|
|||||||
this.proxyUrlPort = proxyUrlPort;
|
this.proxyUrlPort = proxyUrlPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort) {
|
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort, String consoleProxyUrlDomain) {
|
||||||
this.sslEnabled = sslEnabled;
|
this.sslEnabled = sslEnabled;
|
||||||
|
|
||||||
if(sslEnabled) {
|
if(sslEnabled) {
|
||||||
StringBuffer sb = new StringBuffer(proxyIpAddress);
|
StringBuffer sb = new StringBuffer(proxyIpAddress);
|
||||||
for(int i = 0; i < sb.length(); i++)
|
for(int i = 0; i < sb.length(); i++)
|
||||||
if(sb.charAt(i) == '.')
|
if(sb.charAt(i) == '.')
|
||||||
sb.setCharAt(i, '-');
|
sb.setCharAt(i, '-');
|
||||||
sb.append(".realhostip.com");
|
if(consoleProxyUrlDomain!=null && consoleProxyUrlDomain.length()>0)
|
||||||
|
{
|
||||||
|
sb.append(".");
|
||||||
|
sb.append(consoleProxyUrlDomain);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sb.append(".realhostip.com");
|
||||||
|
|
||||||
proxyAddress = sb.toString();
|
proxyAddress = sb.toString();
|
||||||
proxyPort = port;
|
proxyPort = port;
|
||||||
this.proxyUrlPort = proxyUrlPort;
|
this.proxyUrlPort = proxyUrlPort;
|
||||||
|
|||||||
@ -39,7 +39,8 @@ public interface Snapshot {
|
|||||||
Creating,
|
Creating,
|
||||||
CreatedOnPrimary,
|
CreatedOnPrimary,
|
||||||
BackingUp,
|
BackingUp,
|
||||||
BackedUp;
|
BackedUp,
|
||||||
|
EmptySnapshot;
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name();
|
return this.name();
|
||||||
|
|||||||
@ -79,6 +79,10 @@ public class SnapshotPolicyVO {
|
|||||||
return schedule;
|
return schedule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInterval(short interval) {
|
||||||
|
this.interval = interval;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTimezone(String timezone) {
|
public void setTimezone(String timezone) {
|
||||||
this.timezone = timezone;
|
this.timezone = timezone;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,14 +77,22 @@ public class SnapshotScheduleVO {
|
|||||||
return policyId;
|
return policyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setPolicyId(long policyId) {
|
||||||
|
this.policyId = policyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @return the scheduledTimestamp
|
* @return the scheduledTimestamp
|
||||||
*/
|
*/
|
||||||
public Date getScheduledTimestamp() {
|
public Date getScheduledTimestamp() {
|
||||||
return scheduledTimestamp;
|
return scheduledTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getAsyncJobId() {
|
public void setScheduledTimestamp(Date scheduledTimestamp) {
|
||||||
|
this.scheduledTimestamp = scheduledTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAsyncJobId() {
|
||||||
return asyncJobId;
|
return asyncJobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,8 +54,8 @@ public class SnapshotVO implements Snapshot {
|
|||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
@Column(name="name")
|
@Column(name="name")
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
@Column(name="status", updatable = true, nullable=false)
|
@Column(name="status", updatable = true, nullable=false)
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
@ -71,7 +71,7 @@ public class SnapshotVO implements Snapshot {
|
|||||||
Date created;
|
Date created;
|
||||||
|
|
||||||
@Column(name=GenericDao.REMOVED_COLUMN)
|
@Column(name=GenericDao.REMOVED_COLUMN)
|
||||||
Date removed;
|
Date removed;
|
||||||
|
|
||||||
@Column(name="backup_snap_id")
|
@Column(name="backup_snap_id")
|
||||||
String backupSnapshotId;
|
String backupSnapshotId;
|
||||||
@ -88,7 +88,7 @@ public class SnapshotVO implements Snapshot {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.snapshotType = snapshotType;
|
this.snapshotType = snapshotType;
|
||||||
this.typeDescription = typeDescription;
|
this.typeDescription = typeDescription;
|
||||||
this.status = Status.Creating;
|
this.status = Status.Creating;
|
||||||
this.prevSnapshotId = 0;
|
this.prevSnapshotId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public class SnapshotVO implements Snapshot {
|
|||||||
return backupSnapshotId;
|
return backupSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPrevSnapshotId(){
|
public long getPrevSnapshotId(){
|
||||||
return prevSnapshotId;
|
return prevSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,13 +169,12 @@ public class SnapshotVO implements Snapshot {
|
|||||||
this.prevSnapshotId = prevSnapshotId;
|
this.prevSnapshotId = prevSnapshotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SnapshotType getSnapshotType(List<Long> policyIds) {
|
public static SnapshotType getSnapshotType(Long policyId) {
|
||||||
assert policyIds != null && !policyIds.isEmpty();
|
if (policyId.equals(MANUAL_POLICY_ID)) {
|
||||||
SnapshotType snapshotType = SnapshotType.RECURRING;
|
return SnapshotType.MANUAL;
|
||||||
if (policyIds.contains(MANUAL_POLICY_ID)) {
|
} else {
|
||||||
snapshotType = SnapshotType.MANUAL;
|
return SnapshotType.RECURRING;
|
||||||
}
|
}
|
||||||
return snapshotType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SnapshotType getSnapshotType(String snapshotType) {
|
public static SnapshotType getSnapshotType(String snapshotType) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
@Column(name="name", updatable=false, nullable=false, length=255)
|
@Column(name="name", updatable=false, nullable=false, length=255)
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
@Column(name="uuid", updatable=false, nullable=false, length=255)
|
@Column(name="uuid", length=255)
|
||||||
private String uuid = null;
|
private String uuid = null;
|
||||||
|
|
||||||
@Column(name="pool_type", updatable=false, nullable=false, length=32)
|
@Column(name="pool_type", updatable=false, nullable=false, length=32)
|
||||||
@ -82,7 +82,8 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
private Status status;
|
private Status status;
|
||||||
|
|
||||||
public long getId() {
|
@Override
|
||||||
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,19 +96,23 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
@Override
|
||||||
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUuid() {
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoragePoolType getPoolType() {
|
@Override
|
||||||
|
public StoragePoolType getPoolType() {
|
||||||
return poolType;
|
return poolType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
@Override
|
||||||
|
public Date getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,19 +120,23 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
@Override
|
||||||
|
public Date getUpdateTime() {
|
||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDataCenterId() {
|
@Override
|
||||||
|
public long getDataCenterId() {
|
||||||
return dataCenterId;
|
return dataCenterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAvailableBytes() {
|
@Override
|
||||||
|
public long getAvailableBytes() {
|
||||||
return availableBytes;
|
return availableBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCapacityBytes() {
|
@Override
|
||||||
|
public long getCapacityBytes() {
|
||||||
return capacityBytes;
|
return capacityBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,10 +169,12 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
this.clusterId = clusterId;
|
this.clusterId = clusterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getHostAddress() {
|
public String getHostAddress() {
|
||||||
return hostAddress;
|
return hostAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
@ -217,10 +228,12 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isShared() {
|
public boolean isShared() {
|
||||||
return poolType.isShared();
|
return poolType.isShared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLocal() {
|
public boolean isLocal() {
|
||||||
return !poolType.isShared();
|
return !poolType.isShared();
|
||||||
}
|
}
|
||||||
@ -252,6 +265,10 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInMaintenance() {
|
||||||
|
return status == Status.PrepareForMaintenance || status == Status.Maintenance || status == Status.ErrorInMaintenance || removed != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof StoragePoolVO) || obj == null) {
|
if (!(obj instanceof StoragePoolVO) || obj == null) {
|
||||||
|
|||||||
@ -32,8 +32,10 @@ import javax.persistence.Temporal;
|
|||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Storage.FileSystem;
|
import com.cloud.storage.Storage.FileSystem;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
@ -63,7 +65,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
private boolean featured;
|
private boolean featured;
|
||||||
|
|
||||||
@Column(name="type")
|
@Column(name="type")
|
||||||
private FileSystem fileSystem = null;
|
private Storage.TemplateType templateType;
|
||||||
|
|
||||||
@Column(name="url")
|
@Column(name="url")
|
||||||
private String url = null;
|
private String url = null;
|
||||||
@ -104,7 +106,11 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
private boolean prepopulate = false;
|
private boolean prepopulate = false;
|
||||||
|
|
||||||
@Column(name="cross_zones")
|
@Column(name="cross_zones")
|
||||||
private boolean crossZones = false;
|
private boolean crossZones = false;
|
||||||
|
|
||||||
|
@Column(name="hypervisor_type")
|
||||||
|
private String hypervisorType;
|
||||||
|
|
||||||
|
|
||||||
public String getUniqueName() {
|
public String getUniqueName() {
|
||||||
return uniqueName;
|
return uniqueName;
|
||||||
@ -120,16 +126,16 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
/**
|
/**
|
||||||
* Proper constructor for a new vm template.
|
* Proper constructor for a new vm template.
|
||||||
*/
|
*/
|
||||||
public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, FileSystem fs, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable) {
|
public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
|
||||||
this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, fs, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable);
|
this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, FileSystem fs, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable) {
|
public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.publicTemplate = isPublic;
|
this.publicTemplate = isPublic;
|
||||||
this.featured = featured;
|
this.featured = featured;
|
||||||
this.fileSystem = fs;
|
this.templateType = type;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.requiresHvm = requiresHvm;
|
this.requiresHvm = requiresHvm;
|
||||||
this.bits = bits;
|
this.bits = bits;
|
||||||
@ -141,7 +147,8 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
this.format = format;
|
this.format = format;
|
||||||
this.created = created;
|
this.created = created;
|
||||||
this.guestOSId = guestOSId;
|
this.guestOSId = guestOSId;
|
||||||
this.bootable = bootable;
|
this.bootable = bootable;
|
||||||
|
this.hypervisorType = hyperType.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getEnablePassword() {
|
public boolean getEnablePassword() {
|
||||||
@ -175,13 +182,12 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TemplateType getTemplateType() {
|
||||||
public FileSystem getFileSystem() {
|
return templateType;
|
||||||
return fileSystem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileSystem(FileSystem fs) {
|
public void setTemplateType(TemplateType type) {
|
||||||
this.fileSystem = fs;
|
this.templateType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean requiresHvm() {
|
public boolean requiresHvm() {
|
||||||
@ -289,6 +295,14 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
public boolean isCrossZones() {
|
public boolean isCrossZones() {
|
||||||
return crossZones;
|
return crossZones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HypervisorType getHypervisorType() {
|
||||||
|
return HypervisorType.getType(hypervisorType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHypervisorType(HypervisorType hyperType) {
|
||||||
|
hypervisorType = hyperType.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object that) {
|
public boolean equals(Object that) {
|
||||||
@ -299,8 +313,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
|||||||
}
|
}
|
||||||
VMTemplateVO other = (VMTemplateVO)that;
|
VMTemplateVO other = (VMTemplateVO)that;
|
||||||
|
|
||||||
return (this.getUniqueName().equals(other.getUniqueName()));
|
return ((this.getUniqueName().equals(other.getUniqueName())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -236,6 +236,8 @@ public class VolumeVO implements Volume {
|
|||||||
this.status = AsyncInstanceCreateStatus.Created;
|
this.status = AsyncInstanceCreateStatus.Created;
|
||||||
this.recreatable = false;
|
this.recreatable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isRecreatable() {
|
public boolean isRecreatable() {
|
||||||
return recreatable;
|
return recreatable;
|
||||||
@ -245,7 +247,8 @@ public class VolumeVO implements Volume {
|
|||||||
return iscsiName;
|
return iscsiName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
@Override
|
||||||
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +469,10 @@ public class VolumeVO implements Volume {
|
|||||||
public State getState() {
|
public State getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setState(State state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUpdated(Date updated) {
|
public void setUpdated(Date updated) {
|
||||||
this.updated = updated;
|
this.updated = updated;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.storage.LaunchPermissionVO;
|
import com.cloud.storage.LaunchPermissionVO;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.storage.Storage.FileSystem;
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.utils.DateUtil;
|
import com.cloud.utils.DateUtil;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
@ -120,7 +120,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
|||||||
boolean isPublic = rs.getBoolean(4);
|
boolean isPublic = rs.getBoolean(4);
|
||||||
String value = rs.getString(5);
|
String value = rs.getString(5);
|
||||||
ImageFormat format = ImageFormat.valueOf(value);
|
ImageFormat format = ImageFormat.valueOf(value);
|
||||||
String filesystem = rs.getString(6);
|
String tmpltType = rs.getString(6);
|
||||||
boolean requiresHVM = rs.getBoolean(7);
|
boolean requiresHVM = rs.getBoolean(7);
|
||||||
int bits = rs.getInt(8);
|
int bits = rs.getInt(8);
|
||||||
String url = rs.getString(9);
|
String url = rs.getString(9);
|
||||||
@ -140,7 +140,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO,
|
|||||||
if (isPublic) {
|
if (isPublic) {
|
||||||
continue; // if it's public already, skip adding it to permitted templates as this for private templates only
|
continue; // if it's public already, skip adding it to permitted templates as this for private templates only
|
||||||
}
|
}
|
||||||
VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, FileSystem.valueOf(filesystem), url, createdDate, requiresHVM, bits, templateAccountId, checksum, displayText, enablePassword, guestOSId, true);
|
VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, TemplateType.valueOf(tmpltType), url, createdDate, requiresHVM, bits, templateAccountId, checksum, displayText, enablePassword, guestOSId, true, null);
|
||||||
permittedTemplates.add(template);
|
permittedTemplates.add(template);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package com.cloud.storage.dao;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cloud.storage.Snapshot;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
import com.cloud.utils.db.Filter;
|
import com.cloud.utils.db.Filter;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
@ -29,5 +30,6 @@ public interface SnapshotDao extends GenericDao<SnapshotVO, Long> {
|
|||||||
List<SnapshotVO> listByVolumeId(Filter filter, long volumeId);
|
List<SnapshotVO> listByVolumeId(Filter filter, long volumeId);
|
||||||
SnapshotVO findNextSnapshot(long parentSnapId);
|
SnapshotVO findNextSnapshot(long parentSnapId);
|
||||||
long getLastSnapshot(long volumeId, long snapId);
|
long getLastSnapshot(long volumeId, long snapId);
|
||||||
|
List<SnapshotVO> listByVolumeIdType(long volumeId, String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
import com.cloud.storage.Snapshot;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
import com.cloud.utils.db.Filter;
|
import com.cloud.utils.db.Filter;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
@ -33,6 +34,7 @@ import com.cloud.utils.db.SearchCriteria;
|
|||||||
public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements SnapshotDao {
|
public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements SnapshotDao {
|
||||||
|
|
||||||
private final SearchBuilder<SnapshotVO> VolumeIdSearch;
|
private final SearchBuilder<SnapshotVO> VolumeIdSearch;
|
||||||
|
private final SearchBuilder<SnapshotVO> VolumeIdTypeSearch;
|
||||||
private final SearchBuilder<SnapshotVO> ParentIdSearch;
|
private final SearchBuilder<SnapshotVO> ParentIdSearch;
|
||||||
private final GenericSearchBuilder<SnapshotVO, Long> lastSnapSearch;
|
private final GenericSearchBuilder<SnapshotVO, Long> lastSnapSearch;
|
||||||
|
|
||||||
@ -42,6 +44,12 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
|||||||
sc.setParameters("prevSnapshotId", snapshotId);
|
sc.setParameters("prevSnapshotId", snapshotId);
|
||||||
return findOneIncludingRemovedBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SnapshotVO> listByVolumeIdType(long volumeId, String type ) {
|
||||||
|
return listByVolumeIdType(null, volumeId, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SnapshotVO> listByVolumeId(long volumeId) {
|
public List<SnapshotVO> listByVolumeId(long volumeId) {
|
||||||
@ -54,12 +62,25 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
|||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
return listBy(sc, filter);
|
return listBy(sc, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<SnapshotVO> listByVolumeIdType(Filter filter, long volumeId, String type ) {
|
||||||
|
SearchCriteria<SnapshotVO> sc = VolumeIdTypeSearch.create();
|
||||||
|
sc.setParameters("volumeId", volumeId);
|
||||||
|
sc.setParameters("type", type);
|
||||||
|
return listBy(sc, filter);
|
||||||
|
}
|
||||||
|
|
||||||
protected SnapshotDaoImpl() {
|
protected SnapshotDaoImpl() {
|
||||||
VolumeIdSearch = createSearchBuilder();
|
VolumeIdSearch = createSearchBuilder();
|
||||||
VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||||
VolumeIdSearch.done();
|
VolumeIdSearch.done();
|
||||||
|
|
||||||
|
VolumeIdTypeSearch = createSearchBuilder();
|
||||||
|
VolumeIdTypeSearch.and("volumeId", VolumeIdTypeSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||||
|
VolumeIdTypeSearch.and("type", VolumeIdTypeSearch.entity().getTypeDescription(), SearchCriteria.Op.EQ);
|
||||||
|
VolumeIdTypeSearch.done();
|
||||||
|
|
||||||
ParentIdSearch = createSearchBuilder();
|
ParentIdSearch = createSearchBuilder();
|
||||||
ParentIdSearch.and("prevSnapshotId", ParentIdSearch.entity().getPrevSnapshotId(), SearchCriteria.Op.EQ);
|
ParentIdSearch.and("prevSnapshotId", ParentIdSearch.entity().getPrevSnapshotId(), SearchCriteria.Op.EQ);
|
||||||
ParentIdSearch.done();
|
ParentIdSearch.done();
|
||||||
|
|||||||
@ -31,5 +31,6 @@ public interface SnapshotPolicyDao extends GenericDao<SnapshotPolicyVO, Long> {
|
|||||||
List<SnapshotPolicyVO> listByVolumeId(long volumeId);
|
List<SnapshotPolicyVO> listByVolumeId(long volumeId);
|
||||||
List<SnapshotPolicyVO> listByVolumeId(long volumeId, Filter filter);
|
List<SnapshotPolicyVO> listByVolumeId(long volumeId, Filter filter);
|
||||||
SnapshotPolicyVO findOneByVolumeInterval(long volumeId, short interval);
|
SnapshotPolicyVO findOneByVolumeInterval(long volumeId, short interval);
|
||||||
List<SnapshotPolicyVO> listActivePolicies();
|
List<SnapshotPolicyVO> listActivePolicies();
|
||||||
|
SnapshotPolicyVO findOneByVolume(long volumeId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,15 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long
|
|||||||
sc.setParameters("volumeId", volumeId);
|
sc.setParameters("volumeId", volumeId);
|
||||||
sc.setParameters("interval", interval);
|
sc.setParameters("interval", interval);
|
||||||
return findOneIncludingRemovedBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SnapshotPolicyVO findOneByVolume(long volumeId) {
|
||||||
|
SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
|
||||||
|
sc.setParameters("volumeId", volumeId);
|
||||||
|
sc.setParameters("active", true);
|
||||||
|
return findOneBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SnapshotPolicyVO> listByVolumeId(long volumeId) {
|
public List<SnapshotPolicyVO> listByVolumeId(long volumeId) {
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under the GNU General Public License v3 or later.
|
|
||||||
*
|
|
||||||
* It is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.cloud.storage.dao;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
|
|
||||||
import com.cloud.storage.SnapshotPolicyRefVO;
|
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
|
||||||
import com.cloud.utils.db.SearchBuilder;
|
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
|
||||||
|
|
||||||
@Local (value={SnapshotPolicyRefDao.class})
|
|
||||||
public class SnapshotPolicyRefDaoImpl extends GenericDaoBase<SnapshotPolicyRefVO, Long> implements SnapshotPolicyRefDao {
|
|
||||||
protected final SearchBuilder<SnapshotPolicyRefVO> snapPolicy;
|
|
||||||
protected final SearchBuilder<SnapshotPolicyRefVO> snapSearch;
|
|
||||||
protected final SearchBuilder<SnapshotPolicyRefVO> policySearch;
|
|
||||||
|
|
||||||
protected SnapshotPolicyRefDaoImpl() {
|
|
||||||
snapPolicy = createSearchBuilder();
|
|
||||||
snapPolicy.and("snapshotId", snapPolicy.entity().getSnapshotId(), SearchCriteria.Op.EQ);
|
|
||||||
snapPolicy.and("policyId", snapPolicy.entity().getPolicyId(), SearchCriteria.Op.EQ);
|
|
||||||
snapPolicy.done();
|
|
||||||
|
|
||||||
snapSearch = createSearchBuilder();
|
|
||||||
snapSearch.and("snapshotId", snapSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ);
|
|
||||||
snapSearch.done();
|
|
||||||
|
|
||||||
policySearch = createSearchBuilder();
|
|
||||||
policySearch.and("policyId", policySearch.entity().getPolicyId(), SearchCriteria.Op.EQ);
|
|
||||||
policySearch.and("volumeId", policySearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
|
||||||
policySearch.done();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SnapshotPolicyRefVO findBySnapPolicy(long snapshotId, long policyId) {
|
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
|
||||||
sc.setParameters("policyId", policyId);
|
|
||||||
return findOneIncludingRemovedBy(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int removeSnapPolicy(long snapshotId, long policyId) {
|
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapPolicy.create();
|
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
|
||||||
sc.setParameters("policyId", policyId);
|
|
||||||
return expunge(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SnapshotPolicyRefVO> listBySnapshotId(long snapshotId) {
|
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = snapSearch.create();
|
|
||||||
sc.setParameters("snapshotId", snapshotId);
|
|
||||||
return listIncludingRemovedBy(sc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SnapshotPolicyRefVO> listByPolicyId(long policyId, long volumeId) {
|
|
||||||
SearchCriteria<SnapshotPolicyRefVO> sc = policySearch.create();
|
|
||||||
sc.setParameters("policyId", policyId);
|
|
||||||
sc.setParameters("volumeId", volumeId);
|
|
||||||
return listIncludingRemovedBy(sc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -22,6 +22,7 @@ package com.cloud.storage.dao;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cloud.storage.SnapshotPolicyVO;
|
||||||
import com.cloud.storage.SnapshotScheduleVO;
|
import com.cloud.storage.SnapshotScheduleVO;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
@ -36,4 +37,6 @@ public interface SnapshotScheduleDao extends GenericDao<SnapshotScheduleVO, Long
|
|||||||
|
|
||||||
SnapshotScheduleVO getCurrentSchedule(Long volumeId, Long policyId, boolean executing);
|
SnapshotScheduleVO getCurrentSchedule(Long volumeId, Long policyId, boolean executing);
|
||||||
|
|
||||||
|
SnapshotScheduleVO findOneByVolume(long volumeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import com.cloud.utils.db.SearchCriteria;
|
|||||||
public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO, Long> implements SnapshotScheduleDao {
|
public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO, Long> implements SnapshotScheduleDao {
|
||||||
protected final SearchBuilder<SnapshotScheduleVO> executableSchedulesSearch;
|
protected final SearchBuilder<SnapshotScheduleVO> executableSchedulesSearch;
|
||||||
protected final SearchBuilder<SnapshotScheduleVO> coincidingSchedulesSearch;
|
protected final SearchBuilder<SnapshotScheduleVO> coincidingSchedulesSearch;
|
||||||
|
private final SearchBuilder<SnapshotScheduleVO> VolumeIdSearch;
|
||||||
// DB constraint: For a given volume and policyId, there will only be one entry in this table.
|
// DB constraint: For a given volume and policyId, there will only be one entry in this table.
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,10 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
|||||||
coincidingSchedulesSearch.and("scheduledTimestamp", coincidingSchedulesSearch.entity().getScheduledTimestamp(), SearchCriteria.Op.LT);
|
coincidingSchedulesSearch.and("scheduledTimestamp", coincidingSchedulesSearch.entity().getScheduledTimestamp(), SearchCriteria.Op.LT);
|
||||||
coincidingSchedulesSearch.and("asyncJobId", coincidingSchedulesSearch.entity().getAsyncJobId(), SearchCriteria.Op.NULL);
|
coincidingSchedulesSearch.and("asyncJobId", coincidingSchedulesSearch.entity().getAsyncJobId(), SearchCriteria.Op.NULL);
|
||||||
coincidingSchedulesSearch.done();
|
coincidingSchedulesSearch.done();
|
||||||
|
|
||||||
|
VolumeIdSearch = createSearchBuilder();
|
||||||
|
VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
|
||||||
|
VolumeIdSearch.done();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +73,13 @@ public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO,
|
|||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SnapshotScheduleVO findOneByVolume(long volumeId) {
|
||||||
|
SearchCriteria<SnapshotScheduleVO> sc = VolumeIdSearch.create();
|
||||||
|
sc.setParameters("volumeId", volumeId);
|
||||||
|
return findOneBy(sc);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||||||
|
|
||||||
protected final StoragePoolDetailsDao _detailsDao;
|
protected final StoragePoolDetailsDao _detailsDao;
|
||||||
|
|
||||||
private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
|
private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
|
||||||
private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
|
private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
|
||||||
private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
|
private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
|
||||||
|
|
||||||
@ -346,8 +346,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
tags.add(rs.getString("name"));
|
tags.add(rs.getString("name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return tags;
|
return tags;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
|
throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ package com.cloud.storage.dao;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
@ -55,16 +56,19 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
|
|||||||
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId);
|
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId);
|
||||||
|
|
||||||
//public void update(VMTemplateVO template);
|
//public void update(VMTemplateVO template);
|
||||||
public VMTemplateVO findRoutingTemplate();
|
public VMTemplateVO findRoutingTemplate();
|
||||||
|
public List<VMTemplateVO> listAllRoutingTemplates();
|
||||||
public VMTemplateVO findConsoleProxyTemplate();
|
public VMTemplateVO findConsoleProxyTemplate();
|
||||||
public VMTemplateVO findDefaultBuiltinTemplate();
|
public List<VMTemplateVO> listDefaultBuiltinTemplates();
|
||||||
public String getRoutingTemplateUniqueName();
|
public String getRoutingTemplateUniqueName();
|
||||||
public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path);
|
public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path);
|
||||||
public List<VMTemplateVO> listReadyTemplates();
|
public List<VMTemplateVO> listReadyTemplates();
|
||||||
public List<VMTemplateVO> listByAccountId(long accountId);
|
public List<VMTemplateVO> listByAccountId(long accountId);
|
||||||
public List<VMTemplateVO> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Account account, DomainVO domain, Integer pageSize, Long startIndex, Long zoneId);
|
public List<VMTemplateVO> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Account account, DomainVO domain, Integer pageSize, Long startIndex, Long zoneId, HypervisorType hyperType);
|
||||||
|
|
||||||
public long addTemplateToZone(VMTemplateVO tmplt, long zoneId);
|
public long addTemplateToZone(VMTemplateVO tmplt, long zoneId);
|
||||||
public List<VMTemplateVO> listAllInZone(long dataCenterId);
|
public List<VMTemplateVO> listAllInZone(long dataCenterId);
|
||||||
|
|
||||||
|
public List<VMTemplateVO> listByHypervisorType(HypervisorType hyperType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,37 +31,41 @@ import javax.naming.ConfigurationException;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.configuration.dao.ConfigurationDao;
|
||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.storage.VMTemplateZoneVO;
|
import com.cloud.storage.VMTemplateZoneVO;
|
||||||
import com.cloud.storage.template.TemplateConstants;
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
|
import com.cloud.utils.db.JoinBuilder;
|
||||||
import com.cloud.utils.db.SearchBuilder;
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
|
||||||
|
|
||||||
@Local(value={VMTemplateDao.class})
|
@Local(value={VMTemplateDao.class})
|
||||||
public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implements VMTemplateDao {
|
public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implements VMTemplateDao {
|
||||||
private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class);
|
private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class);
|
||||||
|
private HypervisorType _defaultHyperType;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VMTemplateZoneDao _templateZoneDao;
|
VMTemplateZoneDao _templateZoneDao;
|
||||||
|
@Inject
|
||||||
|
ConfigurationDao _configDao;
|
||||||
|
|
||||||
private final String SELECT_ALL = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " +
|
private final String SELECT_ALL = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " +
|
||||||
"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones FROM vm_template t";
|
"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t";
|
||||||
|
|
||||||
private static final String SELECT_ALL_IN_ZONE =
|
|
||||||
"SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.removed, t.account_id, " +
|
|
||||||
"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones FROM vm_template t, template_zone_ref tz where t.removed is null and tz.removed is null and t.id = tz.template_id and tz.zone_id=? ";
|
|
||||||
|
|
||||||
private SearchBuilder<VMTemplateVO> UniqueNameSearch;
|
protected SearchBuilder<VMTemplateVO> TemplateNameSearch;
|
||||||
private SearchBuilder<VMTemplateVO> AccountIdSearch;
|
protected SearchBuilder<VMTemplateVO> UniqueNameSearch;
|
||||||
private SearchBuilder<VMTemplateVO> NameSearch;
|
protected SearchBuilder<VMTemplateVO> tmpltTypeSearch;
|
||||||
|
protected SearchBuilder<VMTemplateVO> tmpltTypeHyperSearch;
|
||||||
|
protected SearchBuilder<VMTemplateVO> AccountIdSearch;
|
||||||
|
protected SearchBuilder<VMTemplateVO> NameSearch;
|
||||||
|
protected SearchBuilder<VMTemplateVO> TmpltsInZoneSearch;
|
||||||
private SearchBuilder<VMTemplateVO> PublicSearch;
|
private SearchBuilder<VMTemplateVO> PublicSearch;
|
||||||
private SearchBuilder<VMTemplateVO> NameAccountIdSearch;
|
private SearchBuilder<VMTemplateVO> NameAccountIdSearch;
|
||||||
|
|
||||||
@ -90,7 +94,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
sc.setParameters("name", templateName);
|
sc.setParameters("name", templateName);
|
||||||
return findOneIncludingRemovedBy(sc);
|
return findOneIncludingRemovedBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId) {
|
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId) {
|
||||||
SearchCriteria<VMTemplateVO> sc = NameAccountIdSearch.create();
|
SearchCriteria<VMTemplateVO> sc = NameAccountIdSearch.create();
|
||||||
@ -99,18 +103,21 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
return findOneBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VMTemplateVO> listAllRoutingTemplates() {
|
||||||
|
SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
|
||||||
|
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
|
||||||
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findRoutingTemplate() {
|
public VMTemplateVO findRoutingTemplate() {
|
||||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
return findSystemVMTemplate();
|
||||||
sc.setParameters("uniqueName", routerTmpltName);
|
|
||||||
return findOneIncludingRemovedBy(sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findConsoleProxyTemplate() {
|
public VMTemplateVO findConsoleProxyTemplate() {
|
||||||
SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
|
return findSystemVMTemplate();
|
||||||
sc.setParameters("uniqueName", consoleProxyTmpltName);
|
|
||||||
return findOneIncludingRemovedBy(sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -139,6 +146,13 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
|
||||||
sc.setParameters("accountId", accountId);
|
sc.setParameters("accountId", accountId);
|
||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VMTemplateVO> listByHypervisorType(HypervisorType hyperType) {
|
||||||
|
SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
|
||||||
|
sc.addAnd("hypervisor_type", SearchCriteria.Op.EQ, hyperType.toString());
|
||||||
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -170,11 +184,30 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
NameAccountIdSearch.and("name", NameAccountIdSearch.entity().getName(), SearchCriteria.Op.EQ);
|
NameAccountIdSearch.and("name", NameAccountIdSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||||
NameAccountIdSearch.and("accountId", NameAccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
NameAccountIdSearch.and("accountId", NameAccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||||
|
|
||||||
|
|
||||||
|
tmpltTypeHyperSearch = createSearchBuilder();
|
||||||
|
tmpltTypeHyperSearch.and("templateType", tmpltTypeHyperSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
|
||||||
|
tmpltTypeHyperSearch.and("hypervisor_type", tmpltTypeHyperSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||||
|
|
||||||
|
tmpltTypeSearch = createSearchBuilder();
|
||||||
|
tmpltTypeSearch.and("templateType", tmpltTypeSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
|
||||||
|
|
||||||
AccountIdSearch = createSearchBuilder();
|
AccountIdSearch = createSearchBuilder();
|
||||||
AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||||
AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
|
AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
|
||||||
AccountIdSearch.done();
|
AccountIdSearch.done();
|
||||||
|
|
||||||
|
SearchBuilder<VMTemplateZoneVO> tmpltZoneSearch = _templateZoneDao.createSearchBuilder();
|
||||||
|
tmpltZoneSearch.and("removed", tmpltZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
|
||||||
|
tmpltZoneSearch.and("zoneId", tmpltZoneSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
|
||||||
|
|
||||||
|
TmpltsInZoneSearch = createSearchBuilder();
|
||||||
|
TmpltsInZoneSearch.and("removed", TmpltsInZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
|
||||||
|
TmpltsInZoneSearch.join("tmpltzone", tmpltZoneSearch, tmpltZoneSearch.entity().getTemplateId(), TmpltsInZoneSearch.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||||
|
tmpltZoneSearch.done();
|
||||||
|
TmpltsInZoneSearch.done();
|
||||||
|
|
||||||
|
_defaultHyperType = HypervisorType.getType(_configDao.getValue("hypervisor.type"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +217,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMTemplateVO> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Account account, DomainVO domain, Integer pageSize, Long startIndex, Long zoneId) {
|
public List<VMTemplateVO> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Account account, DomainVO domain, Integer pageSize, Long startIndex, Long zoneId, HypervisorType hyperType) {
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
txn.start();
|
txn.start();
|
||||||
List<VMTemplateVO> templates = new ArrayList<VMTemplateVO>();
|
List<VMTemplateVO> templates = new ArrayList<VMTemplateVO>();
|
||||||
@ -200,7 +233,12 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
accountType = Account.ACCOUNT_TYPE_ADMIN;
|
accountType = Account.ACCOUNT_TYPE_ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
String sql = SELECT_ALL;
|
String guestOSJoin = "";
|
||||||
|
if (isIso) {
|
||||||
|
guestOSJoin = " INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) ";
|
||||||
|
}
|
||||||
|
|
||||||
|
String sql = SELECT_ALL + guestOSJoin;
|
||||||
String whereClause = "";
|
String whereClause = "";
|
||||||
|
|
||||||
if (templateFilter == TemplateFilter.featured) {
|
if (templateFilter == TemplateFilter.featured) {
|
||||||
@ -235,7 +273,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
whereClause += " AND ";
|
whereClause += " AND ";
|
||||||
}
|
}
|
||||||
|
|
||||||
sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable) + getOrderByLimit(pageSize, startIndex);
|
sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable, hyperType) + getOrderByLimit(pageSize, startIndex);
|
||||||
|
|
||||||
pstmt = txn.prepareStatement(sql);
|
pstmt = txn.prepareStatement(sql);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
@ -269,7 +307,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable) {
|
private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType) {
|
||||||
String sql = "";
|
String sql = "";
|
||||||
if (keyword != null) {
|
if (keyword != null) {
|
||||||
sql += " t.name LIKE \"%" + keyword + "%\" AND";
|
sql += " t.name LIKE \"%" + keyword + "%\" AND";
|
||||||
@ -278,14 +316,22 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isIso) {
|
if (isIso) {
|
||||||
sql += " t.format = 'ISO'";
|
sql += " t.format = 'ISO'";
|
||||||
|
if (!hyperType.equals(HypervisorType.None)) {
|
||||||
|
sql += " AND goh.hypervisor_type = '" + hyperType.toString() + "'";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sql += " t.format <> 'ISO'";
|
sql += " t.format <> 'ISO'";
|
||||||
|
if (!hyperType.equals(HypervisorType.None)) {
|
||||||
|
sql += " AND t.hypervisor_type = '" + hyperType.toString() + "'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootable != null) {
|
if (bootable != null) {
|
||||||
sql += " AND t.bootable = " + bootable;
|
sql += " AND t.bootable = " + bootable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sql += " AND t.removed IS NULL";
|
sql += " AND t.removed IS NULL";
|
||||||
|
|
||||||
@ -319,29 +365,41 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public List<VMTemplateVO> listAllInZone(long dataCenterId) {
|
public List<VMTemplateVO> listAllInZone(long dataCenterId) {
|
||||||
Transaction txn = Transaction.currentTxn();
|
SearchCriteria<VMTemplateVO> sc = TmpltsInZoneSearch.create();
|
||||||
txn.start();
|
sc.setJoinParameters("tmpltzone", "zoneId", dataCenterId);
|
||||||
PreparedStatement pstmt = null;
|
return listBy(sc);
|
||||||
List<VMTemplateVO> result = new ArrayList<VMTemplateVO>();
|
|
||||||
try {
|
|
||||||
String sql = SELECT_ALL_IN_ZONE;
|
|
||||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
|
||||||
pstmt.setLong(1, dataCenterId);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
while (rs.next()) {
|
|
||||||
result.add(toEntityBean(rs, false));
|
|
||||||
}
|
|
||||||
txn.commit();
|
|
||||||
} catch (SQLException sqle) {
|
|
||||||
s_logger.warn("Exception: ",sqle);
|
|
||||||
throw new CloudRuntimeException("Unable to list templates in zone", sqle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMTemplateVO findDefaultBuiltinTemplate() {
|
public List<VMTemplateVO> listDefaultBuiltinTemplates() {
|
||||||
return findById(TemplateConstants.DEFAULT_BUILTIN_VM_DB_ID);
|
SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
|
||||||
|
sc.setParameters("templateType", Storage.TemplateType.BUILTIN);
|
||||||
|
return listBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private VMTemplateVO findSystemVMTemplate() {
|
||||||
|
SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch.create();
|
||||||
|
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
|
||||||
|
sc.setParameters("hypervisor_type", _defaultHyperType.toString());
|
||||||
|
VMTemplateVO tmplt = findOneBy(sc);
|
||||||
|
|
||||||
|
if (tmplt == null) {
|
||||||
|
/*Can't find it? We'd like to prefer xenserver */
|
||||||
|
if (_defaultHyperType != HypervisorType.XenServer) {
|
||||||
|
sc = tmpltTypeHyperSearch.create();
|
||||||
|
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
|
||||||
|
sc.setParameters("hypervisor_type", HypervisorType.XenServer);
|
||||||
|
tmplt = findOneBy(sc);
|
||||||
|
|
||||||
|
/*Still can't find it? return a random one*/
|
||||||
|
if (tmplt == null) {
|
||||||
|
sc = tmpltTypeSearch.create();
|
||||||
|
sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
|
||||||
|
tmplt = findOneBy(sc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmplt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@ package com.cloud.storage.dao;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -47,4 +49,14 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long> {
|
|||||||
List<VolumeVO> findCreatedByInstance(long id);
|
List<VolumeVO> findCreatedByInstance(long id);
|
||||||
List<VolumeVO> findByPoolId(long poolId);
|
List<VolumeVO> findByPoolId(long poolId);
|
||||||
List<VolumeVO> findByInstanceAndDeviceId(long instanceId, long deviceId);
|
List<VolumeVO> findByInstanceAndDeviceId(long instanceId, long deviceId);
|
||||||
|
List<VolumeVO> findUsableVolumesForInstance(long instanceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the volume only if the state in memory matches the state in the database.
|
||||||
|
* @param vol Volume to be updated.
|
||||||
|
* @param event event that causes the database change.
|
||||||
|
* @return true if update happened, false if not.
|
||||||
|
*/
|
||||||
|
boolean update(VolumeVO vol, Volume.Event event) throws ConcurrentOperationException;
|
||||||
|
HypervisorType getHypervisorType(long volumeId);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user