Search in sources :

Example 26 with FullEntityOvfData

use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.

the class ExportVmCommand method updateVmInSpm.

protected void updateVmInSpm() {
    Map<Guid, KeyValuePairCompat<String, List<Guid>>> metaDictionary = new HashMap<>();
    ovfUpdateProcessHelper.loadVmData(getVm());
    FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(getVm());
    fullEntityOvfData.setClusterName(getVm().getClusterName());
    fullEntityOvfData.setDiskImages(ovfUpdateProcessHelper.getVmImagesFromDb(getVm()));
    ovfUpdateProcessHelper.buildMetadataDictionaryForVm(getVm(), metaDictionary, fullEntityOvfData);
    ovfUpdateProcessHelper.executeUpdateVmInSpmCommand(getVm().getStoragePoolId(), metaDictionary, getParameters().getStorageDomainId());
}
Also used : KeyValuePairCompat(org.ovirt.engine.core.compat.KeyValuePairCompat) HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid) FullEntityOvfData(org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData)

Example 27 with FullEntityOvfData

use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.

the class CreateOvaCommand method executeCommand.

@Override
protected void executeCommand() {
    Map<DiskImage, DiskImage> diskMappings = getParameters().getDiskInfoDestinationMap();
    Collection<DiskImage> disks = diskMappings.values();
    Map<Guid, String> diskIdToPath = prepareImages(disks);
    fillDiskApparentSize(disks);
    VM vm = getParameters().getVm();
    vmHandler.updateNetworkInterfacesFromDb(vm);
    vmHandler.updateVmInitFromDB(vm.getStaticData(), true);
    vmDeviceUtils.setVmDevices(vm.getStaticData());
    fixDiskDevices(vm, diskMappings);
    FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm);
    fullEntityOvfData.setDiskImages(new ArrayList<>(disks));
    fullEntityOvfData.setInterfaces(vm.getInterfaces());
    String ovf = ovfManager.exportOva(vm, fullEntityOvfData, vm.getCompatibilityVersion());
    log.debug("Exporting OVF: {}", ovf);
    boolean succeeded = runAnsiblePackOvaPlaybook(vm.getName(), ovf, disks, diskIdToPath);
    teardownImages(disks);
    setSucceeded(succeeded);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Guid(org.ovirt.engine.core.compat.Guid) FullEntityOvfData(org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

FullEntityOvfData (org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData)27 VM (org.ovirt.engine.core.common.businessentities.VM)17 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)13 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 Guid (org.ovirt.engine.core.compat.Guid)7 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)6 HashMap (java.util.HashMap)5 OvfReaderException (org.ovirt.engine.core.utils.ovf.OvfReaderException)5 OvfEntityData (org.ovirt.engine.core.common.businessentities.OvfEntityData)4 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)4 KeyValuePairCompat (org.ovirt.engine.core.compat.KeyValuePairCompat)4 HashSet (java.util.HashSet)3 List (java.util.List)2 Map (java.util.Map)2 Before (org.junit.Before)2 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 Label (org.ovirt.engine.core.common.businessentities.Label)2 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)2