use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method succeedValidateNFS.
@Test
public void succeedValidateNFS() {
StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
parameters.setStorageServerConnection(newNFSConnection);
StorageDomain domain1 = new StorageDomain();
domain1.setStorage(newNFSConnection.getConnection());
domain1.setStatus(StorageDomainStatus.Maintenance);
initDomainListForConnection(newNFSConnection.getId(), domain1);
when(storageConnDao.get(newNFSConnection.getId())).thenReturn(oldNFSConnection);
doReturn(false).when(command).isConnWithSameDetailsExists(newNFSConnection, null);
ValidateTestUtils.runAndAssertValidateSuccess(command);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class BackendHostResource method iscsiLogin.
@Override
public Response iscsiLogin(Action action) {
validateParameters(action, "iscsi.address", "iscsi.target");
StorageServerConnections cnx = new StorageServerConnections();
IscsiDetails iscsiDetails = action.getIscsi();
cnx.setConnection(iscsiDetails.getAddress());
cnx.setIqn(iscsiDetails.getTarget());
cnx.setStorageType(StorageType.ISCSI);
if (iscsiDetails.isSetPort()) {
cnx.setPort(iscsiDetails.getPort().toString());
} else {
cnx.setPort(DEFAULT_ISCSI_PORT);
}
if (iscsiDetails.isSetPortal()) {
cnx.setPortal(iscsiDetails.getPortal());
}
if (iscsiDetails.isSetUsername()) {
cnx.setUserName(iscsiDetails.getUsername());
}
if (iscsiDetails.isSetPassword()) {
cnx.setPassword(iscsiDetails.getPassword());
}
StorageServerConnectionParametersBase connectionParms = new StorageServerConnectionParametersBase(cnx, guid, false);
return doAction(ActionType.ConnectStorageToVds, connectionParms, action);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class OvfOvirtReader method readLunDisk.
@Override
protected void readLunDisk(XmlNode node, LunDisk lun) {
lun.setDiskVmElements(Collections.singletonList(new DiskVmElement(lun.getId(), fullEntityOvfData.getVmBase().getId())));
LUNs luns = new LUNs();
consumeReadXmlAttribute(node, OVF_PREFIX + COLON + LUN_ID, val -> luns.setLUNId(val));
ArrayList<StorageServerConnections> lunConnections = new ArrayList<>();
for (XmlNode connNode : selectNodes(node, LUN_CONNECTION)) {
StorageServerConnections conn = new StorageServerConnections();
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_CONNECTION, val -> conn.setConnection(val));
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_IQN, val -> conn.setIqn(val));
consumeReadXmlAttribute(connNode, OVF_PREFIX + COLON + LUNS_PORT, val -> conn.setPort(val));
consumeReadXmlAttribute(connNode, XSI_PREFIX + COLON + LUNS_STORAGE_TYPE, val -> conn.setStorageType(StorageType.valueOf(val)));
consumeReadXmlAttribute(connNode, XSI_PREFIX + COLON + LUNS_PORTAL, val -> conn.setPortal(val));
lunConnections.add(conn);
}
luns.setLunConnections(lunConnections);
lun.setLun(luns);
DiskVmElement dve = lun.getDiskVmElementForVm(fullEntityOvfData.getVmBase().getId());
initGeneralDiskAttributes(node, lun, dve);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class OvfOvirtWriter method writeLunDisk.
@Override
protected void writeLunDisk(LunDisk lun) {
// Lun disk does not have image id, therefor the id will be preserved with the disk ID as identifier.
_writer.writeAttributeString(getOvfUri(), "diskId", lun.getId().toString());
DiskVmElement dve = lun.getDiskVmElementForVm(vmBase.getId());
if (lun.getDiskAlias() != null) {
_writer.writeAttributeString(getOvfUri(), "disk-alias", lun.getDiskAlias());
}
if (lun.getDiskDescription() != null) {
_writer.writeAttributeString(getOvfUri(), "disk-description", lun.getDiskDescription());
}
if (FeatureSupported.passDiscardSupported(version)) {
_writer.writeAttributeString(getOvfUri(), "pass-discard", String.valueOf(dve.isPassDiscard()));
}
_writer.writeAttributeString(getOvfUri(), "fileRef", OvfParser.createLunFile(lun));
_writer.writeAttributeString(getOvfUri(), "shareable", String.valueOf(lun.isShareable()));
_writer.writeAttributeString(getOvfUri(), "boot", String.valueOf(dve.isBoot()));
_writer.writeAttributeString(getOvfUri(), "disk-interface", dve.getDiskInterface().toString());
_writer.writeAttributeString(getOvfUri(), "read-only", String.valueOf(dve.isReadOnly()));
_writer.writeAttributeString(getOvfUri(), "scsi_reservation", String.valueOf(dve.isUsingScsiReservation()));
_writer.writeAttributeString(getOvfUri(), "plugged", String.valueOf(dve.isPlugged()));
_writer.writeAttributeString(getOvfUri(), LUN_ID, String.valueOf(lun.getLun().getLUNId()));
if (lun.getLun().getLunConnections() != null) {
for (StorageServerConnections conn : lun.getLun().getLunConnections()) {
_writer.writeStartElement(LUN_CONNECTION);
_writer.writeAttributeString(getOvfUri(), LUNS_CONNECTION, conn.getConnection());
_writer.writeAttributeString(getOvfUri(), LUNS_IQN, conn.getIqn());
_writer.writeAttributeString(getOvfUri(), LUNS_PORT, conn.getPort());
_writer.writeAttributeString(XSI_URI, LUNS_STORAGE_TYPE, conn.getStorageType().name());
_writer.writeAttributeString(XSI_URI, LUNS_PORTAL, conn.getPortal());
_writer.writeEndElement();
}
}
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class GetLunsByVgIdQuery method getStorageType.
private StorageType getStorageType(List<LUNs> luns) {
StorageType storageType = null;
if (!luns.isEmpty()) {
LUNs lun = luns.get(0);
List<LUNStorageServerConnectionMap> lunConnections = storageServerConnectionLunMapDao.getAll(lun.getLUNId());
if (!lunConnections.isEmpty()) {
StorageServerConnections connection = storageServerConnectionDao.get(lunConnections.get(0).getStorageServerConnection());
storageType = connection.getStorageType();
} else {
storageType = StorageType.FCP;
}
}
return storageType;
}
Aggregations