use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class SanStorageModelBase method createTargetModelList.
private ArrayList<SanTargetModel> createTargetModelList(LUNs a) {
ArrayList<SanTargetModel> targetModelList = new ArrayList<>();
if (a.getLunConnections() != null) {
for (StorageServerConnections b : a.getLunConnections()) {
SanTargetModel model = new SanTargetModel();
model.setAddress(b.getConnection());
model.setPort(b.getPort());
model.setPortal(b.getPortal());
model.setName(b.getIqn());
model.setIsSelected(true);
model.setIsLoggedIn(true);
model.setLuns(new ObservableCollection<>());
model.getLoginCommand().setIsExecutionAllowed(false);
targetModelList.add(model);
}
}
return targetModelList;
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class SanStorageModelBase method discoverTargets.
private void discoverTargets() {
if (!validateDiscoverTargetFields()) {
return;
}
VDS host = getContainer().getHost().getSelectedItem();
StorageServerConnections tempVar = new StorageServerConnections();
tempVar.setConnection(getAddress().getEntity().trim());
tempVar.setPort(getPort().getEntity().trim());
tempVar.setStorageType(StorageType.ISCSI);
// $NON-NLS-1$
tempVar.setUserName(getUseUserAuth().getEntity() ? getUserName().getEntity() : "");
// $NON-NLS-1$
tempVar.setPassword(getUseUserAuth().getEntity() ? getPassword().getEntity() : "");
DiscoverSendTargetsQueryParameters parameters = new DiscoverSendTargetsQueryParameters(host.getId(), tempVar);
setMessage(null);
final SanStorageModelBase model = this;
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
Object result = returnValue.getReturnValue();
model.postDiscoverTargetsInternal(result != null ? (ArrayList<StorageServerConnections>) result : new ArrayList<>());
}, true);
Frontend.getInstance().runQuery(QueryType.DiscoverSendTargets, parameters, asyncQuery);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class HSMGetStorageDomainInfoVDSCommand method buildStorageStaticFromStruct.
private static Pair<StorageDomainStatic, Guid> buildStorageStaticFromStruct(Map<String, Object> struct) {
Pair<StorageDomainStatic, Guid> returnValue = new Pair<>();
StorageDomainStatic sdStatic = new StorageDomainStatic();
if (struct.containsKey("name")) {
sdStatic.setStorageName(struct.get("name").toString());
}
if (struct.containsKey("type")) {
sdStatic.setStorageType(EnumUtils.valueOf(StorageType.class, struct.get("type").toString(), true));
}
if (struct.containsKey("class")) {
String domainType = struct.get("class").toString();
if ("backup".equalsIgnoreCase(domainType)) {
sdStatic.setStorageDomainType(StorageDomainType.ImportExport);
} else {
sdStatic.setStorageDomainType(EnumUtils.valueOf(StorageDomainType.class, domainType, true));
}
}
if (struct.containsKey("version")) {
sdStatic.setStorageFormat(StorageFormatType.forValue(struct.get("version").toString()));
}
if (sdStatic.getStorageType() != StorageType.UNKNOWN) {
if (sdStatic.getStorageType().isFileDomain() && struct.containsKey("remotePath")) {
String path = struct.get("remotePath").toString();
List<StorageServerConnections> connections = DbFacade.getInstance().getStorageServerConnectionDao().getAllForStorage(path);
if (connections.isEmpty()) {
sdStatic.setConnection(new StorageServerConnections());
sdStatic.getConnection().setConnection(path);
sdStatic.getConnection().setStorageType(sdStatic.getStorageType());
} else {
sdStatic.setStorage(connections.get(0).getId());
sdStatic.setConnection(connections.get(0));
}
} else if (sdStatic.getStorageType() != StorageType.NFS) {
if (struct.containsKey("vguuid")) {
sdStatic.setStorage(struct.get("vguuid").toString());
}
if (struct.containsKey("metadataDevice")) {
sdStatic.setFirstMetadataDevice(Objects.toString(struct.get("metadataDevice")));
}
if (struct.containsKey("vgMetadataDevice")) {
sdStatic.setVgMetadataDevice(Objects.toString(struct.get("vgMetadataDevice")));
}
}
}
if (struct.containsKey("state")) {
sdStatic.setSanState(EnumUtils.valueOf(SANState.class, struct.get("state").toString().toUpperCase(), false));
}
returnValue.setFirst(sdStatic);
Object[] poolUUIDs = (Object[]) struct.get("pool");
if (poolUUIDs.length != 0) {
returnValue.setSecond(Guid.createGuidFromString(poolUUIDs[0].toString()));
}
return returnValue;
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class ConnectStorageServerVDSCommand method buildStructFromConnectionListObject.
@SuppressWarnings("unchecked")
protected Map<String, String>[] buildStructFromConnectionListObject() {
final Map<String, String>[] result = new HashMap[getParameters().getConnectionList().size()];
int i = 0;
for (StorageServerConnections connection : getParameters().getConnectionList()) {
result[i] = storageConnectionHelper.createStructFromConnection(connection, getParameters().getVdsId());
i++;
}
return result;
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class DiscoverSendTargetsVDSCommand method parseTargets.
private List<StorageServerConnections> parseTargets(List<String> iqnList) {
List<StorageServerConnections> connections = new ArrayList<>(iqnList.size());
for (String iqn : iqnList) {
StorageServerConnections con = StorageServerConnections.copyOf(getParameters().getConnection());
con.setIqn(iqn);
connections.add(con);
}
return connections;
}
Aggregations