Search in sources :

Example 86 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class RemoveCpuQosCommand method executeCommand.

@Override
protected void executeCommand() {
    List<Guid> vmIds = vmSlaPolicyUtils.getRunningVmsWithCpuQos(getQosId());
    super.executeCommand();
    // After successful command, refresh qos
    CpuQos unlimitedQos = new CpuQos();
    unlimitedQos.setCpuLimit(100);
    vmSlaPolicyUtils.refreshVmsCpuQos(vmIds, unlimitedQos);
}
Also used : CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) Guid(org.ovirt.engine.core.compat.Guid)

Example 87 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class GetProviderByIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Guid id = getParameters().getId();
    Provider<?> provider = dao.get(id);
    getQueryReturnValue().setReturnValue(provider);
}
Also used : Guid(org.ovirt.engine.core.compat.Guid)

Example 88 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class UpdateDiskProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    // Chcek if qos has changed
    Guid oldQos = diskProfileDao.get(getProfileId()).getQosId();
    Guid newQos = getProfile().getQosId();
    super.executeCommand();
    // QoS did not change
    if (Objects.equals(oldQos, newQos)) {
        return;
    }
    // Profile changes are already persisted in the database
    if (getSucceeded()) {
        vmSlaPolicyUtils.refreshRunningVmsWithDiskProfile(getProfileId());
    }
}
Also used : Guid(org.ovirt.engine.core.compat.Guid)

Example 89 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class CreateOvfVolumeForStorageDomainCommand method logFailure.

private void logFailure() {
    Guid createdDiskId = getActionReturnValue();
    if (createdDiskId != null) {
        addCustomValue("DiskId", createdDiskId.toString());
        auditLogDirector.log(this, AuditLogType.CREATE_OVF_STORE_FOR_STORAGE_DOMAIN_FAILED);
    } else {
        auditLogDirector.log(this, AuditLogType.CREATE_OVF_STORE_FOR_STORAGE_DOMAIN_INITIATE_FAILED);
    }
}
Also used : Guid(org.ovirt.engine.core.compat.Guid)

Example 90 with Guid

use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.

the class OvfHelper method readVmFromOvf.

/**
 * parses a given ovf to a vm, initialize all the extra data related to it such as images, interfaces, cluster,
 * LUNS, etc..
 *
 * @return FullEntityOvfData that represents the given ovf data
 */
public FullEntityOvfData readVmFromOvf(String ovf) throws OvfReaderException {
    VM vm = new VM();
    FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm);
    ovfManager.importVm(ovf, vm, fullEntityOvfData);
    // add images
    vm.setImages((ArrayList) fullEntityOvfData.getDiskImages());
    // add interfaces
    vm.setInterfaces(fullEntityOvfData.getInterfaces());
    // add disk map
    Map<Guid, List<DiskImage>> images = ImagesHandler.getImagesLeaf(fullEntityOvfData.getDiskImages());
    for (Map.Entry<Guid, List<DiskImage>> entry : images.entrySet()) {
        List<DiskImage> list = entry.getValue();
        vm.getDiskMap().put(entry.getKey(), list.get(list.size() - 1));
    }
    fullEntityOvfData.getLunDisks().forEach(lunDisk -> vm.getDiskMap().put(lunDisk.getId(), lunDisk));
    return fullEntityOvfData;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) FullEntityOvfData(org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData) HashMap(java.util.HashMap) Map(java.util.Map) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

Guid (org.ovirt.engine.core.compat.Guid)1431 ArrayList (java.util.ArrayList)330 Test (org.junit.Test)322 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)219 HashMap (java.util.HashMap)211 List (java.util.List)167 VM (org.ovirt.engine.core.common.businessentities.VM)144 Map (java.util.Map)118 VDS (org.ovirt.engine.core.common.businessentities.VDS)117 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)106 HashSet (java.util.HashSet)102 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)89 Pair (org.ovirt.engine.core.common.utils.Pair)79 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)77 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)72 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)70 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)69 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)57 ActionType (org.ovirt.engine.core.common.action.ActionType)56 Set (java.util.Set)52