boolean snapshotRes = false;
boolean volumeCreated = false;
NaServer s = getServer(ipAddress, username, password);
NaElement xi = new NaElement("volume-create");
xi.addNewChild("volume", volName);
xi.addNewChild("containing-aggr-name",aggName);
xi.addNewChild("size",volSize);
NaElement xi1 = new NaElement("snapshot-set-reserve");
if(snapshotReservation!=null)
{
snapshotRes = true;
xi1.addNewChild("percentage",snapshotReservation.toString());
xi1.addNewChild("volume",volName);
}
NaElement xi2 = new NaElement("snapshot-set-schedule");
if(snapshotPolicy!=null)
{
snapPolicy = true;
String weeks = null;
String days = null;
String hours = null;
String whichHours = null;
String minutes = null;
String whichMinutes = null;
StringTokenizer s1 = new StringTokenizer(snapshotPolicy," ");
//count=4: weeks days hours@csi mins@csi
//count=3: weeks days hours@csi
//count=2: weeks days
//count=1: weeks
if(s1.hasMoreTokens())
{
weeks = s1.nextToken();
}
if(weeks!=null && s1.hasMoreTokens())
{
days = s1.nextToken();
}
if(days!=null && s1.hasMoreTokens())
{
String[] hoursArr = s1.nextToken().split("@");
hours = hoursArr[0];
whichHours = hoursArr[1];
}
if(hours!=null && s1.hasMoreTokens())
{
String[] minsArr = s1.nextToken().split("@");
minutes = minsArr[0];
whichMinutes = minsArr[1];
}
if(weeks!=null)
xi2.addNewChild("weeks",weeks);
if(days!=null)
xi2.addNewChild("days",days);
if(hours!=null)
xi2.addNewChild("hours",hours);
if(minutes!=null)
xi2.addNewChild("minutes",minutes);
xi2.addNewChild("volume",volName);
if(whichHours!=null)
xi2.addNewChild("which-hours",whichHours);
if(whichMinutes!=null)
xi2.addNewChild("which-minutes",whichMinutes);
}
Long volumeId = null;
final Transaction txn = Transaction.currentTxn();
txn.start();