Search in sources :

Example 66 with StorageServerConnections

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);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 67 with StorageServerConnections

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);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) IscsiDetails(org.ovirt.engine.api.model.IscsiDetails) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Example 68 with StorageServerConnections

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);
}
Also used : XmlNode(org.ovirt.engine.core.utils.ovf.xml.XmlNode) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 69 with StorageServerConnections

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();
        }
    }
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)

Example 70 with StorageServerConnections

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;
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) LUNStorageServerConnectionMap(org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)181 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)43 Guid (org.ovirt.engine.core.compat.Guid)39 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)33 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)32 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)19 List (java.util.List)18 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)14 HashSet (java.util.HashSet)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 Set (java.util.Set)10 StorageConnection (org.ovirt.engine.api.model.StorageConnection)10 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)10 QueryType (org.ovirt.engine.core.common.queries.QueryType)10