@Test public void testcreateVmFromSpecWithTopology6() { final int id = this._random.nextInt(65534); final String name = "test-instance-1"; final int cpus = 12; final int minRam = 256 * 1024; final int maxRam = 512 * 1024; final String os = "Ubuntu"; final String vncPassword = "mySuperSecretPassword"; final LibvirtComputingResource lcr = new LibvirtComputingResource(); final VirtualMachineTO to = new VirtualMachineTO(id, name, VirtualMachineType.User, cpus, minRam, maxRam, BootloaderType.HVM, os, false, false, vncPassword); to.setUuid("b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9"); final LibvirtVmDef vm = lcr.createVmFromSpec(to); vm.setHvsType(this._hyperVisorType); verifyVm(to, vm); }
public LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo) { final LibvirtVmDef vm = new LibvirtVmDef(); vm.setDomainName(vmTo.getName()); String uuid = vmTo.getUuid(); uuid = getUuid(uuid); vm.setDomUuid(uuid); vm.setDomDescription("This VM is optimised for: " + vmTo.getOptimiseFor().toString()); vm.setPlatformEmulator(vmTo.getPlatformEmulator()); final MetadataTO metadataTo = vmTo.getMetadata(); if (metadataTo != null) { final MetadataDef metadata = new MetadataDef(); metadata.getNodes().put("cosmicDomainUuid", metadataTo.getDomainUuid()); metadata.getNodes().put("cosmicDomainName", metadataTo.getCosmicDomainName()); metadata.getNodes().put("cosmicDomainPath", metadataTo.getCosmicDomainPath()); metadata.getNodes().put("cosmicInternalVmId", metadataTo.getVmId()); metadata.getNodes().put("cosmicInstanceName", metadataTo.getInstanceName()); metadata.getNodes().put("cosmicXmlGeneratedInCosmicVersion", LibvirtComputingResource.class.getPackage().getImplementationVersion()); metadata.getNodes().put("cosmicXmlGeneratedDateTime", getCurrentLocalDateTimeStamp()); metadata.getNodes().put("cosmicXmlGeneratedEpoch", getCurrentEpoch()); metadata.getNodes().put("cosmicVmHostname", metadataTo.getHostname()); metadata.getNodes().put("cosmicOptimiseFor", vmTo.getOptimiseFor().toString()); final List<String> vpcNameList = metadataTo.getVpcNameList(); if (vpcNameList != null) { for (final String vpcName : vpcNameList) { metadata.getNodes().put("cosmicVPC", vpcName); } } final Map<String, String> vmTags = metadataTo.getResourceTags(); if (vmTags != null) { for (Map.Entry<String, String> vmTag : vmTags.entrySet()) { metadata.getNodes().put("cosmicTag_" + vmTag.getKey(), vmTag.getValue()); } } vm.addComponent(metadata); } final GuestDef guest = new GuestDef(); guest.setGuestType(LibvirtVmDef.GuestType.KVM); vm.setHvsType(HypervisorType.KVM.toString().toLowerCase()); vm.setLibvirtVersion(this.hypervisorLibvirtVersion); vm.setQemuVersion(this.hypervisorQemuVersion); guest.setGuestArch(vmTo.getArch()); guest.setMachineType("pc"); guest.setUuid(uuid); guest.setManufacturer(vmTo.getManufacturer()); guest.setBootMenuTimeout(vmTo.getBootMenuTimeout()); if (vmTo.getBootOrder() != null) { for (BootOrder device : vmTo.getBootOrder()) { guest.setBootOrder(device); } } else { guest.setBootOrder(BootOrder.CDROM); guest.setBootOrder(BootOrder.HARDDISK); } vm.addComponent(guest); final GuestResourceDef grd = new GuestResourceDef(); if (vmTo.getMinRam() != vmTo.getMaxRam() && !this.libvirtComputingResourceProperties.getVmMemballoonDisable()) { grd.setMemBalloning(true); grd.setCurrentMem(vmTo.getMinRam() / 1024); grd.setMemorySize(vmTo.getMaxRam() / 1024); } else { grd.setMemorySize(vmTo.getMaxRam() / 1024); } final int vcpus = vmTo.getCpus(); grd.setVcpuNum(vcpus); vm.addComponent(grd); final CpuModeDef cmd = new CpuModeDef(); cmd.setMode(getGuestCpuMode()); cmd.setModel(getGuestCpuModel()); cmd.setCpuflags(vmTo.getCpuflags()); if (vmTo.getType() == VirtualMachineType.User) { cmd.setFeatures(getCpuFeatures()); } if (OptimiseFor.Windows.equals(vmTo.getOptimiseFor()) && MaintenancePolicy.LiveMigrate.equals(vmTo.getMaintenancePolicy())) { String extended_cpu_flags = vmTo.getCpuflags(); if (extended_cpu_flags == null) { extended_cpu_flags = "-hypervisor"; } else { extended_cpu_flags += " -hypervisor"; } cmd.setCpuflags(extended_cpu_flags); } if (vcpus % 6 == 0) { final int sockets = vcpus / 6; cmd.setTopology(6, sockets); } else if (vcpus % 4 == 0) { final int sockets = vcpus / 4; cmd.setTopology(4, sockets); } vm.addComponent(cmd); final CpuTuneDef ctd = new CpuTuneDef(); if (VirtualMachineType.DomainRouter.equals(vmTo.getType())) { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuSharesRouter()); } else { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuShares()); } vm.addComponent(ctd); final FeaturesDef features = new FeaturesDef(); features.addFeature("pae"); features.addFeature("apic"); features.addFeature("acpi"); vm.addComponent(features); if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { final HyperVEnlightenmentFeatureDef hyperVFeatures = new HyperVEnlightenmentFeatureDef(); hyperVFeatures.addFeature("relaxed", true); hyperVFeatures.addFeature("vapic", true); hyperVFeatures.addFeature("spinlocks", true); hyperVFeatures.setRetries(8191); features.addHyperVFeature(hyperVFeatures); } final TermPolicy term = new TermPolicy(); if (VirtualMachineType.User.equals(vmTo.getType())) { term.setCrashPolicy(getVmTermpolicyCrash()); term.setPowerOffPolicy(getVmTermpolicyPowerOff()); term.setRebootPolicy(getVmTermpolicyReboot()); } else { term.setCrashPolicy(getSystemTermpolicyCrash()); term.setPowerOffPolicy(getSystemTermpolicyPowerOff()); term.setRebootPolicy(getSystemTermpolicyReboot()); } vm.addComponent(term); final ClockDef clock = new ClockDef(); Boolean kvmClockEnabled = !isKvmClockDisabled(); Boolean hypervClockEnabled = false; Boolean trackGuest = false; if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME); kvmClockEnabled = false; hypervClockEnabled = true; trackGuest = true; } clock.addTimer("kvmclock", null, kvmClockEnabled, false); clock.addTimer("hypervclock", null, hypervClockEnabled, false); clock.addTimer("rtc", "catchup", true, trackGuest); clock.addTimer("pit", "delay", true, false); clock.addTimer("hpet", null, false, false); vm.addComponent(clock); final DevicesDef devices = new DevicesDef(); devices.setEmulatorPath(this.hypervisorPath); devices.setGuestType(guest.getGuestType()); final SerialDef serial = new SerialDef("pty", null, (short) 0); devices.addDevice(serial); final QemuGuestAgentDef guestagent = new QemuGuestAgentDef(); devices.addDevice(guestagent); if (this.libvirtComputingResourceProperties.getVmRngEnable()) { final RngDef rngDevice = new RngDef(this.rngPath, this.rngBackendModel); devices.addDevice(rngDevice); } final WatchDogDef watchDog = new WatchDogDef(this.libvirtComputingResourceProperties.getVmWatchdogAction(), this.libvirtComputingResourceProperties.getVmWatchdogModel()); devices.addDevice(watchDog); final VideoDef videoCard = new VideoDef(this.libvirtComputingResourceProperties.getVmVideoHardware(), this.libvirtComputingResourceProperties.getVmVideoRam()); devices.addDevice(videoCard); final ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0); devices.addDevice(console); final String passwd = vmTo.getVncPassword(); final GraphicDef grap = new GraphicDef("vnc", (short) 0, true, passwd, null); devices.addDevice(grap); final InputDef input = new InputDef("tablet", "usb"); devices.addDevice(input); vmTo.getName(); final ScsiDef sd = new ScsiDef((short) 0, 0, 0, 9, 0, vcpus); devices.addDevice(sd); logger.debug("Adding SCSI definition for " + vmTo.getName() + ":\n" + sd.toString()); vm.addComponent(devices); return vm; }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo) { final LibvirtVmDef vm = new LibvirtVmDef(); vm.setDomainName(vmTo.getName()); String uuid = vmTo.getUuid(); uuid = getUuid(uuid); vm.setDomUuid(uuid); vm.setDomDescription("This VM is optimised for: " + vmTo.getOptimiseFor().toString()); vm.setPlatformEmulator(vmTo.getPlatformEmulator()); final MetadataTO metadataTo = vmTo.getMetadata(); if (metadataTo != null) { final MetadataDef metadata = new MetadataDef(); metadata.getNodes().put("cosmicDomainUuid", metadataTo.getDomainUuid()); metadata.getNodes().put("cosmicDomainName", metadataTo.getCosmicDomainName()); metadata.getNodes().put("cosmicDomainPath", metadataTo.getCosmicDomainPath()); metadata.getNodes().put("cosmicInternalVmId", metadataTo.getVmId()); metadata.getNodes().put("cosmicInstanceName", metadataTo.getInstanceName()); metadata.getNodes().put("cosmicXmlGeneratedInCosmicVersion", LibvirtComputingResource.class.getPackage().getImplementationVersion()); metadata.getNodes().put("cosmicXmlGeneratedDateTime", getCurrentLocalDateTimeStamp()); metadata.getNodes().put("cosmicXmlGeneratedEpoch", getCurrentEpoch()); metadata.getNodes().put("cosmicVmHostname", metadataTo.getHostname()); metadata.getNodes().put("cosmicOptimiseFor", vmTo.getOptimiseFor().toString()); final List<String> vpcNameList = metadataTo.getVpcNameList(); if (vpcNameList != null) { for (final String vpcName : vpcNameList) { metadata.getNodes().put("cosmicVPC", vpcName); } } final Map<String, String> vmTags = metadataTo.getResourceTags(); if (vmTags != null) { for (Map.Entry<String, String> vmTag : vmTags.entrySet()) { metadata.getNodes().put("cosmicTag_" + vmTag.getKey(), vmTag.getValue()); } } vm.addComponent(metadata); } final GuestDef guest = new GuestDef(); guest.setGuestType(LibvirtVmDef.GuestType.KVM); vm.setHvsType(HypervisorType.KVM.toString().toLowerCase()); vm.setLibvirtVersion(this.hypervisorLibvirtVersion); vm.setQemuVersion(this.hypervisorQemuVersion); guest.setGuestArch(vmTo.getArch()); guest.setMachineType("pc"); guest.setUuid(uuid); guest.setManufacturer(vmTo.getManufacturer()); guest.setBootMenuTimeout(vmTo.getBootMenuTimeout()); if (vmTo.getBootOrder() != null) { for (BootOrder device : vmTo.getBootOrder()) { guest.setBootOrder(device); } } else { guest.setBootOrder(BootOrder.CDROM); guest.setBootOrder(BootOrder.HARDDISK); } vm.addComponent(guest); final GuestResourceDef grd = new GuestResourceDef(); if (vmTo.getMinRam() != vmTo.getMaxRam() && !this.libvirtComputingResourceProperties.getVmMemballoonDisable()) { grd.setMemBalloning(true); grd.setCurrentMem(vmTo.getMinRam() / 1024); grd.setMemorySize(vmTo.getMaxRam() / 1024); } else { grd.setMemorySize(vmTo.getMaxRam() / 1024); } final int vcpus = vmTo.getCpus(); grd.setVcpuNum(vcpus); vm.addComponent(grd); final CpuModeDef cmd = new CpuModeDef(); cmd.setMode(getGuestCpuMode()); cmd.setModel(getGuestCpuModel()); cmd.setCpuflags(vmTo.getCpuflags()); if (vmTo.getType() == VirtualMachineType.User) { cmd.setFeatures(getCpuFeatures()); } if (OptimiseFor.Windows.equals(vmTo.getOptimiseFor()) && MaintenancePolicy.LiveMigrate.equals(vmTo.getMaintenancePolicy())) { String extended_cpu_flags = vmTo.getCpuflags(); if (extended_cpu_flags == null) { extended_cpu_flags = "-hypervisor"; } else { extended_cpu_flags += " -hypervisor"; } cmd.setCpuflags(extended_cpu_flags); } if (vcpus % 6 == 0) { final int sockets = vcpus / 6; cmd.setTopology(6, sockets); } else if (vcpus % 4 == 0) { final int sockets = vcpus / 4; cmd.setTopology(4, sockets); } vm.addComponent(cmd); final CpuTuneDef ctd = new CpuTuneDef(); if (VirtualMachineType.DomainRouter.equals(vmTo.getType())) { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuSharesRouter()); } else { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuShares()); } vm.addComponent(ctd); final FeaturesDef features = new FeaturesDef(); features.addFeature("pae"); features.addFeature("apic"); features.addFeature("acpi"); vm.addComponent(features); if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { final HyperVEnlightenmentFeatureDef hyperVFeatures = new HyperVEnlightenmentFeatureDef(); hyperVFeatures.addFeature("relaxed", true); hyperVFeatures.addFeature("vapic", true); hyperVFeatures.addFeature("spinlocks", true); hyperVFeatures.setRetries(8191); features.addHyperVFeature(hyperVFeatures); } final TermPolicy term = new TermPolicy(); if (VirtualMachineType.User.equals(vmTo.getType())) { term.setCrashPolicy(getVmTermpolicyCrash()); term.setPowerOffPolicy(getVmTermpolicyPowerOff()); term.setRebootPolicy(getVmTermpolicyReboot()); } else { term.setCrashPolicy(getSystemTermpolicyCrash()); term.setPowerOffPolicy(getSystemTermpolicyPowerOff()); term.setRebootPolicy(getSystemTermpolicyReboot()); } vm.addComponent(term); final ClockDef clock = new ClockDef(); Boolean kvmClockEnabled = !isKvmClockDisabled(); Boolean hypervClockEnabled = false; Boolean trackGuest = false; if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME); kvmClockEnabled = false; hypervClockEnabled = true; trackGuest = true; } clock.addTimer("kvmclock", null, kvmClockEnabled, false); clock.addTimer("hypervclock", null, hypervClockEnabled, false); clock.addTimer("rtc", "catchup", true, trackGuest); clock.addTimer("pit", "delay", true, false); clock.addTimer("hpet", null, false, false); vm.addComponent(clock); final DevicesDef devices = new DevicesDef(); devices.setEmulatorPath(this.hypervisorPath); devices.setGuestType(guest.getGuestType()); final SerialDef serial = new SerialDef("pty", null, (short) 0); devices.addDevice(serial); final QemuGuestAgentDef guestagent = new QemuGuestAgentDef(); devices.addDevice(guestagent); if (this.libvirtComputingResourceProperties.getVmRngEnable()) { final RngDef rngDevice = new RngDef(this.rngPath, this.rngBackendModel); devices.addDevice(rngDevice); } final WatchDogDef watchDog = new WatchDogDef(this.libvirtComputingResourceProperties.getVmWatchdogAction(), this.libvirtComputingResourceProperties.getVmWatchdogModel()); devices.addDevice(watchDog); final VideoDef videoCard = new VideoDef(this.libvirtComputingResourceProperties.getVmVideoHardware(), this.libvirtComputingResourceProperties.getVmVideoRam()); devices.addDevice(videoCard); final ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0); devices.addDevice(console); final String passwd = vmTo.getVncPassword(); final GraphicDef grap = new GraphicDef("vnc", (short) 0, true, passwd, null); devices.addDevice(grap); final InputDef input = new InputDef("tablet", "usb"); devices.addDevice(input); vmTo.getName(); final ScsiDef sd = new ScsiDef((short) 0, 0, 0, 9, 0, vcpus); devices.addDevice(sd); logger.debug("Adding SCSI definition for " + vmTo.getName() + ":\n" + sd.toString()); vm.addComponent(devices); return vm; } }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo) { final LibvirtVmDef vm = new LibvirtVmDef(); vm.setDomainName(vmTo.getName()); String uuid = vmTo.getUuid(); uuid = getUuid(uuid); vm.setDomUuid(uuid); vm.setDomDescription("This VM is optimised for: " + vmTo.getOptimiseFor().toString()); vm.setPlatformEmulator(vmTo.getPlatformEmulator()); final MetadataTO metadataTo = vmTo.getMetadata(); if (metadataTo != null) { final MetadataDef metadata = new MetadataDef(); metadata.getNodes().put("cosmicDomainUuid", metadataTo.getDomainUuid()); metadata.getNodes().put("cosmicDomainName", metadataTo.getCosmicDomainName()); metadata.getNodes().put("cosmicDomainPath", metadataTo.getCosmicDomainPath()); metadata.getNodes().put("cosmicInternalVmId", metadataTo.getVmId()); metadata.getNodes().put("cosmicInstanceName", metadataTo.getInstanceName()); metadata.getNodes().put("cosmicXmlGeneratedInCosmicVersion", LibvirtComputingResource.class.getPackage().getImplementationVersion()); metadata.getNodes().put("cosmicXmlGeneratedDateTime", getCurrentLocalDateTimeStamp()); metadata.getNodes().put("cosmicXmlGeneratedEpoch", getCurrentEpoch()); metadata.getNodes().put("cosmicVmHostname", metadataTo.getHostname()); metadata.getNodes().put("cosmicOptimiseFor", vmTo.getOptimiseFor().toString()); final List<String> vpcNameList = metadataTo.getVpcNameList(); if (vpcNameList != null) { for (final String vpcName : vpcNameList) { metadata.getNodes().put("cosmicVPC", vpcName); } } final Map<String, String> vmTags = metadataTo.getResourceTags(); if (vmTags != null) { for (Map.Entry<String, String> vmTag : vmTags.entrySet()) { metadata.getNodes().put("cosmicTag_" + vmTag.getKey(), vmTag.getValue()); } } vm.addComponent(metadata); } final GuestDef guest = new GuestDef(); guest.setGuestType(LibvirtVmDef.GuestType.KVM); vm.setHvsType(HypervisorType.KVM.toString().toLowerCase()); vm.setLibvirtVersion(this.hypervisorLibvirtVersion); vm.setQemuVersion(this.hypervisorQemuVersion); guest.setGuestArch(vmTo.getArch()); guest.setMachineType("pc"); guest.setUuid(uuid); guest.setManufacturer(vmTo.getManufacturer()); guest.setBootMenuTimeout(vmTo.getBootMenuTimeout()); if (vmTo.getBootOrder() != null) { for (BootOrder device : vmTo.getBootOrder()) { guest.setBootOrder(device); } } else { guest.setBootOrder(BootOrder.CDROM); guest.setBootOrder(BootOrder.HARDDISK); } vm.addComponent(guest); final GuestResourceDef grd = new GuestResourceDef(); if (vmTo.getMinRam() != vmTo.getMaxRam() && !this.libvirtComputingResourceProperties.getVmMemballoonDisable()) { grd.setMemBalloning(true); grd.setCurrentMem(vmTo.getMinRam() / 1024); grd.setMemorySize(vmTo.getMaxRam() / 1024); } else { grd.setMemorySize(vmTo.getMaxRam() / 1024); } final int vcpus = vmTo.getCpus(); grd.setVcpuNum(vcpus); vm.addComponent(grd); final CpuModeDef cmd = new CpuModeDef(); cmd.setMode(getGuestCpuMode()); cmd.setModel(getGuestCpuModel()); cmd.setCpuflags(vmTo.getCpuflags()); if (vmTo.getType() == VirtualMachineType.User) { cmd.setFeatures(getCpuFeatures()); } if (OptimiseFor.Windows.equals(vmTo.getOptimiseFor()) && MaintenancePolicy.LiveMigrate.equals(vmTo.getMaintenancePolicy())) { String extended_cpu_flags = vmTo.getCpuflags(); if (extended_cpu_flags == null) { extended_cpu_flags = "-hypervisor"; } else { extended_cpu_flags += " -hypervisor"; } cmd.setCpuflags(extended_cpu_flags); } if (vcpus % 6 == 0) { final int sockets = vcpus / 6; cmd.setTopology(6, sockets); } else if (vcpus % 4 == 0) { final int sockets = vcpus / 4; cmd.setTopology(4, sockets); } vm.addComponent(cmd); final CpuTuneDef ctd = new CpuTuneDef(); if (VirtualMachineType.DomainRouter.equals(vmTo.getType())) { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuSharesRouter()); } else { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuShares()); } vm.addComponent(ctd); final FeaturesDef features = new FeaturesDef(); features.addFeature("pae"); features.addFeature("apic"); features.addFeature("acpi"); vm.addComponent(features); if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { final HyperVEnlightenmentFeatureDef hyperVFeatures = new HyperVEnlightenmentFeatureDef(); hyperVFeatures.addFeature("relaxed", true); hyperVFeatures.addFeature("vapic", true); hyperVFeatures.addFeature("spinlocks", true); hyperVFeatures.setRetries(8191); features.addHyperVFeature(hyperVFeatures); } final TermPolicy term = new TermPolicy(); if (VirtualMachineType.User.equals(vmTo.getType())) { term.setCrashPolicy(getVmTermpolicyCrash()); term.setPowerOffPolicy(getVmTermpolicyPowerOff()); term.setRebootPolicy(getVmTermpolicyReboot()); } else { term.setCrashPolicy(getSystemTermpolicyCrash()); term.setPowerOffPolicy(getSystemTermpolicyPowerOff()); term.setRebootPolicy(getSystemTermpolicyReboot()); } vm.addComponent(term); final ClockDef clock = new ClockDef(); Boolean kvmClockEnabled = !isKvmClockDisabled(); Boolean hypervClockEnabled = false; Boolean trackGuest = false; if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME); kvmClockEnabled = false; hypervClockEnabled = true; trackGuest = true; } clock.addTimer("kvmclock", null, kvmClockEnabled, false); clock.addTimer("hypervclock", null, hypervClockEnabled, false); clock.addTimer("rtc", "catchup", true, trackGuest); clock.addTimer("pit", "delay", true, false); clock.addTimer("hpet", null, false, false); vm.addComponent(clock); final DevicesDef devices = new DevicesDef(); devices.setEmulatorPath(this.hypervisorPath); devices.setGuestType(guest.getGuestType()); final SerialDef serial = new SerialDef("pty", null, (short) 0); devices.addDevice(serial); final QemuGuestAgentDef guestagent = new QemuGuestAgentDef(); devices.addDevice(guestagent); if (this.libvirtComputingResourceProperties.getVmRngEnable()) { final RngDef rngDevice = new RngDef(this.rngPath, this.rngBackendModel); devices.addDevice(rngDevice); } final WatchDogDef watchDog = new WatchDogDef(this.libvirtComputingResourceProperties.getVmWatchdogAction(), this.libvirtComputingResourceProperties.getVmWatchdogModel()); devices.addDevice(watchDog); final VideoDef videoCard = new VideoDef(this.libvirtComputingResourceProperties.getVmVideoHardware(), this.libvirtComputingResourceProperties.getVmVideoRam()); devices.addDevice(videoCard); final ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0); devices.addDevice(console); final String passwd = vmTo.getVncPassword(); final GraphicDef grap = new GraphicDef("vnc", (short) 0, true, passwd, null); devices.addDevice(grap); final InputDef input = new InputDef("tablet", "usb"); devices.addDevice(input); vmTo.getName(); final ScsiDef sd = new ScsiDef((short) 0, 0, 0, 9, 0, vcpus); devices.addDevice(sd); logger.debug("Adding SCSI definition for " + vmTo.getName() + ":\n" + sd.toString()); vm.addComponent(devices); return vm; }  }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo) { final LibvirtVmDef vm = new LibvirtVmDef(); vm.setDomainName(vmTo.getName()); String uuid = vmTo.getUuid(); uuid = getUuid(uuid); vm.setDomUuid(uuid); vm.setDomDescription("This VM is optimised for: " + vmTo.getOptimiseFor().toString()); vm.setPlatformEmulator(vmTo.getPlatformEmulator()); final MetadataTO metadataTo = vmTo.getMetadata(); if (metadataTo != null) { final MetadataDef metadata = new MetadataDef(); metadata.getNodes().put("cosmicDomainUuid", metadataTo.getDomainUuid()); metadata.getNodes().put("cosmicDomainName", metadataTo.getCosmicDomainName()); metadata.getNodes().put("cosmicDomainPath", metadataTo.getCosmicDomainPath()); metadata.getNodes().put("cosmicInternalVmId", metadataTo.getVmId()); metadata.getNodes().put("cosmicInstanceName", metadataTo.getInstanceName()); metadata.getNodes().put("cosmicXmlGeneratedInCosmicVersion", LibvirtComputingResource.class.getPackage().getImplementationVersion()); metadata.getNodes().put("cosmicXmlGeneratedDateTime", getCurrentLocalDateTimeStamp()); metadata.getNodes().put("cosmicXmlGeneratedEpoch", getCurrentEpoch()); metadata.getNodes().put("cosmicVmHostname", metadataTo.getHostname()); metadata.getNodes().put("cosmicOptimiseFor", vmTo.getOptimiseFor().toString()); final List<String> vpcNameList = metadataTo.getVpcNameList(); if (vpcNameList != null) { for (final String vpcName : vpcNameList) { metadata.getNodes().put("cosmicVPC", vpcName); } } final Map<String, String> vmTags = metadataTo.getResourceTags(); if (vmTags != null) { for (Map.Entry<String, String> vmTag : vmTags.entrySet()) { metadata.getNodes().put("cosmicTag_" + vmTag.getKey(), vmTag.getValue()); } } vm.addComponent(metadata); } final GuestDef guest = new GuestDef(); guest.setGuestType(LibvirtVmDef.GuestType.KVM); vm.setHvsType(HypervisorType.KVM.toString().toLowerCase()); vm.setLibvirtVersion(this.hypervisorLibvirtVersion); vm.setQemuVersion(this.hypervisorQemuVersion); guest.setGuestArch(vmTo.getArch()); guest.setMachineType("pc"); guest.setUuid(uuid); guest.setManufacturer(vmTo.getManufacturer()); guest.setBootMenuTimeout(vmTo.getBootMenuTimeout()); if (vmTo.getBootOrder() != null) { for (BootOrder device : vmTo.getBootOrder()) { guest.setBootOrder(device); } } else { guest.setBootOrder(BootOrder.CDROM); guest.setBootOrder(BootOrder.HARDDISK); } vm.addComponent(guest); final GuestResourceDef grd = new GuestResourceDef(); if (vmTo.getMinRam() != vmTo.getMaxRam() && !this.libvirtComputingResourceProperties.getVmMemballoonDisable()) { grd.setMemBalloning(true); grd.setCurrentMem(vmTo.getMinRam() / 1024); grd.setMemorySize(vmTo.getMaxRam() / 1024); } else { grd.setMemorySize(vmTo.getMaxRam() / 1024); } final int vcpus = vmTo.getCpus(); grd.setVcpuNum(vcpus); vm.addComponent(grd); final CpuModeDef cmd = new CpuModeDef(); cmd.setMode(getGuestCpuMode()); cmd.setModel(getGuestCpuModel()); cmd.setCpuflags(vmTo.getCpuflags()); if (vmTo.getType() == VirtualMachineType.User) { cmd.setFeatures(getCpuFeatures()); } if (OptimiseFor.Windows.equals(vmTo.getOptimiseFor()) && MaintenancePolicy.LiveMigrate.equals(vmTo.getMaintenancePolicy())) { String extended_cpu_flags = vmTo.getCpuflags(); if (extended_cpu_flags == null) { extended_cpu_flags = "-hypervisor"; } else { extended_cpu_flags += " -hypervisor"; } cmd.setCpuflags(extended_cpu_flags); } if (vcpus % 6 == 0) { final int sockets = vcpus / 6; cmd.setTopology(6, sockets); } else if (vcpus % 4 == 0) { final int sockets = vcpus / 4; cmd.setTopology(4, sockets); } vm.addComponent(cmd); final CpuTuneDef ctd = new CpuTuneDef(); if (VirtualMachineType.DomainRouter.equals(vmTo.getType())) { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuSharesRouter()); } else { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuShares()); } vm.addComponent(ctd); final FeaturesDef features = new FeaturesDef(); features.addFeature("pae"); features.addFeature("apic"); features.addFeature("acpi"); vm.addComponent(features); if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { final HyperVEnlightenmentFeatureDef hyperVFeatures = new HyperVEnlightenmentFeatureDef(); hyperVFeatures.addFeature("relaxed", true); hyperVFeatures.addFeature("vapic", true); hyperVFeatures.addFeature("spinlocks", true); hyperVFeatures.setRetries(8191); features.addHyperVFeature(hyperVFeatures); } final TermPolicy term = new TermPolicy(); if (VirtualMachineType.User.equals(vmTo.getType())) { term.setCrashPolicy(getVmTermpolicyCrash()); term.setPowerOffPolicy(getVmTermpolicyPowerOff()); term.setRebootPolicy(getVmTermpolicyReboot()); } else { term.setCrashPolicy(getSystemTermpolicyCrash()); term.setPowerOffPolicy(getSystemTermpolicyPowerOff()); term.setRebootPolicy(getSystemTermpolicyReboot()); } vm.addComponent(term); final ClockDef clock = new ClockDef(); Boolean kvmClockEnabled = !isKvmClockDisabled(); Boolean hypervClockEnabled = false; Boolean trackGuest = false; if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME); kvmClockEnabled = false; hypervClockEnabled = true; trackGuest = true; } clock.addTimer("kvmclock", null, kvmClockEnabled, false); clock.addTimer("hypervclock", null, hypervClockEnabled, false); clock.addTimer("rtc", "catchup", true, trackGuest); clock.addTimer("pit", "delay", true, false); clock.addTimer("hpet", null, false, false); vm.addComponent(clock); final DevicesDef devices = new DevicesDef(); devices.setEmulatorPath(this.hypervisorPath); devices.setGuestType(guest.getGuestType()); final SerialDef serial = new SerialDef("pty", null, (short) 0); devices.addDevice(serial); final QemuGuestAgentDef guestagent = new QemuGuestAgentDef(); devices.addDevice(guestagent); if (this.libvirtComputingResourceProperties.getVmRngEnable()) { final RngDef rngDevice = new RngDef(this.rngPath, this.rngBackendModel); devices.addDevice(rngDevice); } final WatchDogDef watchDog = new WatchDogDef(this.libvirtComputingResourceProperties.getVmWatchdogAction(), this.libvirtComputingResourceProperties.getVmWatchdogModel()); devices.addDevice(watchDog); final VideoDef videoCard = new VideoDef(this.libvirtComputingResourceProperties.getVmVideoHardware(), this.libvirtComputingResourceProperties.getVmVideoRam()); devices.addDevice(videoCard); final ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0); devices.addDevice(console); final String passwd = vmTo.getVncPassword(); final GraphicDef grap = new GraphicDef("vnc", (short) 0, true, passwd, null); devices.addDevice(grap); final InputDef input = new InputDef("tablet", "usb"); devices.addDevice(input); vmTo.getName(); final ScsiDef sd = new ScsiDef((short) 0, 0, 0, 9, 0, vcpus); devices.addDevice(sd); logger.debug("Adding SCSI definition for " + vmTo.getName() + ":\n" + sd.toString()); vm.addComponent(devices); return vm; }  @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args); @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout); @Override ExecutionResult createFileInVR(final String routerIp, final String path, final String filename,
                                          final String content); @Override ExecutionResult prepareCommand(final NetworkElementCommand cmd); @Override ExecutionResult cleanupCommand(final NetworkElementCommand cmd); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName, final String interfaceToExclude); List<VifDriver> getAllVifDrivers(); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName); String networkUsage(final String privateIpAddress, final String option, final String vif); Domain getDomain(final Connect conn, final String vmName); VifDriver getVifDriver(final TrafficType trafficType); boolean isInterface(final String fname); LibvirtUtilitiesHelper getLibvirtUtilitiesHelper(); CpuStat getCpuStat(); MemStat getMemStat(); VirtualRoutingResource getVirtRouterResource(); String getPublicBridgeName(); KvmStoragePoolManager getStoragePoolMgr(); String getPrivateIp(); int getMigrateDowntime(); int getMigratePauseAfter(); int getMigrateSpeed(); int getMigrateSpeedAcrossCluster(); int getVmBlockCopySpeed(); String getPingTestPath(); String getUpdateHostPasswdPath(); int getScriptsTimeout(); KvmHaMonitor getMonitor(); StorageLayer getStorage(); String createTmplPath(); int getCmdsTimeout(); String manageSnapshotPath(); String getGuestBridgeName(); String getOvsPvlanDhcpHostPath(); String getOvsPvlanVmPath(); StorageSubsystemCommandHandler getStorageHandler(); @Override boolean configure(final Map<String, Object> params); @Override void configure(final AgentConfiguration agentConfiguration); @Override Answer executeRequest(final Command cmd); @Override boolean stop(); boolean passCmdLine(final String vmName, final String cmdLine); boolean checkNetwork(final String networkName); KvmPhysicalDisk templateToPrimaryDownload(final String templateUrl, final KvmStoragePool primaryPool,
                                                     final String volUuid); PowerState getVmState(final Connect conn, final String vmName); long[] getNetworkStats(final String privateIp); long[] getVpcNetworkStats(final String privateIp, final String publicIp, final String option); String configureVpcNetworkUsage(final String privateIpAddress, final String publicIp, final String option,
                                           final String vpcCidr); void handleVmStartFailure(final LibvirtVmDef vm); String getCurrentLocalDateTimeStamp(); Long getCurrentEpoch(); LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo); boolean isGuestVirtIoCapable(final String guestOsName); void createVifs(final VirtualMachineTO vmSpec, final LibvirtVmDef vm); String getVolumePath(final Connect conn, final DiskTO volume); @Override PingCommand getCurrentStatus(final long id); void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVmDef vm); @Override HostType getType(); String diskUuidToSerial(final String uuid); @Override StartupCommand[] initialize(); synchronized String attachOrDetachIso(final Connect conn, final String vmName, String isoPath,
                                                 final boolean isAttach); List<LibvirtDiskDef> getDisks(final Connect conn, final String vmName); boolean cleanupDisk(final LibvirtDiskDef disk); String rebootVm(final Connect conn, final String vmName); String stopVm(final Connect conn, final String vmName, final boolean forceStop); String startVm(final Connect conn, final String vmName, final String domainXml); List<Ternary<String, Boolean, String>> cleanVMSnapshotMetadata(final Domain dm); void restoreVMSnapshotMetadata(final Domain dm, final String vmName, final List<Ternary<String, Boolean, String>> vmsnapshots); Integer getVncPort(final Connect conn, final String vmName); List<VmDiskStatsEntry> getVmDiskStat(final Connect conn, final String vmName); VmStatsEntry getVmStat(final Connect conn, final String vmName); Pair<Double, Double> getNicStats(final String nicName); @Override void setName(final String name); List<String> getCpuFeatures(); String getSystemTermpolicyCrash(); String getSystemTermpolicyPowerOff(); String getSystemTermpolicyReboot(); String getVmTermpolicyCrash(); String getVmTermpolicyPowerOff(); String getVmTermpolicyReboot(); String[] getIfNamePatterns(); long getTotalMemory(); }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo) { final LibvirtVmDef vm = new LibvirtVmDef(); vm.setDomainName(vmTo.getName()); String uuid = vmTo.getUuid(); uuid = getUuid(uuid); vm.setDomUuid(uuid); vm.setDomDescription("This VM is optimised for: " + vmTo.getOptimiseFor().toString()); vm.setPlatformEmulator(vmTo.getPlatformEmulator()); final MetadataTO metadataTo = vmTo.getMetadata(); if (metadataTo != null) { final MetadataDef metadata = new MetadataDef(); metadata.getNodes().put("cosmicDomainUuid", metadataTo.getDomainUuid()); metadata.getNodes().put("cosmicDomainName", metadataTo.getCosmicDomainName()); metadata.getNodes().put("cosmicDomainPath", metadataTo.getCosmicDomainPath()); metadata.getNodes().put("cosmicInternalVmId", metadataTo.getVmId()); metadata.getNodes().put("cosmicInstanceName", metadataTo.getInstanceName()); metadata.getNodes().put("cosmicXmlGeneratedInCosmicVersion", LibvirtComputingResource.class.getPackage().getImplementationVersion()); metadata.getNodes().put("cosmicXmlGeneratedDateTime", getCurrentLocalDateTimeStamp()); metadata.getNodes().put("cosmicXmlGeneratedEpoch", getCurrentEpoch()); metadata.getNodes().put("cosmicVmHostname", metadataTo.getHostname()); metadata.getNodes().put("cosmicOptimiseFor", vmTo.getOptimiseFor().toString()); final List<String> vpcNameList = metadataTo.getVpcNameList(); if (vpcNameList != null) { for (final String vpcName : vpcNameList) { metadata.getNodes().put("cosmicVPC", vpcName); } } final Map<String, String> vmTags = metadataTo.getResourceTags(); if (vmTags != null) { for (Map.Entry<String, String> vmTag : vmTags.entrySet()) { metadata.getNodes().put("cosmicTag_" + vmTag.getKey(), vmTag.getValue()); } } vm.addComponent(metadata); } final GuestDef guest = new GuestDef(); guest.setGuestType(LibvirtVmDef.GuestType.KVM); vm.setHvsType(HypervisorType.KVM.toString().toLowerCase()); vm.setLibvirtVersion(this.hypervisorLibvirtVersion); vm.setQemuVersion(this.hypervisorQemuVersion); guest.setGuestArch(vmTo.getArch()); guest.setMachineType("pc"); guest.setUuid(uuid); guest.setManufacturer(vmTo.getManufacturer()); guest.setBootMenuTimeout(vmTo.getBootMenuTimeout()); if (vmTo.getBootOrder() != null) { for (BootOrder device : vmTo.getBootOrder()) { guest.setBootOrder(device); } } else { guest.setBootOrder(BootOrder.CDROM); guest.setBootOrder(BootOrder.HARDDISK); } vm.addComponent(guest); final GuestResourceDef grd = new GuestResourceDef(); if (vmTo.getMinRam() != vmTo.getMaxRam() && !this.libvirtComputingResourceProperties.getVmMemballoonDisable()) { grd.setMemBalloning(true); grd.setCurrentMem(vmTo.getMinRam() / 1024); grd.setMemorySize(vmTo.getMaxRam() / 1024); } else { grd.setMemorySize(vmTo.getMaxRam() / 1024); } final int vcpus = vmTo.getCpus(); grd.setVcpuNum(vcpus); vm.addComponent(grd); final CpuModeDef cmd = new CpuModeDef(); cmd.setMode(getGuestCpuMode()); cmd.setModel(getGuestCpuModel()); cmd.setCpuflags(vmTo.getCpuflags()); if (vmTo.getType() == VirtualMachineType.User) { cmd.setFeatures(getCpuFeatures()); } if (OptimiseFor.Windows.equals(vmTo.getOptimiseFor()) && MaintenancePolicy.LiveMigrate.equals(vmTo.getMaintenancePolicy())) { String extended_cpu_flags = vmTo.getCpuflags(); if (extended_cpu_flags == null) { extended_cpu_flags = "-hypervisor"; } else { extended_cpu_flags += " -hypervisor"; } cmd.setCpuflags(extended_cpu_flags); } if (vcpus % 6 == 0) { final int sockets = vcpus / 6; cmd.setTopology(6, sockets); } else if (vcpus % 4 == 0) { final int sockets = vcpus / 4; cmd.setTopology(4, sockets); } vm.addComponent(cmd); final CpuTuneDef ctd = new CpuTuneDef(); if (VirtualMachineType.DomainRouter.equals(vmTo.getType())) { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuSharesRouter()); } else { ctd.setShares(vmTo.getCpus() * this.libvirtComputingResourceProperties.getGuestCpuShares()); } vm.addComponent(ctd); final FeaturesDef features = new FeaturesDef(); features.addFeature("pae"); features.addFeature("apic"); features.addFeature("acpi"); vm.addComponent(features); if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { final HyperVEnlightenmentFeatureDef hyperVFeatures = new HyperVEnlightenmentFeatureDef(); hyperVFeatures.addFeature("relaxed", true); hyperVFeatures.addFeature("vapic", true); hyperVFeatures.addFeature("spinlocks", true); hyperVFeatures.setRetries(8191); features.addHyperVFeature(hyperVFeatures); } final TermPolicy term = new TermPolicy(); if (VirtualMachineType.User.equals(vmTo.getType())) { term.setCrashPolicy(getVmTermpolicyCrash()); term.setPowerOffPolicy(getVmTermpolicyPowerOff()); term.setRebootPolicy(getVmTermpolicyReboot()); } else { term.setCrashPolicy(getSystemTermpolicyCrash()); term.setPowerOffPolicy(getSystemTermpolicyPowerOff()); term.setRebootPolicy(getSystemTermpolicyReboot()); } vm.addComponent(term); final ClockDef clock = new ClockDef(); Boolean kvmClockEnabled = !isKvmClockDisabled(); Boolean hypervClockEnabled = false; Boolean trackGuest = false; if (vmTo.getOptimiseFor() == OptimiseFor.Windows) { clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME); kvmClockEnabled = false; hypervClockEnabled = true; trackGuest = true; } clock.addTimer("kvmclock", null, kvmClockEnabled, false); clock.addTimer("hypervclock", null, hypervClockEnabled, false); clock.addTimer("rtc", "catchup", true, trackGuest); clock.addTimer("pit", "delay", true, false); clock.addTimer("hpet", null, false, false); vm.addComponent(clock); final DevicesDef devices = new DevicesDef(); devices.setEmulatorPath(this.hypervisorPath); devices.setGuestType(guest.getGuestType()); final SerialDef serial = new SerialDef("pty", null, (short) 0); devices.addDevice(serial); final QemuGuestAgentDef guestagent = new QemuGuestAgentDef(); devices.addDevice(guestagent); if (this.libvirtComputingResourceProperties.getVmRngEnable()) { final RngDef rngDevice = new RngDef(this.rngPath, this.rngBackendModel); devices.addDevice(rngDevice); } final WatchDogDef watchDog = new WatchDogDef(this.libvirtComputingResourceProperties.getVmWatchdogAction(), this.libvirtComputingResourceProperties.getVmWatchdogModel()); devices.addDevice(watchDog); final VideoDef videoCard = new VideoDef(this.libvirtComputingResourceProperties.getVmVideoHardware(), this.libvirtComputingResourceProperties.getVmVideoRam()); devices.addDevice(videoCard); final ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0); devices.addDevice(console); final String passwd = vmTo.getVncPassword(); final GraphicDef grap = new GraphicDef("vnc", (short) 0, true, passwd, null); devices.addDevice(grap); final InputDef input = new InputDef("tablet", "usb"); devices.addDevice(input); vmTo.getName(); final ScsiDef sd = new ScsiDef((short) 0, 0, 0, 9, 0, vcpus); devices.addDevice(sd); logger.debug("Adding SCSI definition for " + vmTo.getName() + ":\n" + sd.toString()); vm.addComponent(devices); return vm; }  @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args); @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout); @Override ExecutionResult createFileInVR(final String routerIp, final String path, final String filename,
                                          final String content); @Override ExecutionResult prepareCommand(final NetworkElementCommand cmd); @Override ExecutionResult cleanupCommand(final NetworkElementCommand cmd); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName, final String interfaceToExclude); List<VifDriver> getAllVifDrivers(); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName); String networkUsage(final String privateIpAddress, final String option, final String vif); Domain getDomain(final Connect conn, final String vmName); VifDriver getVifDriver(final TrafficType trafficType); boolean isInterface(final String fname); LibvirtUtilitiesHelper getLibvirtUtilitiesHelper(); CpuStat getCpuStat(); MemStat getMemStat(); VirtualRoutingResource getVirtRouterResource(); String getPublicBridgeName(); KvmStoragePoolManager getStoragePoolMgr(); String getPrivateIp(); int getMigrateDowntime(); int getMigratePauseAfter(); int getMigrateSpeed(); int getMigrateSpeedAcrossCluster(); int getVmBlockCopySpeed(); String getPingTestPath(); String getUpdateHostPasswdPath(); int getScriptsTimeout(); KvmHaMonitor getMonitor(); StorageLayer getStorage(); String createTmplPath(); int getCmdsTimeout(); String manageSnapshotPath(); String getGuestBridgeName(); String getOvsPvlanDhcpHostPath(); String getOvsPvlanVmPath(); StorageSubsystemCommandHandler getStorageHandler(); @Override boolean configure(final Map<String, Object> params); @Override void configure(final AgentConfiguration agentConfiguration); @Override Answer executeRequest(final Command cmd); @Override boolean stop(); boolean passCmdLine(final String vmName, final String cmdLine); boolean checkNetwork(final String networkName); KvmPhysicalDisk templateToPrimaryDownload(final String templateUrl, final KvmStoragePool primaryPool,
                                                     final String volUuid); PowerState getVmState(final Connect conn, final String vmName); long[] getNetworkStats(final String privateIp); long[] getVpcNetworkStats(final String privateIp, final String publicIp, final String option); String configureVpcNetworkUsage(final String privateIpAddress, final String publicIp, final String option,
                                           final String vpcCidr); void handleVmStartFailure(final LibvirtVmDef vm); String getCurrentLocalDateTimeStamp(); Long getCurrentEpoch(); LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo); boolean isGuestVirtIoCapable(final String guestOsName); void createVifs(final VirtualMachineTO vmSpec, final LibvirtVmDef vm); String getVolumePath(final Connect conn, final DiskTO volume); @Override PingCommand getCurrentStatus(final long id); void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVmDef vm); @Override HostType getType(); String diskUuidToSerial(final String uuid); @Override StartupCommand[] initialize(); synchronized String attachOrDetachIso(final Connect conn, final String vmName, String isoPath,
                                                 final boolean isAttach); List<LibvirtDiskDef> getDisks(final Connect conn, final String vmName); boolean cleanupDisk(final LibvirtDiskDef disk); String rebootVm(final Connect conn, final String vmName); String stopVm(final Connect conn, final String vmName, final boolean forceStop); String startVm(final Connect conn, final String vmName, final String domainXml); List<Ternary<String, Boolean, String>> cleanVMSnapshotMetadata(final Domain dm); void restoreVMSnapshotMetadata(final Domain dm, final String vmName, final List<Ternary<String, Boolean, String>> vmsnapshots); Integer getVncPort(final Connect conn, final String vmName); List<VmDiskStatsEntry> getVmDiskStat(final Connect conn, final String vmName); VmStatsEntry getVmStat(final Connect conn, final String vmName); Pair<Double, Double> getNicStats(final String nicName); @Override void setName(final String name); List<String> getCpuFeatures(); String getSystemTermpolicyCrash(); String getSystemTermpolicyPowerOff(); String getSystemTermpolicyReboot(); String getVmTermpolicyCrash(); String getVmTermpolicyPowerOff(); String getVmTermpolicyReboot(); String[] getIfNamePatterns(); long getTotalMemory(); static final String SSHKEYSPATH; static final String SSHPRVKEYPATH; static final String SSHPUBKEYPATH; static final String BASH_SCRIPT_PATH; }