Search in sources :

Example 1 with Qtree

use of com.iwave.ext.netapp.model.Qtree in project coprhd-controller by CoprHD.

the class MiscTests method test9.

@Test
public void test9() {
    List<Qtree> qtrees = netAppFacade.listQtrees();
    for (Qtree qtree : qtrees) {
        System.out.println("Qtree:");
        System.out.println("  id:" + qtree.getId());
        System.out.println("  oplocks:" + qtree.getOplocks());
        System.out.println("  owningVfiler:" + qtree.getOwningVfiler());
        System.out.println("  qtree:" + qtree.getQtree());
        System.out.println("  securityStyle:" + qtree.getSecurityStyle());
        System.out.println("  status:" + qtree.getStatus());
        System.out.println("  volume:" + qtree.getVolume());
    }
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) Test(org.junit.Test)

Example 2 with Qtree

use of com.iwave.ext.netapp.model.Qtree in project coprhd-controller by CoprHD.

the class FlexFileShare method getExportPolicyOfQtree.

public String getExportPolicyOfQtree(String exportPath, String volume, String qtree) {
    NaElement elem = new NaElement("qtree-list-iter");
    String policyName = null;
    if ((volume != null && !volume.isEmpty()) && (qtree != null && !qtree.isEmpty())) {
        NaElement qtreeAttrs = new NaElement("qtree-info");
        qtreeAttrs.addNewChild("volume", volume);
        qtreeAttrs.addNewChild("qtree", qtree);
        NaElement query = new NaElement("query");
        query.addChildElem(qtreeAttrs);
        elem.addChildElem(query);
    }
    NaElement resultElem = null;
    String tag = null;
    List<Qtree> qtrees = Lists.newArrayList();
    try {
        do {
            NaElement results = server.invokeElem(elem);
            tag = results.getChildContent("next-tag");
            resultElem = results.getChildByName("attributes-list");
            if (resultElem != null) {
                // Get the number of records returned by API.
                for (NaElement qtreeElem : (List<NaElement>) resultElem.getChildren()) {
                    if (qtreeElem != null) {
                        policyName = qtreeElem.getChildContent("export-policy");
                    }
                }
            }
            if (tag != null && !tag.isEmpty()) {
                elem = new NaElement("qtree-list-iter");
                elem.addNewChild("tag", tag);
            }
        } while (tag != null && !tag.isEmpty());
    } catch (IllegalArgumentException e) {
        String msg = "Failed to get export policy on path: " + (mountPath != null ? mountPath : exportPath);
        log.error(msg, e);
        throw new NetAppCException(msg, e);
    } catch (Exception e) {
        String msg = "Failed to get export policy on path: " + (mountPath != null ? mountPath : exportPath);
        log.error(msg, e);
        throw new NetAppCException(msg, e);
    }
    return policyName;
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) ArrayList(java.util.ArrayList) List(java.util.List) NaElement(netapp.manage.NaElement) NaAPIFailedException(netapp.manage.NaAPIFailedException)

Example 3 with Qtree

use of com.iwave.ext.netapp.model.Qtree in project coprhd-controller by CoprHD.

the class NetAppClusterApi method deleteAllQTrees.

