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()));
}
Aggregations