Search in sources :

Example 1 with HotPlugDiskVDSParameters

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

the class AbstractDiskVmCommand method performPlugCommand.

protected void performPlugCommand(VDSCommandType commandType, Disk disk, VmDevice vmDevice) {
    if (disk.getDiskStorageType() == DiskStorageType.LUN) {
        LunDisk lunDisk = (LunDisk) disk;
        if (commandType == VDSCommandType.HotPlugDisk) {
            LUNs lun = lunDisk.getLun();
            updateLUNConnectionsInfo(lun);
            lun.getLunConnections().stream().map(StorageServerConnections::getStorageType).distinct().forEach(t -> {
                if (!getStorageHelper(t).connectStorageToLunByVdsId(null, getVm().getRunOnVds(), lun, getVm().getStoragePoolId())) {
                    throw new EngineException(EngineError.StorageServerConnectionError);
                }
            });
        }
    } else if (disk.getDiskStorageType() == DiskStorageType.CINDER) {
        CinderDisk cinderDisk = (CinderDisk) disk;
        setStorageDomainId(cinderDisk.getStorageIds().get(0));
        getCinderBroker().updateConnectionInfoForDisk(cinderDisk);
    }
    Map<String, String> diskAddressMap = getDiskAddressMap(vmDevice, getDiskVmElement().getDiskInterface());
    runVdsCommand(commandType, new HotPlugDiskVDSParameters(getVm().getRunOnVds(), getVm(), disk, vmDevice, diskAddressMap, getDiskVmElement().getDiskInterface(), getDiskVmElement().isPassDiscard()));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) EngineException(org.ovirt.engine.core.common.errors.EngineException) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) HotPlugDiskVDSParameters(org.ovirt.engine.core.common.vdscommands.HotPlugDiskVDSParameters)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)1 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)1 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 HotPlugDiskVDSParameters (org.ovirt.engine.core.common.vdscommands.HotPlugDiskVDSParameters)1