Search in sources :

Example 1 with HibernateVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.HibernateVDSCommandParameters in project ovirt-engine by oVirt.

the class HibernateVmCommand method endSuccessfully.

@Override
protected void endSuccessfully() {
    if (getVm().getStatus() != VMStatus.Up) {
        log.warn("VM '{}' is not up, cannot Hibernate.", getVm().getName());
        endWithFailure();
        return;
    }
    List<ActionReturnValue> addDiskReturnValues = endActionOnDisks();
    DiskImage dumpDisk = getMemoryDumpDisk(addDiskReturnValues);
    DiskImage metadataDisk = getMemoryMetadataDisk(addDiskReturnValues);
    String hiberVol = MemoryUtils.createMemoryStateString(getStorageDomainId(), getStoragePoolId(), dumpDisk.getId(), dumpDisk.getImageId(), metadataDisk.getId(), metadataDisk.getImageId());
    try {
        runVdsCommand(VDSCommandType.Hibernate, new HibernateVDSCommandParameters(getVm().getRunOnVds(), getVmId(), hiberVol));
        snapshotDao.updateHibernationMemory(getVmId(), dumpDisk.getId(), metadataDisk.getId());
    } catch (EngineException e) {
        hibernateVdsProblematic = true;
        endWithFailure();
        return;
    }
    setSucceeded(true);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HibernateVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.HibernateVDSCommandParameters) EngineException(org.ovirt.engine.core.common.errors.EngineException) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 HibernateVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.HibernateVDSCommandParameters)1