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