public Boolean deleteAllQTrees(String volName) throws NetAppCException {
    String qtreeName = null;
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        List<Qtree> qtrees = netAppClusterFacade.listQtrees(volName);
        if (qtrees != null && !qtrees.isEmpty()) {
            for (Qtree qtree : qtrees) {
                qtreeName = qtree.getQtree();
                // Skip the unnamed Qtree.
                if (qtreeName != null && !qtreeName.isEmpty()) {
                    deleteQtree(qtreeName, volName, _svmName);
                }
            }
        }
        return true;
    } catch (Exception e) {
        _logger.error("Deleting the qtree {} of filesystem {} failed ", qtreeName, volName);
        throw NetAppCException.exceptions.deleteQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Example 4 with Qtree

use of com.iwave.ext.netapp.model.Qtree in project coprhd-controller by CoprHD.

the class ClusterQtreeCommands method listQtree.

public List<Qtree> listQtree(String volume) {
    NaElement elem = new NaElement("qtree-list-iter");
    if (volume != null && !volume.isEmpty()) {
        NaElement qtreeAttrs = new NaElement("qtree-info");
        qtreeAttrs.addNewChild("volume", volume);
        NaElement query = new NaElement("query");
        query.addChildElem(qtreeAttrs);
        elem.addChildElem(query);
    }
    NaElement resultElem = null;
    String tag = null;
    List<Qtree> qtrees = Lists.newArrayList();
    try {
        do {
            NaElement results = server.invokeElem(elem);
            tag = results.getChildContent("next-tag");
            resultElem = results.getChildByName("attributes-list");
            if (resultElem != null) {
                // Get the number of records returned by API.
                for (NaElement qtreeElem : (List<NaElement>) resultElem.getChildren()) {
                    if (qtreeElem != null) {
                        Qtree qtree = new Qtree();
                        qtree.setId((Integer) ConvertUtils.convert(qtreeElem.getChildContent("id"), Integer.class));
                        qtree.setOplocks(qtreeElem.getChildContent("oplocks"));
                        qtree.setOwningVfiler(qtreeElem.getChildContent("vserver"));
                        qtree.setQtree(qtreeElem.getChildContent("qtree"));
                        qtree.setSecurityStyle(qtreeElem.getChildContent("security-style"));
                        qtree.setStatus(qtreeElem.getChildContent("status"));
                        qtree.setVolume(qtreeElem.getChildContent("volume"));
                        qtrees.add(qtree);
                    }
                }
            }
            if (tag != null && !tag.isEmpty()) {
                elem = new NaElement("qtree-list-iter");
                elem.addNewChild("tag", tag);
            }
        } while (tag != null && !tag.isEmpty());
    } catch (Exception e) {
        throw createError(elem, e);
    }
    return qtrees;
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) List(java.util.List) NaElement(netapp.manage.NaElement) NetAppCException(com.iwave.ext.netappc.NetAppCException)

Example 5 with Qtree

use of com.iwave.ext.netapp.model.Qtree in project coprhd-controller by CoprHD.

the class QtreeCommands method listQtree.

public List<Qtree> listQtree(String volume) {
    NaElement elem = new NaElement("qtree-list");
    if (StringUtils.isNotBlank(volume)) {
        elem.addNewChild("volume", volume);
    }
    NaElement resultElem = null;
    try {
        resultElem = server.invokeElem(elem);
    } catch (Exception e) {
        throw createError(elem, e);
    }
    List<Qtree> qtrees = Lists.newArrayList();
    for (NaElement qtreeElem : (List<NaElement>) resultElem.getChildByName("qtrees").getChildren()) {
        Qtree qtree = new Qtree();
        qtree.setId((Integer) ConvertUtils.convert(qtreeElem.getChildContent("id"), Integer.class));
        qtree.setOplocks(qtreeElem.getChildContent("oplocks"));
        qtree.setOwningVfiler(qtreeElem.getChildContent("owning-vfiler"));
        qtree.setQtree(qtreeElem.getChildContent("qtree"));
        qtree.setSecurityStyle(qtreeElem.getChildContent("security-style"));
        qtree.setStatus(qtreeElem.getChildContent("status"));
        qtree.setVolume(qtreeElem.getChildContent("volume"));
        qtrees.add(qtree);
    }
    return qtrees;
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) List(java.util.List) NaElement(netapp.manage.NaElement)

Aggregations

Qtree (com.iwave.ext.netapp.model.Qtree)8 ArrayList (java.util.ArrayList)3 List (java.util.List)3 NaElement (netapp.manage.NaElement)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 UnManagedFileQuotaDirectory (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileQuotaDirectory)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 NetAppException (com.emc.storageos.netapp.NetAppException)2 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 Quota (com.iwave.ext.netapp.model.Quota)2 IOException (java.io.IOException)2 URI (java.net.URI)2 HashMap (java.util.HashMap)2 NetAppApi (com.emc.storageos.netapp.NetAppApi)1 NetAppCException (com.emc.storageos.netappc.NetAppCException)1 NetAppClusterApi (com.emc.storageos.netappc.NetAppClusterApi)1 NetAppFileCollectionException (com.emc.storageos.plugins.metering.netapp.NetAppFileCollectionException)1 ImplicitPoolMatcher (com.emc.storageos.volumecontroller.impl.utils.ImplicitPoolMatcher)1 NetAppFacade (com.iwave.ext.netapp.NetAppFacade)1 VFilerInfo (com.iwave.ext.netapp.VFilerInfo)1