Search in sources :

Example 61 with GuestOSVO

use of com.cloud.storage.GuestOSVO in project cloudstack by apache.

the class DeployAsIsHelperImpl method updateDeployAsIsTemplateToNewGuestOs.

/**
 * Updates the deploy-as-is template guest OS doing:
 * - Create a new guest OS with the guest OS description parsed from the OVF
 * - Create mappings for the new guest OS and supported hypervisor versions
 * - Update the template guest OS ID to the new guest OS ID
 */
private void updateDeployAsIsTemplateToNewGuestOs(VMTemplateVO template, String guestOsType, String guestOsDescription, Hypervisor.HypervisorType hypervisor, Collection<String> hypervisorVersions) {
    GuestOSVO newGuestOs = createGuestOsEntry(guestOsDescription);
    for (String hypervisorVersion : hypervisorVersions) {
        LOGGER.info(String.format("Adding a new guest OS mapping for hypervisor: %s version: %s and " + "guest OS: %s", hypervisor.toString(), hypervisorVersion, guestOsType));
        createGuestOsHypervisorMapping(newGuestOs.getId(), guestOsType, hypervisor.toString(), hypervisorVersion);
    }
    updateTemplateGuestOsId(template, newGuestOs.getId());
}
Also used : GuestOSVO(com.cloud.storage.GuestOSVO)

Example 62 with GuestOSVO

use of com.cloud.storage.GuestOSVO in project cloudstack by apache.

the class BareMetalGuru method implement.

@Override
public VirtualMachineTO implement(VirtualMachineProfile vm) {
    VirtualMachineTO to = toVirtualMachineTO(vm);
    VMInstanceVO vo = _vmDao.findById(vm.getId());
    if (vo.getLastHostId() == null) {
        to.setBootArgs(BaremetalManager.DO_PXE);
    }
    Map<String, String> details = new HashMap<String, String>();
    details.put("template", vm.getTemplate().getUrl());
    to.setDetails(details);
    // Determine the VM's OS description
    GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
    to.setOs(guestOS.getDisplayName());
    return to;
}
Also used : HashMap(java.util.HashMap) VMInstanceVO(com.cloud.vm.VMInstanceVO) GuestOSVO(com.cloud.storage.GuestOSVO) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO)

Aggregations

GuestOSVO (com.cloud.storage.GuestOSVO)62 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)26 GuestOSHypervisorVO (com.cloud.storage.GuestOSHypervisorVO)23 HostVO (com.cloud.host.HostVO)20 UserVmVO (com.cloud.vm.UserVmVO)20 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)17 OperationTimedoutException (com.cloud.exception.OperationTimedoutException)17 VMSnapshotTO (com.cloud.agent.api.VMSnapshotTO)15 VMSnapshotVO (com.cloud.vm.snapshot.VMSnapshotVO)15 ArrayList (java.util.ArrayList)15 HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)12 VolumeObjectTO (org.apache.cloudstack.storage.to.VolumeObjectTO)12 VirtualMachineTO (com.cloud.agent.api.to.VirtualMachineTO)11 Test (org.junit.Test)11 Command (com.cloud.agent.api.Command)9 CreateVMSnapshotAnswer (com.cloud.agent.api.CreateVMSnapshotAnswer)9 IOException (java.io.IOException)9 HashMap (java.util.HashMap)9 RevertToVMSnapshotAnswer (com.cloud.agent.api.RevertToVMSnapshotAnswer)7 VMTemplateVO (com.cloud.storage.VMTemplateVO)7