Statistiques
| Révision :

root / src / gZFS / zfs.java @ 53

Historique | Voir | Annoter | Télécharger (55,6 ko)

1 53 kreverch
/*******************************************************************
2 53 kreverch
 *
3 53 kreverch
 * Copyright (C) 2013 Kevin Reverchon
4 53 kreverch
 * This file/program is part of gZFS free software
5 53 kreverch
 * See COPYING file for details
6 53 kreverch
 *
7 53 kreverch
 *******************************************************************/
8 14 kreverch
package gZFS;
9 14 kreverch
10 14 kreverch
import java.io.BufferedReader;
11 14 kreverch
import java.io.File;
12 14 kreverch
import java.io.FileInputStream;
13 14 kreverch
import java.io.FileNotFoundException;
14 14 kreverch
import java.io.IOException;
15 14 kreverch
import java.io.InputStream;
16 14 kreverch
import java.io.InputStreamReader;
17 14 kreverch
import java.io.OutputStream;
18 14 kreverch
import java.net.URL;
19 14 kreverch
import java.text.ParseException;
20 14 kreverch
import java.text.SimpleDateFormat;
21 14 kreverch
import java.util.ArrayList;
22 14 kreverch
import java.util.Arrays;
23 14 kreverch
import java.util.Hashtable;
24 14 kreverch
import java.util.List;
25 14 kreverch
import java.util.Properties;
26 14 kreverch
27 14 kreverch
import org.apache.log4j.Level;
28 14 kreverch
import org.apache.log4j.Logger;
29 14 kreverch
import org.jfree.util.Log;
30 14 kreverch
31 14 kreverch
import com.ibm.icu.math.BigDecimal;
32 14 kreverch
import com.jcraft.jsch.ChannelExec;
33 14 kreverch
import com.jcraft.jsch.JSch;
34 14 kreverch
import com.jcraft.jsch.JSchException;
35 14 kreverch
import com.jcraft.jsch.Session;
36 14 kreverch
37 14 kreverch
public class zfs {
38 14 kreverch
39 14 kreverch
40 14 kreverch
        private Logger log = Logger.getLogger(getClass().getPackage().getName()+" "+getClass().getCanonicalName());
41 14 kreverch
42 14 kreverch
        private String userLogin;
43 14 kreverch
        private String userPassword;
44 14 kreverch
        private String sshHost;
45 14 kreverch
        private int sshPort;
46 14 kreverch
        private Session session;
47 14 kreverch
        private Hashtable<String,Session> cacheSession = new Hashtable<String, Session>();
48 14 kreverch
        private JSch jsch = new JSch();
49 14 kreverch
        private String outCmd = null ;
50 14 kreverch
        private StringBuilder outErr ;
51 14 kreverch
        private List<Object> zpoolList = new ArrayList<Object>();
52 14 kreverch
        private List<Object> zfsList = new ArrayList<Object>();
53 14 kreverch
        private List<Object> zfsListSnapshots = new ArrayList<Object>();
54 14 kreverch
        private List<Object> zfsGetAllList = new ArrayList<Object>();
55 14 kreverch
        private List<Object> iscsiListConfigVol = new ArrayList<Object>();
56 14 kreverch
        private Hashtable<String,Object> modelZfsVolAndFS = new Hashtable<String, Object>();
57 14 kreverch
        private Hashtable<String,Object> error = new Hashtable<String, Object>();
58 14 kreverch
        private Hashtable<String,zdisk> hashDisks = new Hashtable<String, zdisk>();
59 14 kreverch
        private Hashtable<String,zraid> hashZRaid = new Hashtable<String, zraid>();
60 14 kreverch
61 14 kreverch
        private zpool zpool;
62 14 kreverch
        private zserver zserver;
63 14 kreverch
        private zvol zvol ;
64 14 kreverch
        private zsnapshots zsnapshots;
65 14 kreverch
        private zreplicas zreplicas;
66 14 kreverch
        private ziscsi ziscsi;
67 14 kreverch
        private zdisk zdisk;
68 14 kreverch
        private zraid zraid;
69 14 kreverch
        private List<Object> sidList;
70 14 kreverch
        private List<Object> ipList;
71 14 kreverch
        private Properties prop = new Properties();
72 14 kreverch
        zfs(){
73 14 kreverch
                this.loadConfig();
74 14 kreverch
                this.setZserver();
75 14 kreverch
                this.setZpool();
76 14 kreverch
                this.setZdisk();
77 14 kreverch
                this.setZvol();
78 14 kreverch
                this.setZsnapshots();
79 14 kreverch
                this.setZreplicas();
80 14 kreverch
                this.setZiscsi();
81 14 kreverch
                this.setZraid();
82 14 kreverch
                log.setLevel((Level) Level.DEBUG);
83 14 kreverch
        }
84 14 kreverch
85 14 kreverch
        public void setZvol(){
86 14 kreverch
                zvol= new zvol();
87 14 kreverch
        }
88 14 kreverch
89 14 kreverch
        public gZFS.zvol getZvol(){
90 14 kreverch
                return zvol;
91 14 kreverch
        }
92 14 kreverch
93 14 kreverch
        public boolean connectServer(String host, int port, String userLogin, String userPasswd){
94 14 kreverch
                try {
95 14 kreverch
                        setSession(jsch.getSession(userLogin, host, port));
96 14 kreverch
                        session.setPassword(userPasswd);
97 14 kreverch
                        Properties config = new Properties();
98 14 kreverch
                        config.put("StrictHostKeyChecking", "no");
99 14 kreverch
                        session.setConfig(config);
100 14 kreverch
                        session.connect();
101 14 kreverch
                        getCacheSession().put(host, session);
102 14 kreverch
                        if ( session.isConnected()){
103 14 kreverch
                                log.debug("Connected");
104 14 kreverch
                                return true;
105 14 kreverch
                        }else{
106 14 kreverch
                                log.debug("not Connected");
107 14 kreverch
                                return false;
108 14 kreverch
                        }
109 14 kreverch
110 14 kreverch
                } catch (JSchException e) {
111 14 kreverch
                        // TODO Auto-generated catch block
112 14 kreverch
                        e.printStackTrace();
113 14 kreverch
                        return false;
114 14 kreverch
                }
115 14 kreverch
        }
116 14 kreverch
117 28 kreverch
        public void disconnectAllServer(){
118 14 kreverch
                String[] keysProp = (String[]) this.getCacheSession().keySet().toArray(new String[0]);
119 14 kreverch
                Arrays.sort(keysProp);
120 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
121 14 kreverch
                        String keyProp = keysProp[i];
122 14 kreverch
                        this.setSession(getCacheSession().get(keyProp));
123 14 kreverch
                        session.disconnect();
124 28 kreverch
                        getCacheSession().remove(keyProp);
125 14 kreverch
                }
126 14 kreverch
        }
127 28 kreverch
        public void disconnectServer(){
128 28 kreverch
                this.setSession(getCacheSession().get(this.getZserver().zProperties.get("serverIP").getValue()));
129 28 kreverch
                session.disconnect();
130 28 kreverch
                getCacheSession().remove(this.getZserver().zProperties.get("serverIP").getValue());
131 28 kreverch
        }
132 14 kreverch
133 14 kreverch
134 14 kreverch
        public Boolean executeCmd(String cmd) {
135 14 kreverch
                this.setOutCmd("");
136 14 kreverch
                try {
137 14 kreverch
138 14 kreverch
                        this.setSession(getCacheSession().get(this.getZserver().zProperties.get("serverIP").getValue()));
139 14 kreverch
                        log.debug("executeCMD : "+this.getZserver().zProperties.get("serverIP").getValue());
140 14 kreverch
                        ChannelExec channel = (ChannelExec) session.openChannel("exec");
141 14 kreverch
                        //((ChannelExec) channel).setCommand("lqs");
142 14 kreverch
                        ((ChannelExec) channel).setCommand(cmd);
143 14 kreverch
                        InputStream in = channel.getInputStream();
144 14 kreverch
                        OutputStream out = channel.getOutputStream();
145 14 kreverch
                        ((ChannelExec) channel).setErrStream(System.err);
146 14 kreverch
                        InputStream err = channel.getErrStream();
147 14 kreverch
                        channel.connect();
148 14 kreverch
                        log.debug("executeCmd "+cmd);
149 28 kreverch
                        if (!cmd.equals("/sbin/show-infodisk-cache")){
150 28 kreverch
                                BufferedReader reader = new BufferedReader(new InputStreamReader(err));
151 28 kreverch
                                outErr = new StringBuilder();
152 28 kreverch
                                String line;
153 28 kreverch
                                while ((line = reader.readLine()) != null) {
154 28 kreverch
                                        outErr.append(line);
155 28 kreverch
                                }
156 14 kreverch
                        }
157 28 kreverch
158 24 kreverch
                        byte[] tmp = new byte[4096];
159 14 kreverch
160 14 kreverch
                        while (true) {
161 14 kreverch
162 14 kreverch
                                int ind = 0;
163 14 kreverch
                                while (in.available() > 0) {
164 24 kreverch
                                        int i = in.read(tmp, 0, 4096);
165 14 kreverch
                                        if (i < 0)
166 14 kreverch
                                                break;
167 14 kreverch
168 14 kreverch
                                        this.setOutCmd(this.getOutCmd()+new String(tmp, 0, i));
169 14 kreverch
                                }
170 14 kreverch
                                if (channel.isClosed()) {
171 14 kreverch
                                        break;
172 14 kreverch
                                }
173 14 kreverch
                                try {
174 14 kreverch
                                        Thread.sleep(900);
175 14 kreverch
                                } catch (Exception ee) {
176 14 kreverch
                                        log.debug(ee);
177 14 kreverch
                                }
178 14 kreverch
                        }
179 14 kreverch
                        channel.disconnect();
180 14 kreverch
181 14 kreverch
                } catch (JSchException e) {
182 14 kreverch
                        // TODO Auto-generated catch block
183 14 kreverch
                        log.debug("executeCMD "+e.getMessage());
184 14 kreverch
                        e.printStackTrace();
185 14 kreverch
                        return false;
186 14 kreverch
                } catch (IOException e) {
187 14 kreverch
                        // TODO Auto-generated catch block
188 14 kreverch
                        log.debug("executeCmd "+e.getMessage());
189 14 kreverch
                        e.printStackTrace();
190 14 kreverch
                        return false;
191 14 kreverch
                }
192 14 kreverch
                /*for (int cpt=0;cpt < outCmd.length;cpt++ ) {
193 14 kreverch
                        log.debug(outCmd[cpt]);
194 14 kreverch
                }*/
195 14 kreverch
                //log.debug(this.getOutCmd());
196 14 kreverch
                return true;
197 14 kreverch
        }
198 14 kreverch
199 14 kreverch
        public Boolean zfsGetAllVolume(String volName){
200 14 kreverch
                zfsGetAllList.clear();
201 14 kreverch
                //clear this.getZvol properties
202 14 kreverch
                String[] keysProp = (String[]) this.getZvol().zProperties.keySet().toArray(new String[0]);
203 14 kreverch
                Arrays.sort(keysProp);
204 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
205 14 kreverch
                        String keyProp = keysProp[i];
206 14 kreverch
                        this.getZvol().zProperties.get(keyProp).setMultivalues(null);
207 14 kreverch
                        this.getZvol().zProperties.get(keyProp).setValue("");;
208 14 kreverch
209 14 kreverch
                }
210 14 kreverch
                if (  this.executeCmd("/sbin/zfs get all "+volName) ){
211 14 kreverch
                        log.debug(this.getOutCmd());
212 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
213 14 kreverch
                        for (int cpt=1;cpt<Tsplit.length;cpt++){
214 14 kreverch
215 14 kreverch
                                log.debug(Tsplit[cpt].replaceAll(volName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " "));
216 14 kreverch
                                String[] TsplitLine = Tsplit[cpt].replaceAll(volName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " ").split(" ");
217 14 kreverch
                                log.debug(TsplitLine[0]);
218 14 kreverch
                                if ( "creation".equalsIgnoreCase(TsplitLine[0])){
219 14 kreverch
                                        this.getZvol().zProperties.get("creation").setValue(TsplitLine[1]+" "+TsplitLine[2]+" "+TsplitLine[3]+" "+TsplitLine[4]+" "+TsplitLine[5]);;
220 14 kreverch
                                }else{
221 14 kreverch
                                        //this.getZvol().zProperties.containsKey(TsplitLine[0]);
222 14 kreverch
                                        if (this.getZvol().zProperties.containsKey(TsplitLine[0])){
223 14 kreverch
                                                this.getZvol().zProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
224 14 kreverch
                                                log.debug("ZFS DEBUG "+this.getZvol().zProperties.get(TsplitLine[0]).getNameProperty()+" "+ this.getZvol().zProperties.get(TsplitLine[0]).getValue());
225 14 kreverch
                                        }
226 14 kreverch
                                }
227 14 kreverch
                        }
228 14 kreverch
                        this.getZvol().zProperties.get("name").setValue(volName);
229 14 kreverch
                        //this.getZvol().zProperties.get("name").setValue(volName);
230 14 kreverch
                }
231 14 kreverch
232 14 kreverch
233 14 kreverch
                return true;
234 14 kreverch
        }
235 14 kreverch
        public void zfsGetInfoByProperty(String volName, String propertyName){
236 14 kreverch
                zfsGetAllList.clear();
237 14 kreverch
                if (  this.executeCmd("/sbin/zfs get "+propertyName+" -H "+volName) ){
238 14 kreverch
                        log.debug(this.getOutCmd());
239 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
240 14 kreverch
                        for (int cpt=0;cpt<Tsplit.length;cpt++){
241 14 kreverch
242 14 kreverch
                                log.debug(Tsplit[cpt].replaceAll(volName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " "));
243 14 kreverch
                                String[] TsplitLine = Tsplit[cpt].replaceAll(volName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " ").split(" ");
244 14 kreverch
                                log.debug(TsplitLine[0]);
245 14 kreverch
                                if ( "creation".equalsIgnoreCase(TsplitLine[0])){
246 14 kreverch
                                        this.getZvol().zProperties.get("creation").setValue(TsplitLine[1]+" "+TsplitLine[2]+" "+TsplitLine[3]+" "+TsplitLine[4]+" "+TsplitLine[5]);;
247 14 kreverch
                                }else{
248 14 kreverch
                                        //this.getZvol().zProperties.containsKey(TsplitLine[0]);
249 14 kreverch
                                        if (this.getZvol().zProperties.containsKey(TsplitLine[0])){
250 14 kreverch
                                                this.getZvol().zProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
251 14 kreverch
                                                log.debug("ZFS DEBUG "+this.getZvol().zProperties.get(TsplitLine[0]).getNameProperty()+" "+ this.getZvol().zProperties.get(TsplitLine[0]).getValue());
252 14 kreverch
                                        }
253 14 kreverch
                                }
254 14 kreverch
                        }
255 14 kreverch
                        this.getZvol().zProperties.get("name").setValue(volName);
256 14 kreverch
                        //this.getZvol().zProperties.get("name").setValue(volName);
257 14 kreverch
                }
258 14 kreverch
259 14 kreverch
        }
260 14 kreverch
261 14 kreverch
262 14 kreverch
        public Boolean zpoolGetAll(String zpoolName){
263 14 kreverch
                zfsGetAllList.clear();
264 14 kreverch
                //clear this.getZvol properties
265 14 kreverch
                String[] keysProp = (String[]) this.getZpool().zProperties.keySet().toArray(new String[0]);
266 14 kreverch
                Arrays.sort(keysProp);
267 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
268 14 kreverch
                        String keyProp = keysProp[i];
269 14 kreverch
                        this.getZpool().zProperties.get(keyProp).setMultivalues(null);
270 14 kreverch
                        this.getZpool().zProperties.get(keyProp).setValue("");;
271 14 kreverch
272 14 kreverch
                }
273 14 kreverch
                if (  this.executeCmd("/sbin/zpool get all "+zpoolName) ){
274 14 kreverch
                        log.debug(this.getOutCmd());
275 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
276 14 kreverch
                        for (int cpt=1;cpt<Tsplit.length;cpt++){
277 14 kreverch
278 14 kreverch
                                log.debug(Tsplit[cpt].replaceAll(zpoolName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " "));
279 14 kreverch
                                String[] TsplitLine = Tsplit[cpt].replaceAll(zpoolName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " ").split(" ");
280 14 kreverch
                                log.debug(TsplitLine[0]);
281 14 kreverch
                                if ( "creation".equalsIgnoreCase(TsplitLine[0])){
282 14 kreverch
                                        this.getZpool().zProperties.get("creation").setValue(TsplitLine[1]+" "+TsplitLine[2]+" "+TsplitLine[3]+" "+TsplitLine[4]+" "+TsplitLine[5]);;
283 14 kreverch
                                }else{
284 14 kreverch
                                        //this.getZpool().zProperties.containsKey(TsplitLine[0]);
285 14 kreverch
                                        if (this.getZpool().zProperties.containsKey(TsplitLine[0])){
286 14 kreverch
                                                this.getZpool().zProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
287 14 kreverch
                                                log.debug("ZFS DEBUG "+this.getZpool().zProperties.get(TsplitLine[0]).getNameProperty()+" "+ this.getZpool().zProperties.get(TsplitLine[0]).getValue());
288 14 kreverch
                                        }
289 14 kreverch
                                }
290 14 kreverch
                        }
291 14 kreverch
                        this.getZpool().zProperties.get("name").setValue(zpoolName);
292 14 kreverch
                        //this.getZvol().zProperties.get("name").setValue(volName);
293 14 kreverch
294 14 kreverch
                        this.getZpoolRealUseableSpace(zpoolName);
295 14 kreverch
                        log.debug("zpoolGetAll "+this.getZpool().zProperties.get("realuseablespace").getValue());
296 14 kreverch
                        this.getZpoolProvisionedSpace(zpoolName);
297 14 kreverch
                        if (  this.executeCmd(this.getZserver().zProperties.get("binzpoolgetstate").getValue()+" -n "+this.getZpool().zProperties.get("name").getValue()) ){
298 14 kreverch
                                log.debug(this.getOutCmd());
299 14 kreverch
                                String[] TsplitOut = this.getOutCmd().split("\n");
300 14 kreverch
                                for (int cpt=1;cpt<TsplitOut.length;cpt++){
301 14 kreverch
302 14 kreverch
                                        String[] TsplitLineState= TsplitOut[cpt].replaceAll("\n","").split(":");
303 14 kreverch
                                        log.debug(TsplitLineState[0]);
304 14 kreverch
                                        //this.getZpool().zProperties.containsKey(TsplitLine[0]);
305 14 kreverch
                                        if (this.getZpool().zProperties.containsKey(TsplitLineState[0])){
306 14 kreverch
                                                this.getZpool().zProperties.get(TsplitLineState[0]).setValue(TsplitLineState[1]);
307 14 kreverch
                                                log.debug("ZFS DEBUG "+this.getZpool().zProperties.get(TsplitLineState[0]).getNameProperty()+" "+ this.getZpool().zProperties.get(TsplitLineState[0]).getValue());
308 14 kreverch
                                        }
309 14 kreverch
                                }
310 14 kreverch
                                this.getZpool().zProperties.get("name").setValue(zpoolName);
311 14 kreverch
                        }
312 14 kreverch
313 14 kreverch
                }
314 14 kreverch
315 14 kreverch
316 14 kreverch
                return true;
317 14 kreverch
        }
318 14 kreverch
319 14 kreverch
320 14 kreverch
        public List<Object> zpoolList(){
321 14 kreverch
                zpoolList.clear();
322 14 kreverch
323 14 kreverch
                if (  this.executeCmd("/sbin/zpool list -H") ){
324 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
325 14 kreverch
                        for (int cpt=0;cpt<Tsplit.length;cpt++){
326 14 kreverch
                                log.debug(Tsplit[cpt].split("\\s+")[0] );
327 14 kreverch
                                zpoolList.add(Tsplit[cpt].split("\\s+")[0]);
328 14 kreverch
                                //zpoolNames[ind] = Tsplit[cpt].split("\\s+")[0];
329 14 kreverch
                        }
330 14 kreverch
                }
331 14 kreverch
                return zpoolList;
332 14 kreverch
        }
333 14 kreverch
334 14 kreverch
        public List<Object> zfsListSnapshotsByVolFS(String nameVolFS){
335 14 kreverch
                zfsListSnapshots.clear();
336 14 kreverch
337 14 kreverch
                log.debug("zfs list -H -r -t snapshot -oname,used,referenced "+nameVolFS);
338 14 kreverch
                if (  this.executeCmd("/sbin/zfs list -H -r -t snapshot "+nameVolFS) ){
339 14 kreverch
                        if ( this.getOutCmd().length() >0){
340 14 kreverch
                                String[] Tsplit = this.getOutCmd().split("\n");
341 14 kreverch
                                for (int cpt=0;cpt<Tsplit.length;cpt++){
342 14 kreverch
                                        log.debug(Tsplit[cpt].split("\\s+")[0] );
343 14 kreverch
                                        zfsListSnapshots.add(Tsplit[cpt].split("\\s+")[0]);
344 14 kreverch
                                        //zpoolNames[ind] = Tsplit[cpt].split("\\s+")[0];
345 14 kreverch
                                }
346 14 kreverch
                        }
347 14 kreverch
348 14 kreverch
                }
349 14 kreverch
                return zfsListSnapshots;
350 14 kreverch
        }
351 14 kreverch
352 14 kreverch
        public Boolean getIscsiListConfigVol(String nameVolFS){
353 14 kreverch
                sidList = new ArrayList<Object>();
354 14 kreverch
                ipList = new ArrayList<Object>();
355 14 kreverch
                //sidList=null;
356 14 kreverch
                //ipList=null;
357 14 kreverch
                log.debug("get-conf-iscsi-volume nameVolFS");
358 14 kreverch
                //Reset ziscsi object
359 14 kreverch
                this.setZiscsi();
360 14 kreverch
                if (  this.executeCmd("/sbin/get-conf-iscsi-volume "+nameVolFS) ){
361 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
362 14 kreverch
                        for (int cpt=0;cpt<Tsplit.length;cpt++){
363 14 kreverch
364 14 kreverch
                                String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split(" ");
365 14 kreverch
                                if ( "sid".equalsIgnoreCase(TsplitLine[0])){
366 14 kreverch
                                        sidList.add(TsplitLine[1]);
367 14 kreverch
                                }else{
368 14 kreverch
                                        if ("sessionIP".equalsIgnoreCase(TsplitLine[0])){
369 14 kreverch
                                                ipList.add(TsplitLine[1]);
370 14 kreverch
                                                log.debug("sessionIP "+TsplitLine[1]);
371 14 kreverch
                                        }else{
372 14 kreverch
                                                //this.getZvol().zProperties.containsKey(TsplitLine[0]);
373 21 kreverch
                                                if (this.getZiscsi().zProperties.containsKey(TsplitLine[0])&& TsplitLine.length ==2){
374 14 kreverch
                                                        this.getZiscsi().zProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
375 14 kreverch
                                                }
376 14 kreverch
                                        }
377 14 kreverch
                                }
378 14 kreverch
                        }
379 14 kreverch
                        this.getZiscsi().zProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
380 14 kreverch
                        this.getZiscsi().zProperties.get("sid").setMultivalues(sidList);
381 14 kreverch
                        this.getZiscsi().zProperties.get("sessionIP").setMultivalues(ipList);
382 14 kreverch
                        return true;
383 14 kreverch
                }else{
384 14 kreverch
                        return false;
385 14 kreverch
                }
386 14 kreverch
        }
387 14 kreverch
388 14 kreverch
389 14 kreverch
        public void getZpoolProvisionedSpace(String zpoolName){
390 14 kreverch
                log.debug("getZpoolProvisionedSpace "+this.getZpool().zProperties.get("realuseablespace").getValue());
391 14 kreverch
                if (  this.executeCmd("/sbin/get-provisioned-space "+zpoolName) ){
392 14 kreverch
                        log.debug(this.getOutCmd());
393 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
394 14 kreverch
                        log.debug("getZpoolProvisionedSpace "+this.getZpool().zProperties.get("realuseablespace").getValue().substring((this.getZpool().zProperties.get("realuseablespace").getValue().length())));
395 14 kreverch
396 14 kreverch
                        String refUnit = this.getZpool().zProperties.get("realuseablespace").getValue().substring((this.getZpool().zProperties.get("realuseablespace").getValue().length()-1), (this.getZpool().zProperties.get("realuseablespace").getValue().length()));
397 14 kreverch
398 14 kreverch
399 14 kreverch
                        float totalProvisioned=0;
400 14 kreverch
                        log.debug(String.valueOf(totalProvisioned)+refUnit);
401 14 kreverch
                        for (int cpt=0;cpt<Tsplit.length;cpt++){
402 14 kreverch
403 14 kreverch
                                log.debug(Tsplit[cpt].replaceAll(zpoolName+"\\s+","").replaceAll("\n", "").replaceAll("\\s+", " "));
404 14 kreverch
                                String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split(" ");
405 14 kreverch
                                log.debug(TsplitLine[0]);
406 14 kreverch
                                totalProvisioned=totalProvisioned+this.convertInReferenceUnit(TsplitLine[2], refUnit);
407 14 kreverch
408 14 kreverch
                        }
409 14 kreverch
                        log.debug("getZpoolProvisionedSpace "+String.valueOf(totalProvisioned)+refUnit);
410 14 kreverch
                        this.getZpool().zProperties.get("provisionspace").setValue(String.valueOf(BigDecimal.valueOf(totalProvisioned).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())+refUnit);
411 14 kreverch
                        //this.getZvol().zProperties.get("name").setValue(volName);
412 14 kreverch
                        log.debug(String.valueOf(totalProvisioned)+refUnit);
413 14 kreverch
414 14 kreverch
415 14 kreverch
                }
416 14 kreverch
        }
417 14 kreverch
418 14 kreverch
        public void getZpoolRealUseableSpace(String zpoolName){
419 14 kreverch
420 14 kreverch
                this.zfsGetInfoByProperty(zpoolName, "used");
421 14 kreverch
                this.zfsGetInfoByProperty(zpoolName, "available");
422 14 kreverch
                log.debug("getZpoolRealUseableSpace "+this.getZvol().zProperties.get("used").getValue());
423 14 kreverch
                String refUnit = this.getZvol().zProperties.get("used").getValue().substring(this.getZvol().zProperties.get("used").getValue().length()-1, this.getZvol().zProperties.get("used").getValue().length());
424 14 kreverch
                if (!refUnit.equalsIgnoreCase("T")&&!refUnit.equalsIgnoreCase("G")){
425 14 kreverch
                        refUnit = this.getZvol().zProperties.get("available").getValue().substring(this.getZvol().zProperties.get("available").getValue().length()-1, this.getZvol().zProperties.get("available").getValue().length());
426 14 kreverch
                }
427 14 kreverch
                log.debug("getZpoolRealUseableSpace "+refUnit);
428 14 kreverch
                float usedSize = this.convertInReferenceUnit(this.getZvol().zProperties.get("used").getValue(), refUnit);
429 14 kreverch
                float availableSize = this.convertInReferenceUnit(this.getZvol().zProperties.get("available").getValue(), refUnit);
430 14 kreverch
                log.debug("getZpoolRealUseableSpace "+String.valueOf(usedSize+availableSize)+refUnit);
431 14 kreverch
                this.getZpool().zProperties.get("realuseablespace").setValue(String.valueOf(BigDecimal.valueOf(usedSize+availableSize).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())+refUnit);
432 14 kreverch
433 14 kreverch
        }
434 14 kreverch
435 14 kreverch
        public void getZpoolStatus(){
436 14 kreverch
                error.clear();
437 14 kreverch
                if ( !"".equalsIgnoreCase(getZpool().zProperties.get("name").getValue())){
438 14 kreverch
439 14 kreverch
                        log.debug("getZpoolStatus");
440 14 kreverch
                        hashDisks.clear();
441 14 kreverch
                        hashZRaid.clear();
442 14 kreverch
                        this.setZraid();
443 14 kreverch
                        if ( this.executeCmd("/sbin/show-infodisk-cache")){
444 14 kreverch
                                log.debug("getZpoolStatus");
445 14 kreverch
                                this.setZdisk();
446 14 kreverch
                                if ( outErr.length() ==0){
447 14 kreverch
                                        //log.debug(this.getOutCmd());
448 14 kreverch
                                        String namePool="";
449 14 kreverch
                                        if (this.getOutCmd().length()>0) {
450 14 kreverch
451 14 kreverch
                                                String[] Tsplit = this.getOutCmd().split("\n");
452 14 kreverch
                                                for (int cpt=0;cpt<Tsplit.length;cpt++){
453 14 kreverch
                                                        String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", "").replaceAll("'", "").split(":");
454 14 kreverch
                                                        String propertyDisk=TsplitLine[0].toLowerCase();
455 14 kreverch
                                                        String valuePropertyDisk="";
456 14 kreverch
457 14 kreverch
                                                        if (TsplitLine.length==2){
458 14 kreverch
                                                                valuePropertyDisk=TsplitLine[1];
459 14 kreverch
                                                        }
460 14 kreverch
461 14 kreverch
                                                        if (Tsplit[cpt].equalsIgnoreCase("#infoDisk#")){
462 14 kreverch
                                                                if (!this.getZdisk().zProperties.get("path").getValue().equalsIgnoreCase("") ){
463 14 kreverch
                                                                        hashDisks.put("disk"+cpt, this.getZdisk());
464 14 kreverch
                                                                        log.debug(this.getZraid().zProperties.get("poolname").getValue()+"-"+this.getZraid().zProperties.get("raidtype").getValue()+"-"+this.getZraid().zProperties.get("raidid").getValue());
465 14 kreverch
                                                                        if (!hashZRaid.containsKey(this.getZraid().zProperties.get("poolname").getValue()+"-"+this.getZraid().zProperties.get("raidtype").getValue()+"-"+this.getZraid().zProperties.get("raidid").getValue())){
466 14 kreverch
                                                                                this.getZraid().zProperties.get("name").setValue(this.getZraid().zProperties.get("poolname").getValue()+"-"+this.getZraid().zProperties.get("raidtype").getValue()+"-"+this.getZraid().zProperties.get("raidid").getValue());
467 14 kreverch
                                                                                hashZRaid.put(this.getZraid().zProperties.get("poolname").getValue()+"-"+this.getZraid().zProperties.get("raidtype").getValue()+"-"+this.getZraid().zProperties.get("raidid").getValue(), this.getZraid());
468 14 kreverch
                                                                                this.setZraid();
469 14 kreverch
                                                                        }
470 14 kreverch
                                                                }
471 14 kreverch
                                                                this.setZdisk();
472 14 kreverch
                                                        }else{
473 14 kreverch
                                                                if (TsplitLine.length==2){
474 14 kreverch
                                                                        valuePropertyDisk=TsplitLine[1];
475 14 kreverch
476 14 kreverch
                                                                        if (this.getZdisk().zProperties.containsKey(propertyDisk)){
477 14 kreverch
                                                                                this.getZdisk().zProperties.get(propertyDisk).setValue(valuePropertyDisk);
478 14 kreverch
                                                                                //log.debug(propertyDisk+" : "+valuePropertyDisk);
479 14 kreverch
                                                                        }
480 14 kreverch
481 14 kreverch
                                                                        if (this.getZraid().zProperties.containsKey(propertyDisk)){
482 14 kreverch
                                                                                this.getZraid().zProperties.get(propertyDisk).setValue(valuePropertyDisk);
483 14 kreverch
484 14 kreverch
                                                                                log.debug(propertyDisk+" : "+valuePropertyDisk);
485 14 kreverch
                                                                        }
486 14 kreverch
                                                                }
487 14 kreverch
                                                        }
488 14 kreverch
489 14 kreverch
                                                }
490 14 kreverch
                                        }
491 14 kreverch
                                }
492 14 kreverch
                        }
493 14 kreverch
                        log.debug("getZpoolStatus : "+hashDisks.size());
494 14 kreverch
                        log.debug("getZpoolStatus : "+hashZRaid.size());
495 14 kreverch
                        this.setHashDisks(hashDisks);
496 14 kreverch
                        this.setHashZRaid(hashZRaid);
497 14 kreverch
498 14 kreverch
                }
499 14 kreverch
500 14 kreverch
        }
501 14 kreverch
502 14 kreverch
503 14 kreverch
        public void getInfoDisk(){
504 14 kreverch
                if ( this.executeCmd(this.getZserver().zProperties.get("bingetdiskinfo").getValue() +" "+this.getZdisk().zProperties.get("path").getValue())){
505 14 kreverch
                        log.debug("getZpoolStatus");
506 14 kreverch
                        if ( outErr.length() ==0){
507 14 kreverch
                                log.debug(this.getOutCmd());
508 14 kreverch
                                if (this.getOutCmd().length()>0) {
509 14 kreverch
                                        String dataType="";
510 14 kreverch
                                        String[] Tsplit = this.getOutCmd().split("\n");
511 14 kreverch
512 14 kreverch
513 14 kreverch
                                        for (int cpt=0;cpt<Tsplit.length;cpt++){
514 14 kreverch
515 14 kreverch
                                                String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", "").replaceAll("'", "").split(":");
516 14 kreverch
                                                String propertyDisk=TsplitLine[0];
517 14 kreverch
                                                String valuePropertyDisk="";
518 14 kreverch
519 14 kreverch
520 14 kreverch
                                        }
521 14 kreverch
                                }
522 14 kreverch
                        }
523 14 kreverch
                }
524 14 kreverch
        }
525 14 kreverch
526 14 kreverch
527 14 kreverch
        public void getZsnapshotConfig(){
528 14 kreverch
                log.debug("getZsnapshotConfig");
529 14 kreverch
                this.setZsnapshots();
530 14 kreverch
                if (  this.executeCmd(this.getZserver().zProperties.get("bingetconfsnapshot").getValue()+" "+this.getZvol().zProperties.get("name").getValue()) ){
531 14 kreverch
                        if ( outErr.length() ==0){
532 14 kreverch
                                log.debug(this.getOutCmd());
533 14 kreverch
                                if (this.getOutCmd().length()>0) {
534 14 kreverch
                                        String[] Tsplit = this.getOutCmd().split("\n");
535 14 kreverch
                                        for (int cpt=0;cpt<Tsplit.length;cpt++){
536 14 kreverch
                                                String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split("=");
537 14 kreverch
                                                log.debug(TsplitLine.length);
538 14 kreverch
                                                log.debug(TsplitLine[0]+" "+TsplitLine[1]);
539 14 kreverch
540 14 kreverch
                                                this.zsnapshots.zSchedulerProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
541 14 kreverch
                                        }
542 14 kreverch
                                }
543 14 kreverch
544 14 kreverch
                        }else{
545 14 kreverch
                                log.debug(this.getOutCmd());
546 14 kreverch
                                this.setZsnapshots();
547 14 kreverch
                                this.getZsnapshots().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
548 14 kreverch
                                this.getZsnapshots().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
549 14 kreverch
                        }
550 14 kreverch
                }
551 14 kreverch
                this.getZsnapshots().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
552 14 kreverch
                this.getZsnapshots().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
553 14 kreverch
        }
554 14 kreverch
555 14 kreverch
        public void getZreplicaConfig(){
556 14 kreverch
                log.debug("getZreplicaConfig");
557 14 kreverch
                this.setZreplicas();
558 14 kreverch
                log.debug(this.getZserver().zProperties.get("bingetconfreplica").getValue()+" "+this.getZvol().zProperties.get("name").getValue());
559 14 kreverch
                if (  this.executeCmd(this.getZserver().zProperties.get("bingetconfreplica").getValue()+" "+this.getZvol().zProperties.get("name").getValue()) ){
560 14 kreverch
                        if ( outErr.length() ==0){
561 14 kreverch
                                log.debug(this.getOutCmd());
562 14 kreverch
                                if (this.getOutCmd().length()>0) {
563 14 kreverch
                                        String[] Tsplit = this.getOutCmd().split("\n");
564 14 kreverch
                                        for (int cpt=0;cpt<Tsplit.length;cpt++){
565 14 kreverch
                                                String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split("=");
566 14 kreverch
                                                log.debug(TsplitLine.length);
567 14 kreverch
                                                if (TsplitLine.length>1){
568 14 kreverch
                                                        log.debug(TsplitLine[0]+" "+TsplitLine[1]);
569 14 kreverch
                                                        this.zreplicas.zSchedulerProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);
570 14 kreverch
                                                }
571 14 kreverch
                                        }
572 14 kreverch
                                }
573 14 kreverch
574 14 kreverch
                        }else{
575 14 kreverch
                                log.debug(this.getOutCmd());
576 14 kreverch
                                this.setZreplicas();
577 14 kreverch
                                this.getZreplicas().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
578 14 kreverch
                                //this.getZreplicas().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
579 14 kreverch
                        }
580 14 kreverch
                }
581 14 kreverch
582 14 kreverch
583 14 kreverch
                //this.getZsnapshots().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
584 14 kreverch
                //this.getZreplicas().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
585 14 kreverch
        }
586 14 kreverch
587 14 kreverch
        public void zfsEnableSnapshots(){
588 14 kreverch
589 14 kreverch
                String[] keysProp = (String[]) this.getZsnapshots().zSchedulerProperties.keySet().toArray(new String[0]);
590 14 kreverch
                Arrays.sort(keysProp);
591 14 kreverch
                error.clear();
592 14 kreverch
593 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
594 14 kreverch
                        String keyProp = keysProp[i];
595 14 kreverch
                        if ( !this.getZsnapshots().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && this.getZsnapshots().zSchedulerProperties.get(keyProp).getValue().equals("") && !"fileconf".equalsIgnoreCase(keyProp)){
596 14 kreverch
                                error.put(keyProp, keyProp+" cannot be empty");
597 14 kreverch
                        }else{
598 14 kreverch
                                if ( this.getZsnapshots().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().isEmpty()){
599 14 kreverch
                                        error.put(keyProp, keyProp+" cannot be empty");
600 14 kreverch
                                }else{
601 14 kreverch
                                        if (this.getZsnapshots().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().contains("*") && this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().size()>1){
602 14 kreverch
                                                error.put(keyProp, keyProp+ " All is not compatible with others selections");
603 14 kreverch
                                        }
604 14 kreverch
                                }
605 14 kreverch
606 14 kreverch
                        }
607 14 kreverch
                        log.debug(this.getZsnapshots().zSchedulerProperties.get(keyProp).getType()+" "+this.getZsnapshots().zSchedulerProperties.get(keyProp).getValue()+" "+this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues());
608 14 kreverch
                }
609 14 kreverch
610 14 kreverch
                log.debug("ERROR SIZE : "+error.size());
611 14 kreverch
                if ( error.size() ==0){
612 14 kreverch
                        //String contentFileCronSnapshot = this.getZsnapshots().formatCronValue(this.getZsnapshots().zSchedulerProperties.get("frequency").getValue(), this.getZsnapshots().zSchedulerProperties.get("dayofweeksnapshots").getValue());
613 14 kreverch
                        for ( int i=0;i<keysProp.length;i++){
614 14 kreverch
                                String keyProp = keysProp[i];
615 14 kreverch
                                log.debug("zfsEnable "+keyProp);
616 14 kreverch
                                if ( this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues() != null){
617 14 kreverch
                                        if ( this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().size() ==1){
618 14 kreverch
                                                this.getZsnapshots().zSchedulerProperties.get(keyProp).setValue(this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().get(0).toString());
619 14 kreverch
                                        }else{
620 14 kreverch
                                                this.getZsnapshots().zSchedulerProperties.get(keyProp).setValue("");
621 14 kreverch
                                                for ( int cpt=0;cpt<this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().size();cpt++){
622 14 kreverch
                                                        this.getZsnapshots().zSchedulerProperties.get(keyProp).setValue(this.getZsnapshots().zSchedulerProperties.get(keyProp).getValue()+this.getZsnapshots().zSchedulerProperties.get(keyProp).getMultivalues().get(cpt)+",");
623 14 kreverch
                                                }
624 14 kreverch
                                                this.getZsnapshots().zSchedulerProperties.get(keyProp).setValue(this.getZsnapshots().zSchedulerProperties.get(keyProp).getValue().substring(0, this.getZsnapshots().zSchedulerProperties.get(keyProp).getValue().length()-1));
625 14 kreverch
                                        }
626 14 kreverch
                                }
627 14 kreverch
                        }
628 14 kreverch
                        String cronMin = this.getZsnapshots().zSchedulerProperties.get("minutesofsnapshots").getValue();
629 14 kreverch
                        String cronHour = this.getZsnapshots().zSchedulerProperties.get("hoursofsnapshots").getValue();
630 14 kreverch
                        String cronMonth = this.getZsnapshots().zSchedulerProperties.get("monthsnapshots").getValue();
631 14 kreverch
                        String cronDayofMonth = this.getZsnapshots().zSchedulerProperties.get("dayofmonthsnapshots").getValue();
632 14 kreverch
                        String cronDayofWeek = this.getZsnapshots().zSchedulerProperties.get("dayofweeksnapshots").getValue();
633 14 kreverch
                        String nameVolFS=this.getZsnapshots().zSchedulerProperties.get("name").getValue();
634 14 kreverch
                        String typeZFS=this.getZsnapshots().zSchedulerProperties.get("type").getValue();
635 14 kreverch
                        String nbsnapshots=this.getZsnapshots().zSchedulerProperties.get("nbsnapshots").getValue();
636 14 kreverch
                        if (  this.executeCmd(this.getZserver().zProperties.get("binzfsenablesnapshots").getValue()+" -m "+"\""+cronMin+"\""+
637 14 kreverch
                                        " -H "+"\""+cronHour+"\""+
638 14 kreverch
                                        " -M "+"\""+cronMonth+"\""+
639 14 kreverch
                                        " -D "+"\""+cronDayofMonth+"\""+
640 14 kreverch
                                        " -d "+"\""+cronDayofWeek+"\""+
641 14 kreverch
                                        " -N "+"\""+nameVolFS+"\""+
642 14 kreverch
                                        " -t "+"\""+typeZFS+"\""+
643 14 kreverch
                                        " -k "+"\""+nbsnapshots+"\"")){
644 14 kreverch
                                if ( outErr.length() ==0){
645 14 kreverch
                                        log.debug(this.getOutCmd());
646 14 kreverch
                                        String[] Tsplit = this.getOutCmd().split("\n");
647 14 kreverch
                                        for (int cpt=0;cpt<Tsplit.length;cpt++){
648 14 kreverch
                                                /*String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split("=");
649 14 kreverch
                                                log.debug(TsplitLine.length);
650 14 kreverch
                                                log.debug(TsplitLine[0]+" "+TsplitLine[1]);
651 14 kreverch
                                                this.zsnapshots.zSchedulerProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);*/
652 14 kreverch
                                        }
653 14 kreverch
                                }else{
654 14 kreverch
                                        log.debug(this.getOutCmd());
655 14 kreverch
                                        this.setZsnapshots();
656 14 kreverch
                                        this.getZsnapshots().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
657 14 kreverch
                                        this.getZsnapshots().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
658 14 kreverch
                                }
659 14 kreverch
                        }
660 14 kreverch
                }
661 14 kreverch
        }
662 14 kreverch
663 14 kreverch
664 14 kreverch
        public void zfsDisableSnapshots(){
665 14 kreverch
                error.clear();
666 14 kreverch
                if (  this.executeCmd(this.getZserver().zProperties.get("binzfsdisablesnapshots").getValue()+" -N "+"\""+this.getZsnapshots().zSchedulerProperties.get("name").getValue()+"\"" )){
667 14 kreverch
                        if ( outErr.length() ==0){
668 14 kreverch
                                log.debug(this.getOutCmd());
669 14 kreverch
                        }else{
670 14 kreverch
                                log.debug(this.getOutCmd());
671 14 kreverch
                                if (outErr.length()>0){
672 14 kreverch
                                        error.put("binzfsdisablesnapshots", outErr+"\n" );
673 14 kreverch
                                }
674 14 kreverch
                        }
675 14 kreverch
                }
676 14 kreverch
        }
677 14 kreverch
678 14 kreverch
        public void zfsSnapshots(){
679 14 kreverch
                error.clear();
680 14 kreverch
                if ( this.getZsnapshots().zSchedulerProperties.get("fileconf").getValue().isEmpty()){
681 14 kreverch
                        error.put("fileconf ", "Please configure the Snapshots");
682 14 kreverch
                }
683 14 kreverch
                if ( error.size() < 1){
684 14 kreverch
                        if (  this.executeCmd(this.getZserver().zProperties.get("binzfssnapshots").getValue()+" "+"\""+this.getZsnapshots().zSchedulerProperties.get("fileconf").getValue()+"\"" )){
685 14 kreverch
                                if ( outErr.length() ==0){
686 14 kreverch
                                        log.debug(this.getOutCmd());
687 14 kreverch
                                }else{
688 14 kreverch
                                        log.debug(this.getOutCmd());
689 14 kreverch
                                        if (outErr.length()>0){
690 14 kreverch
                                                error.put("binzfssnapshots", outErr+"\n" );
691 14 kreverch
                                        }
692 14 kreverch
                                }
693 14 kreverch
                        }
694 14 kreverch
                }
695 14 kreverch
        }
696 14 kreverch
697 14 kreverch
698 14 kreverch
        public void zfsEnableReplicas(){
699 14 kreverch
700 14 kreverch
                String[] keysProp = (String[]) this.getZreplicas().zSchedulerProperties.keySet().toArray(new String[0]);
701 14 kreverch
                Arrays.sort(keysProp);
702 14 kreverch
                error.clear();
703 14 kreverch
704 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
705 14 kreverch
                        String keyProp = keysProp[i];
706 14 kreverch
                        log.debug("zfsEnableReplicas "+keyProp);
707 14 kreverch
                        if ( !this.getZreplicas().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && !this.getZreplicas().zSchedulerProperties.get(keyProp).getType().equals("noupdateable") && this.getZreplicas().zSchedulerProperties.get(keyProp).getValue().equals("")){
708 14 kreverch
                                error.put(keyProp, keyProp+" cannot be empty");
709 14 kreverch
                        }else{
710 14 kreverch
                                if ( "nofreeentry".equalsIgnoreCase(this.getZreplicas().zSchedulerProperties.get(keyProp).getType()) && (this.getZreplicas().zSchedulerProperties.get(keyProp).getPermitValue() !=null)){
711 14 kreverch
                                        if ( this.getZreplicas().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().isEmpty()){
712 14 kreverch
                                                error.put(keyProp, keyProp+" cannot be empty");
713 14 kreverch
                                        }else{
714 14 kreverch
                                                if (this.getZreplicas().zSchedulerProperties.get(keyProp).getType().equals("nofreeentry") && this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().contains("*") && this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().size()>1){
715 14 kreverch
                                                        error.put(keyProp, keyProp+ " All is not compatible with others selections");
716 14 kreverch
                                                }
717 14 kreverch
                                        }
718 14 kreverch
                                }
719 14 kreverch
                        }
720 14 kreverch
                        log.debug(this.getZreplicas().zSchedulerProperties.get(keyProp).getType()+" "+this.getZreplicas().zSchedulerProperties.get(keyProp).getValue()+" "+this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues());
721 14 kreverch
                }
722 14 kreverch
                if ("".equalsIgnoreCase(this.getZreplicas().zSchedulerProperties.get("replicapool").getValue())){
723 14 kreverch
                        error.put("replicaPool", "replicapool cannot be empty");
724 14 kreverch
                }
725 14 kreverch
726 14 kreverch
                log.debug("ERROR SIZE : "+error.size());
727 14 kreverch
                if ( error.size() ==0){
728 14 kreverch
                        //String contentFileCronSnapshot = this.getZsnapshots().formatCronValue(this.getZsnapshots().zSchedulerProperties.get("frequency").getValue(), this.getZsnapshots().zSchedulerProperties.get("dayofweeksnapshots").getValue());
729 14 kreverch
                        for ( int i=0;i<keysProp.length;i++){
730 14 kreverch
                                String keyProp = keysProp[i];
731 14 kreverch
                                log.debug("zfsEnable Replica"+keyProp);
732 14 kreverch
                                if ( this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues() != null){
733 14 kreverch
                                        if ( this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().size() ==1){
734 14 kreverch
                                                this.getZreplicas().zSchedulerProperties.get(keyProp).setValue(this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().get(0).toString());
735 14 kreverch
                                        }else{
736 14 kreverch
                                                this.getZreplicas().zSchedulerProperties.get(keyProp).setValue("");
737 14 kreverch
                                                for ( int cpt=0;cpt<this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().size();cpt++){
738 14 kreverch
                                                        this.getZreplicas().zSchedulerProperties.get(keyProp).setValue(this.getZreplicas().zSchedulerProperties.get(keyProp).getValue()+this.getZreplicas().zSchedulerProperties.get(keyProp).getMultivalues().get(cpt)+",");
739 14 kreverch
                                                }
740 14 kreverch
                                                this.getZreplicas().zSchedulerProperties.get(keyProp).setValue(this.getZreplicas().zSchedulerProperties.get(keyProp).getValue().substring(0, this.getZreplicas().zSchedulerProperties.get(keyProp).getValue().length()-1));
741 14 kreverch
                                        }
742 14 kreverch
                                }
743 14 kreverch
                        }
744 14 kreverch
                        String cronMin = this.getZreplicas().zSchedulerProperties.get("minutesofreplicas").getValue();
745 14 kreverch
                        String cronHour = this.getZreplicas().zSchedulerProperties.get("hoursofreplicas").getValue();
746 14 kreverch
                        String cronMonth = this.getZreplicas().zSchedulerProperties.get("monthreplicas").getValue();
747 14 kreverch
                        String cronDayofMonth = this.getZreplicas().zSchedulerProperties.get("dayofmonthreplicas").getValue();
748 14 kreverch
                        String cronDayofWeek = this.getZreplicas().zSchedulerProperties.get("dayofweekreplicas").getValue();
749 14 kreverch
                        String nameVolFS=this.getZreplicas().zSchedulerProperties.get("name").getValue();
750 14 kreverch
                        String nameReplica=this.getZreplicas().zSchedulerProperties.get("replicapool").getValue()+"/"+this.getZvol().zProperties.get("name").getValue().split("/")[1];
751 14 kreverch
                        String lastSnapshotsReplicated=this.getZreplicas().zSchedulerProperties.get("lastsnapshotreplicated").getValue();
752 14 kreverch
                        String nbReplica=this.getZreplicas().zSchedulerProperties.get("nbreplica").getValue();
753 14 kreverch
                        String cmd2exec = this.getZserver().zProperties.get("binzfsenablereplicas").getValue()+" -m "+"\""+cronMin+"\""+
754 14 kreverch
                                        " -H "+"\""+cronHour+"\""+
755 14 kreverch
                                        " -M "+"\""+cronMonth+"\""+
756 14 kreverch
                                        " -D "+"\""+cronDayofMonth+"\""+
757 14 kreverch
                                        " -d "+"\""+cronDayofWeek+"\""+
758 14 kreverch
                                        " -o "+"\""+nameVolFS+"\""+
759 14 kreverch
                                        " -r "+"\""+nameReplica+"\""+
760 14 kreverch
                                        " -n "+"\""+nbReplica+"\"";
761 14 kreverch
762 14 kreverch
                        if (!"".equalsIgnoreCase(this.getZreplicas().zSchedulerProperties.get("server").getValue()) && (!this.getZserver().zProperties.get("serverIP").getValue().equalsIgnoreCase(this.getZreplicas().zSchedulerProperties.get("server").getValue())) ){
763 14 kreverch
                                cmd2exec = cmd2exec +" -s "+this.getZreplicas().zSchedulerProperties.get("server").getValue();
764 14 kreverch
                        }
765 14 kreverch
                        log.debug(cmd2exec+" "+this.getZreplicas().zSchedulerProperties.get("server").getValue()+" "+this.getZserver().zProperties.get("serverIP").getValue());
766 14 kreverch
                        if (  this.executeCmd(cmd2exec)){
767 14 kreverch
                                if ( outErr.length() ==0){
768 14 kreverch
                                        log.debug(this.getOutCmd());
769 14 kreverch
                                        String[] Tsplit = this.getOutCmd().split("\n");
770 14 kreverch
                                        for (int cpt=0;cpt<Tsplit.length;cpt++){
771 14 kreverch
                                                /*String[] TsplitLine = Tsplit[cpt].replaceAll("\n", "").replaceAll("\\s+", " ").split("=");
772 14 kreverch
                                                log.debug(TsplitLine.length);
773 14 kreverch
                                                log.debug(TsplitLine[0]+" "+TsplitLine[1]);
774 14 kreverch
                                                this.zsnapshots.zSchedulerProperties.get(TsplitLine[0]).setValue(TsplitLine[1]);*/
775 14 kreverch
                                        }
776 14 kreverch
                                }else{
777 14 kreverch
                                        log.debug(this.getOutCmd());
778 14 kreverch
                                        this.setZreplicas();
779 14 kreverch
                                        this.getZreplicas().zSchedulerProperties.get("name").setValue(this.getZvol().zProperties.get("name").getValue());
780 14 kreverch
                                        //this.getZreplicas().zSchedulerProperties.get("type").setValue(this.getZvol().zProperties.get("type").getValue());
781 14 kreverch
                                }
782 14 kreverch
                        }
783 14 kreverch
                }
784 14 kreverch
        }
785 14 kreverch
786 14 kreverch
787 14 kreverch
        public void zfsDisableReplicas(){
788 14 kreverch
                error.clear();
789 14 kreverch
                if (  this.executeCmd(this.getZserver().zProperties.get("binzfsdisablereplicas").getValue()+" -N "+"\""+this.getZreplicas().zSchedulerProperties.get("name").getValue()+"\"" )){
790 14 kreverch
                        if ( outErr.length() ==0){
791 14 kreverch
                                log.debug(this.getOutCmd());
792 14 kreverch
                        }else{
793 14 kreverch
                                log.debug(this.getOutCmd());
794 14 kreverch
                                if (outErr.length()>0){
795 14 kreverch
                                        error.put("binzfsdisablereplicas", outErr+"\n" );
796 14 kreverch
                                }
797 14 kreverch
                        }
798 14 kreverch
                }
799 14 kreverch
        }
800 14 kreverch
801 14 kreverch
        public void zfsReplicas(){
802 14 kreverch
                error.clear();
803 14 kreverch
                if ( this.getZreplicas().zSchedulerProperties.get("fileconf").getValue().isEmpty()){
804 14 kreverch
                        error.put("fileconf ", "Please configure the replication");
805 14 kreverch
                }
806 14 kreverch
                if ( error.size() < 1){
807 14 kreverch
                        if (  this.executeCmd(this.getZserver().zProperties.get("binzfsreplica").getValue()+" "+"\""+this.getZreplicas().zSchedulerProperties.get("fileconf").getValue()+"\" &" )){
808 14 kreverch
                                if ( outErr.length() ==0){
809 14 kreverch
                                        log.debug(this.getOutCmd());
810 14 kreverch
                                }else{
811 14 kreverch
                                        log.debug(this.getOutCmd());
812 14 kreverch
                                        if (outErr.length()>0){
813 14 kreverch
                                                error.put("binzfsreplica", outErr+"\n" );
814 14 kreverch
                                        }
815 14 kreverch
                                }
816 14 kreverch
                        }
817 14 kreverch
                }
818 14 kreverch
        }
819 14 kreverch
820 14 kreverch
821 14 kreverch
        public void zfsCreateVolFS(){
822 14 kreverch
                error.clear();
823 14 kreverch
                if (this.getZpool().zProperties.get("name").getValue().equals("")){
824 14 kreverch
                        error.put("pool", "Please select a pool");
825 14 kreverch
                }
826 14 kreverch
                String[] keysProp = (String[]) this.getZvol().zProperties.keySet().toArray(new String[0]);
827 14 kreverch
                Arrays.sort(keysProp);
828 14 kreverch
                String optionsList="";
829 14 kreverch
                for (int i = 0; i < keysProp.length; i++) {
830 14 kreverch
                        String keyProp = keysProp[i];
831 14 kreverch
                        log.debug(keyProp);
832 14 kreverch
                        if ( ("volume".equalsIgnoreCase(this.getZvol().zProperties.get("type").getValue()) &&
833 14 kreverch
                                        ("volume".equalsIgnoreCase(this.getZvol().zProperties.get(keyProp).getPropertyOf()) ||
834 14 kreverch
                                                        "volandfs".equalsIgnoreCase(this.getZvol().zProperties.get(keyProp).getPropertyOf())))) {
835 14 kreverch
                                if (this.getZvol().zProperties.get(keyProp).getValue().equals("")&&!this.getZvol().zProperties.get(keyProp).getType().equals("noupdateable")){
836 14 kreverch
                                        error.put(keyProp, keyProp+" cannot be empty");
837 14 kreverch
                                }
838 14 kreverch
                                if ( keyProp.equals("volblocksize")&& "".equals(this.getZvol().zProperties.get(keyProp).getValue())){
839 14 kreverch
                                        error.put(keyProp, keyProp+" cannot be empty");
840 14 kreverch
                                }
841 14 kreverch
842 14 kreverch
                                String nameVolFS = this.getZvol().zProperties.get("name").getValue();
843 14 kreverch
                                //Available space
844 14 kreverch
                                if (keyProp.equals("volsize")&& !"".equals(this.getZvol().zProperties.get(keyProp).getValue())){
845 14 kreverch
                                        String unit = this.getZvol().zProperties.get("volsize").getValue().substring(this.getZvol().zProperties.get("volsize").getValue().length()-1, this.getZvol().zProperties.get("volsize").getValue().length());
846 14 kreverch
847 14 kreverch
                                        if ( !unit.equalsIgnoreCase("T") && !unit.equalsIgnoreCase("G") && !unit.equalsIgnoreCase("M")){
848 14 kreverch
                                                error.put("volsize", "Field size : Unit valid est T,G or M");
849 14 kreverch
                                        }else{
850 14 kreverch
                                                Float realUseableSpace = this.convertInReferenceUnit(this.getZpool().zProperties.get("realuseablespace").getValue(), unit);
851 14 kreverch
                                                Float sizeVolFS = this.convertInReferenceUnit(this.getZvol().zProperties.get("volsize").getValue(), unit);
852 14 kreverch
                                                this.zfsGetInfoByProperty(this.getZpool().zProperties.get("name").getValue(), "used");
853 14 kreverch
                                                Float usedSpace = this.convertInReferenceUnit(this.getZvol().zProperties.get("used").getValue(), unit);
854 14 kreverch
                                                this.getZvol().zProperties.get("name").setValue(nameVolFS);
855 14 kreverch
                                                Float freeSpace = realUseableSpace - usedSpace;
856 14 kreverch
                                                if ( sizeVolFS > freeSpace){
857 14 kreverch
                                                        error.put("freespace", "No space available. Free Pool Space : "+String.valueOf(freeSpace)+unit);
858 14 kreverch
                                                }
859 14 kreverch
                                        }
860 14 kreverch
                                }
861 14 kreverch
                                log.debug("zfsCreateVolFS : "+keyProp+" "+this.getZvol().zProperties.get(keyProp).getType());
862 14 kreverch
                                if (!keyProp.equals("name") &&  !this.getZvol().zProperties.get(keyProp).getType().equals("noupdateable")){
863 14 kreverch
                                        log.debug("zfsCreateVolFS :"+keyProp);
864 14 kreverch
                                        optionsList = optionsList+keyProp+"="+this.getZvol().zProperties.get(keyProp).getValue()+",";
865 14 kreverch
                                }
866 14 kreverch
                        }else{
867 14 kreverch
                                if (("filesystem".equalsIgnoreCase(this.getZvol().zProperties.get("type").getValue()) &&
868 14 kreverch
                                                "fs".equalsIgnoreCase(this.getZvol().zProperties.get(keyProp).getPropertyOf())||"volandfs".equalsIgnoreCase(this.getZvol().zProperties.get(keyProp).getPropertyOf()))        ){
869 14 kreverch
                                        if (this.getZvol().zProperties.get(keyProp).getValue().equals("")&&!this.getZvol().zProperties.get(keyProp).getType().equals("noupdateable")&&!"quota".equals(keyProp)&&!"reservation".equals(keyProp) ){
870 14 kreverch
                                                error.put(keyProp, keyProp+" cannot be empty");
871 14 kreverch
                                        }
872 14 kreverch
                                        if (("quota".equals(keyProp)||"reservation".equals(keyProp))&&"".equals(this.getZvol().zProperties.get(keyProp).getValue())){
873 14 kreverch
                                                this.getZvol().zProperties.get(keyProp).setValue("none");
874 14 kreverch
                                        }
875 14 kreverch
                                        if (("quota".equals(keyProp)||"reservation".equals(keyProp))&& !"none".equals(this.getZvol().zProperties.get(keyProp).getValue()) &&!"".equals(this.getZvol().zProperties.get(keyProp).getValue())){
876 14 kreverch
                                                String nameVolFS = this.getZvol().zProperties.get("name").getValue();
877 14 kreverch
                                                String unit = this.getZvol().zProperties.get(keyProp).getValue().substring(this.getZvol().zProperties.get(keyProp).getValue().length()-1, this.getZvol().zProperties.get(keyProp).getValue().length());
878 14 kreverch
                                                if ( !unit.equalsIgnoreCase("T") && !unit.equalsIgnoreCase("G") && !unit.equalsIgnoreCase("M")){
879 14 kreverch
                                                        error.put(keyProp, "Field "+keyProp+" : Unit valid est T,G or M");
880 14 kreverch
                                                }else{
881 14 kreverch
                                                        Float realUseableSpace = this.convertInReferenceUnit(this.getZpool().zProperties.get("realuseablespace").getValue(), unit);
882 14 kreverch
                                                        Float valueKeyProp = this.convertInReferenceUnit(this.getZvol().zProperties.get(keyProp).getValue(), unit);
883 14 kreverch
                                                        this.zfsGetInfoByProperty(this.getZpool().zProperties.get("name").getValue(), "used");
884 14 kreverch
                                                        Float usedSpace = this.convertInReferenceUnit(this.getZvol().zProperties.get("used").getValue(), unit);
885 14 kreverch
                                                        this.getZvol().zProperties.get("name").setValue(nameVolFS);
886 14 kreverch
                                                        Float freeSpace = realUseableSpace - usedSpace;
887 14 kreverch
                                                        if ( valueKeyProp > freeSpace){
888 14 kreverch
                                                                error.put(keyProp, "Error value for "+keyProp+" : No space available. Free Pool Space : "+String.valueOf(freeSpace)+unit);
889 14 kreverch
                                                        }
890 14 kreverch
                                                }
891 14 kreverch
                                        }
892 14 kreverch
                                        log.debug("zfsCreateVolFS : "+keyProp+" "+this.getZvol().zProperties.get(keyProp).getType());
893 14 kreverch
                                        if (!keyProp.equals("name") &&  !this.getZvol().zProperties.get(keyProp).getType().equals("noupdateable")){
894 14 kreverch
                                                log.debug("zfsCreateVolFS :"+keyProp);
895 14 kreverch
                                                optionsList = optionsList+keyProp+"="+this.getZvol().zProperties.get(keyProp).getValue()+",";
896 14 kreverch
                                        }
897 14 kreverch
                                }
898 14 kreverch
899 14 kreverch
                        }
900 14 kreverch
                }
901 14 kreverch
                if (error.size()==0){
902 14 kreverch
                        log.debug(optionsList);
903 14 kreverch
                        if ( optionsList.length()>0){
904 14 kreverch
                                optionsList=optionsList.substring(0, optionsList.length()-1);
905 14 kreverch
                        }
906 14 kreverch
907 14 kreverch
                        if ( "volume".equals(this.getZvol().zProperties.get("type").getValue())&& this.executeCmd(this.getZserver().zProperties.get("binzfscreatevolume").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue()+
908 14 kreverch
                                        " -p "+this.getZpool().zProperties.get("name").getValue()+
909 14 kreverch
                                        " -b "+this.getZvol().zProperties.get("volblocksize").getValue()+
910 14 kreverch
                                        " -s "+this.getZvol().zProperties.get("volsize").getValue()+
911 14 kreverch
                                        " -o "+optionsList)){
912 14 kreverch
                                if ( outErr.length() ==0){
913 14 kreverch
                                        log.debug(this.getOutCmd());
914 14 kreverch
                                }else{
915 14 kreverch
                                        log.debug(this.getOutCmd());
916 14 kreverch
                                        error.put("binzfscreatevolume", "Incoherence : Please connect you to server and launch manualy "+this.getZserver().zProperties.get("binzfscreatevolume").getValue() );
917 14 kreverch
                                }
918 14 kreverch
                        }else{
919 14 kreverch
                                if ("filesystem".equals(this.getZvol().zProperties.get("type").getValue())&& this.executeCmd(this.getZserver().zProperties.get("binzfscreatefilesystem").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue()+
920 14 kreverch
                                                " -p "+this.getZpool().zProperties.get("name").getValue()+
921 14 kreverch
                                                " -o "+optionsList)){
922 14 kreverch
                                        if ( outErr.length() ==0){
923 14 kreverch
                                                log.debug(this.getOutCmd());
924 14 kreverch
                                        }else{
925 14 kreverch
                                                log.debug(this.getOutCmd());
926 14 kreverch
                                                error.put("binzfscreatefilesystem", "Incoherence : Please connect you to server and launch manualy "+this.getZserver().zProperties.get("binzfscreatefilesystem").getValue() );
927 14 kreverch
                                        }
928 14 kreverch
                                }
929 14 kreverch
                        }
930 14 kreverch
                }else{
931 14 kreverch
                        log.debug("Error : "+error.size());
932 14 kreverch
                }
933 14 kreverch
        }
934 14 kreverch
935 14 kreverch
        public void zfsUmountFS(){
936 14 kreverch
                error.clear();
937 14 kreverch
                if ("".equals(this.getZvol().zProperties.get("name").getValue())){
938 14 kreverch
                        error.put("name", "Please select a ZFS FileSystem");
939 14 kreverch
                }
940 14 kreverch
                if (error.size()==0){
941 14 kreverch
                        if (this.executeCmd(this.getZserver().zProperties.get("binzfs").getValue()+" umount "+this.getZvol().zProperties.get("name").getValue())){
942 14 kreverch
                                if ( outErr.length() ==0){
943 14 kreverch
                                        log.debug(this.getOutCmd());
944 14 kreverch
                                }else{
945 14 kreverch
                                        log.debug(this.getOutCmd());
946 14 kreverch
                                        if (outErr.toString().contains("Error")){
947 14 kreverch
                                                error.put("binzfs", "Incoherence : Please connect you to server and launch manualy "+this.getZserver().zProperties.get("binzfs").getValue() );
948 14 kreverch
                                        }
949 14 kreverch
                                }
950 14 kreverch
                        }else{
951 14 kreverch
                                error.put("executeCmd", "Problem with the command : "+this.getZserver().zProperties.get("binzfs").getValue()+" umount "+this.getZvol().zProperties.get("name").getValue());
952 14 kreverch
                        }
953 14 kreverch
                }
954 14 kreverch
955 14 kreverch
        }
956 14 kreverch
957 14 kreverch
        public void zfsDestroyVolFS(){
958 14 kreverch
                error.clear();
959 14 kreverch
                if ("".equals(this.getZvol().zProperties.get("name").getValue())){
960 14 kreverch
                        error.put("name", "Please select a ZFS FileSystem");
961 14 kreverch
                }
962 14 kreverch
                if ( error.size()==0){
963 14 kreverch
                        if ( "filesystem".equals(this.getZvol().zProperties.get("type").getValue())){
964 14 kreverch
                                if ( this.executeCmd(this.getZserver().zProperties.get("binzfsdelfilesystem").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue() )) {
965 14 kreverch
                                        if ( outErr.length() ==0){
966 14 kreverch
                                                log.debug(this.getOutCmd());
967 14 kreverch
                                        }else{
968 14 kreverch
                                                log.debug(this.getOutCmd());
969 14 kreverch
                                                if (outErr.length()>0){
970 14 kreverch
                                                        error.put("binzfsdelvolume", outErr+"\n" );
971 14 kreverch
                                                }
972 14 kreverch
                                        }
973 14 kreverch
                                }else{
974 14 kreverch
                                        error.put("executeCmd", "Problem with the command : "+this.getZserver().zProperties.get("binzfsdelfilesystem").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue());
975 14 kreverch
                                }
976 14 kreverch
                        }else{
977 14 kreverch
                                if ( "volume".equals(this.getZvol().zProperties.get("type").getValue())){
978 14 kreverch
                                        if ( this.executeCmd(this.getZserver().zProperties.get("binzfsdelvolume").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue() )) {
979 14 kreverch
                                                if ( outErr.length() ==0){
980 14 kreverch
                                                        log.debug(this.getOutCmd());
981 14 kreverch
                                                }else{
982 14 kreverch
                                                        log.debug(this.getOutCmd());
983 14 kreverch
                                                        if (outErr.length()>0){
984 14 kreverch
                                                                error.put("binzfsdelvolume", outErr+"\n" );
985 14 kreverch
                                                        }
986 14 kreverch
                                                }
987 14 kreverch
                                        }else{
988 14 kreverch
                                                error.put("executeCmd", "Problem with the command : "+this.getZserver().zProperties.get("binzfsdelvolume").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue());
989 14 kreverch
                                        }
990 14 kreverch
                                }else{
991 14 kreverch
                                        if ( "snapshot".equals(this.getZvol().zProperties.get("type").getValue())){
992 14 kreverch
                                                if ( this.executeCmd(this.getZserver().zProperties.get("binzfsdelvolume").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue() )) {
993 14 kreverch
                                                        if ( outErr.length() ==0){
994 14 kreverch
                                                                log.debug(this.getOutCmd());
995 14 kreverch
                                                        }else{
996 14 kreverch
                                                                log.debug(this.getOutCmd());
997 14 kreverch
                                                                if (outErr.length()>0){
998 14 kreverch
                                                                        error.put("binzfsdelvolume", outErr+"\n" );
999 14 kreverch
                                                                }
1000 14 kreverch
                                                        }
1001 14 kreverch
                                                }else{
1002 14 kreverch
                                                        error.put("executeCmd", "Problem with the command : "+this.getZserver().zProperties.get("binzfsdelvolume").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue());
1003 14 kreverch
                                                }
1004 14 kreverch
                                        }
1005 14 kreverch
                                }
1006 14 kreverch
                        }
1007 14 kreverch
1008 14 kreverch
                }
1009 14 kreverch
        }
1010 14 kreverch
1011 14 kreverch
        public void zfsCreateIscsi(){
1012 14 kreverch
                String[] keysProp = (String[]) this.getZiscsi().zProperties.keySet().toArray(new String[0]);
1013 14 kreverch
                Arrays.sort(keysProp);
1014 14 kreverch
                error.clear();
1015 14 kreverch
                if ("filesystem".equals(this.getZvol().zProperties.get("type").getValue())){
1016 14 kreverch
                        error.put("type", "You cannot add a iscsi configuration for a zfs filesystem");
1017 14 kreverch
                }
1018 14 kreverch
1019 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
1020 14 kreverch
                        String keyProp = keysProp[i];
1021 14 kreverch
                        if (!this.getZiscsi().zProperties.get(keyProp).getType().contains("noupdateable") && !keyProp.equalsIgnoreCase("allowIP")){
1022 14 kreverch
                                if ( "".equals(this.getZiscsi().zProperties.get(keyProp).getValue())) {
1023 14 kreverch
                                        error.put(keyProp, this.getZiscsi().zProperties.get(keyProp).getLabelProperty()+" cannot be empty" );
1024 14 kreverch
                                }
1025 14 kreverch
                        }
1026 14 kreverch
                }
1027 14 kreverch
                if (!"".equals(this.getZiscsi().zProperties.get("tid").getValue())){
1028 14 kreverch
                        error.put("tid", "Iscsi is already configured for this volume" );
1029 14 kreverch
                }
1030 14 kreverch
1031 14 kreverch
                if ( error.size() ==0){
1032 14 kreverch
                        String cmd = this.getZserver().zProperties.get("binzfsaddiscsi").getValue()+" -d "+this.getZserver().zProperties.get("pathzfsvoldevice").getValue()+this.getZiscsi().zProperties.get("name").getValue()
1033 14 kreverch
                                        +" -T "+this.getZiscsi().zProperties.get("exportType").getValue()+
1034 14 kreverch
                                        " -L 0"+
1035 14 kreverch
                                        " -o "+this.getZiscsi().zProperties.get("iomode").getValue()+
1036 14 kreverch
                                        " -l "+this.getZiscsi().zProperties.get("login").getValue()+
1037 14 kreverch
                                        " -p "+this.getZiscsi().zProperties.get("passwd").getValue()+
1038 14 kreverch
                                        " -t "+this.getZiscsi().zProperties.get("name").getValue();
1039 14 kreverch
                        if (!this.getZiscsi().zProperties.get("allowIP").getValue().isEmpty()){
1040 14 kreverch
                                cmd = cmd +" -R "+"\""+this.getZiscsi().zProperties.get("allowIP").getValue()+"\"";
1041 14 kreverch
                        }
1042 14 kreverch
                        if (  this.executeCmd(cmd)){
1043 14 kreverch
                                if ( outErr.length() ==0){
1044 14 kreverch
                                        //log.debug(this.getOutCmd());
1045 14 kreverch
                                }else{
1046 14 kreverch
                                        if (outErr.toString().contains("Error")){
1047 14 kreverch
                                                error.put("pathzfsvoldevice", "Incoherence : Please connect you to server and launch manualy "+this.getZserver().zProperties.get("binzfsaddiscsi").getValue() );
1048 14 kreverch
                                        }
1049 14 kreverch
                                }
1050 14 kreverch
                        }
1051 14 kreverch
                }
1052 14 kreverch
        }
1053 14 kreverch
1054 14 kreverch
        public void zfsDelIscsi(){
1055 14 kreverch
                error.clear();
1056 14 kreverch
                if (!"".equals(this.getZiscsi().zProperties.get("tid").getValue())){
1057 14 kreverch
                        if (  this.executeCmd(this.getZserver().zProperties.get("binzfsdeliscsi").getValue()+" -T "+"\""+this.getZiscsi().zProperties.get("tid").getValue()+"\"" )){
1058 14 kreverch
                                if ( outErr.length() ==0){
1059 14 kreverch
                                        log.debug(this.getOutCmd());
1060 14 kreverch
                                }else{
1061 14 kreverch
                                        log.debug("zdsdelIscsi Error : " +outErr);
1062 14 kreverch
                                        if ( outErr.toString().contains("in use")){
1063 14 kreverch
                                                error.put("binzfsdeliscsi", outErr.toString() );
1064 14 kreverch
                                        }else{
1065 14 kreverch
                                                error.put("binzfsdeliscsi", outErr+"\n"+"Incoherence : Please connect you to server and launch manualy "+this.getZserver().zProperties.get("binzfsdeliscsi").getValue() );
1066 14 kreverch
                                        }
1067 14 kreverch
                                }
1068 14 kreverch
                        }
1069 14 kreverch
                }
1070 14 kreverch
1071 14 kreverch
        }
1072 14 kreverch
1073 14 kreverch
1074 14 kreverch
        public void zfsClone(){
1075 14 kreverch
                error.clear();
1076 14 kreverch
                if ("".equals(this.getZvol().zProperties.get("name").getValue())){
1077 14 kreverch
                        error.put("name", "Please, select a volume or filesystem to clone" );
1078 14 kreverch
                }
1079 14 kreverch
1080 14 kreverch
                if ( error.size() ==0){
1081 14 kreverch
                        String cmd = this.getZserver().zProperties.get("binzfsclone").getValue()+" -n "+this.getZvol().zProperties.get("name").getValue();
1082 14 kreverch
                        if (  this.executeCmd(cmd)){
1083 14 kreverch
                                if ( outErr.length() ==0){
1084 14 kreverch
                                        log.debug(this.getOutCmd());
1085 14 kreverch
                                        String[] TsplitOut = this.getOutCmd().split("\n");
1086 14 kreverch
                                        if (TsplitOut.length>0){
1087 14 kreverch
                                                String[] TsplitLine = TsplitOut[0].split("name:");
1088 14 kreverch
                                                if (TsplitLine.length>0){
1089 14 kreverch
                                                        this.zfsGetAllVolume(TsplitLine[1]);
1090 14 kreverch
                                                        if ("".equalsIgnoreCase(this.getZvol().zProperties.get("name").getValue())){
1091 14 kreverch
                                                                error.put("zfsclone", "Clone Creation failed");
1092 14 kreverch
                                                        }
1093 14 kreverch
                                                }
1094 14 kreverch
                                        }
1095 14 kreverch
                                }else{
1096 14 kreverch
                                        if (outErr.length()>0){
1097 14 kreverch
                                                error.put("zfsclone", outErr);
1098 14 kreverch
                                        }
1099 14 kreverch
                                }
1100 14 kreverch
                        }
1101 14 kreverch
                }
1102 14 kreverch
        }
1103 14 kreverch
1104 14 kreverch
1105 14 kreverch
        public float convertInReferenceUnit(String value2Convert, String refUnit){
1106 14 kreverch
1107 14 kreverch
                float convertedValue=0;
1108 21 kreverch
                value2Convert = value2Convert.replace(",", ".");
1109 14 kreverch
                log.debug("convertInReferenceUnit "+value2Convert+" "+refUnit);
1110 14 kreverch
                if ( refUnit.equalsIgnoreCase("T")){
1111 14 kreverch
                        if (value2Convert.contains("T")){
1112 14 kreverch
                                convertedValue=Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)));
1113 14 kreverch
                        }else{
1114 14 kreverch
                                if (value2Convert.contains("G")){
1115 14 kreverch
                                        convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))/1024);
1116 14 kreverch
                                }else{
1117 14 kreverch
                                        if (value2Convert.contains("M")){
1118 14 kreverch
                                                convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))/1048576);
1119 14 kreverch
                                        }else{
1120 14 kreverch
                                                if (value2Convert.contains("K")){
1121 14 kreverch
                                                        convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))/1073741824);
1122 14 kreverch
                                                }
1123 14 kreverch
                                        }
1124 14 kreverch
                                }
1125 14 kreverch
                        }
1126 14 kreverch
1127 14 kreverch
                }
1128 14 kreverch
1129 14 kreverch
                if ( refUnit.equalsIgnoreCase("G")){
1130 14 kreverch
                        if (value2Convert.contains("G")){
1131 14 kreverch
                                convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1))));
1132 14 kreverch
                        }else{
1133 14 kreverch
                                if (value2Convert.contains("T")){
1134 14 kreverch
                                        convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))*1024);
1135 14 kreverch
                                }else{
1136 14 kreverch
                                        if (value2Convert.contains("M")){
1137 14 kreverch
                                                convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))/1024);
1138 14 kreverch
                                        }else{
1139 14 kreverch
                                                if (value2Convert.contains("K")){
1140 14 kreverch
                                                        convertedValue=(Float.valueOf(value2Convert.substring(0, (value2Convert.length()-1)))/1048576);
1141 14 kreverch
                                                }
1142 14 kreverch
                                        }
1143 14 kreverch
                                }
1144 14 kreverch
                        }
1145 14 kreverch
                }
1146 14 kreverch
                log.debug("getZpoolProvisionedSpace "+convertedValue);
1147 14 kreverch
                return convertedValue;
1148 14 kreverch
        }
1149 14 kreverch
1150 14 kreverch
        public List<Object> zfsList(){
1151 14 kreverch
                zfsList.clear();
1152 14 kreverch
1153 14 kreverch
1154 14 kreverch
                if (  this.executeCmd("/sbin/zfs list -H") ){
1155 14 kreverch
                        String[] Tsplit = this.getOutCmd().split("\n");
1156 14 kreverch
                        for (int cpt=0;cpt<Tsplit.length;cpt++){
1157 14 kreverch
                                log.debug(Tsplit[cpt].split("\\s+")[0] );
1158 14 kreverch
                                zfsList.add(Tsplit[cpt].split("\\s+")[0]);
1159 14 kreverch
                                //zpoolNames[ind] = Tsplit[cpt].split("\\s+")[0];
1160 14 kreverch
                        }
1161 14 kreverch
                }
1162 14 kreverch
                return zfsList;
1163 14 kreverch
        }
1164 14 kreverch
1165 14 kreverch
1166 14 kreverch
        public boolean addServer(){
1167 14 kreverch
1168 14 kreverch
                if (!"".equalsIgnoreCase(this.getZserver().zProperties.get("serverIP").getValue())) {
1169 14 kreverch
                        this.getZserver().add(System.getProperty("user.home")+prop.getProperty("serverConfDir")+this.getZserver().zProperties.get("serverIP").getValue()+".properties");
1170 14 kreverch
1171 14 kreverch
                }else{
1172 14 kreverch
                        return false;
1173 14 kreverch
                }
1174 14 kreverch
                return true;
1175 14 kreverch
        }
1176 14 kreverch
1177 14 kreverch
        public boolean removeServer(){
1178 14 kreverch
                if (!"".equalsIgnoreCase(this.getZserver().zProperties.get("serverIP").getValue())) {
1179 14 kreverch
                        this.getZserver().remove(System.getProperty("user.home")+prop.getProperty("serverConfDir")+this.getZserver().zProperties.get("serverIP").getValue()+".properties");
1180 14 kreverch
                        this.getCacheSession().remove(this.getZserver().zProperties.get("serverIP").getValue());
1181 14 kreverch
                }
1182 14 kreverch
                return false;
1183 14 kreverch
        }
1184 14 kreverch
1185 14 kreverch
        public List<Object> getListServer(){
1186 14 kreverch
                String dirName = System.getProperty("user.home")+prop.getProperty("serverConfDir");
1187 14 kreverch
                log.debug(System.getProperty("user.home")+prop.getProperty("serverConfDir"));
1188 14 kreverch
                File dir = new File(dirName);
1189 14 kreverch
                if ( !dir.exists()){
1190 14 kreverch
                        dir.mkdir();
1191 14 kreverch
                        log.debug((System.getProperty("user.home")+prop.getProperty("serverConfDir")));
1192 14 kreverch
                }
1193 14 kreverch
                log.debug((System.getProperty("user.home")+prop.getProperty("serverConfDir")));
1194 14 kreverch
                File f = new File(System.getProperty("user.home")+prop.getProperty("serverConfDir"));
1195 14 kreverch
                log.debug((System.getProperty("user.home")+prop.getProperty("serverConfDir")));
1196 14 kreverch
                File[] list = f.listFiles();
1197 14 kreverch
                List<Object> listServer = new ArrayList<Object>();
1198 14 kreverch
                for (int i=0;i<list.length;i++){
1199 14 kreverch
                        listServer.add(list[i].getName().split(".properties")[0]);
1200 14 kreverch
                }
1201 14 kreverch
                return listServer;
1202 14 kreverch
        }
1203 14 kreverch
1204 14 kreverch
        public void getServer(String serverName){
1205 14 kreverch
                this.getZserver().load(System.getProperty("user.home")+prop.getProperty("serverConfDir")+serverName+".properties");
1206 14 kreverch
                String[] keysProp = (String[]) this.getZserver().zProperties.keySet().toArray(new String[0]);
1207 14 kreverch
                Arrays.sort(keysProp);
1208 14 kreverch
                error.clear();
1209 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
1210 14 kreverch
                        String keyProp = keysProp[i];
1211 14 kreverch
                        if (prop.containsKey(keyProp)){
1212 14 kreverch
                                this.getZserver().zProperties.get(keyProp).setValue(prop.getProperty(keyProp));
1213 14 kreverch
                        }
1214 14 kreverch
1215 14 kreverch
                }
1216 14 kreverch
        }
1217 14 kreverch
1218 14 kreverch
        public void checkBinEnv(){
1219 14 kreverch
                String[] keysProp = (String[]) this.getZserver().zProperties.keySet().toArray(new String[0]);
1220 14 kreverch
                Arrays.sort(keysProp);
1221 14 kreverch
                error.clear();
1222 14 kreverch
                for ( int i=0;i<keysProp.length;i++){
1223 14 kreverch
                        String keyProp = keysProp[i];
1224 14 kreverch
                        if ( !keyProp.equalsIgnoreCase("serverIP") && !keyProp.equalsIgnoreCase("userLogin") && !keyProp.equalsIgnoreCase("userPasswd")&&!keyProp.equalsIgnoreCase("pathzfsvoldevice")){
1225 14 kreverch
                                if (  this.executeCmd(prop.getProperty(keyProp)) && ! outErr.toString().contains("No such file or directory")){
1226 14 kreverch
                                        log.debug(prop.getProperty(keyProp));
1227 14 kreverch
                                        log.debug("checkBinEnv "+outErr.toString().contains("No such file or directory"));
1228 14 kreverch
                                }else{
1229 14 kreverch
                                        error.put(keyProp, outErr.toString());
1230 14 kreverch
                                }
1231 14 kreverch
                        }
1232 14 kreverch
                }
1233 14 kreverch
        }
1234 14 kreverch
1235 14 kreverch
        public void loadConfig(){
1236 14 kreverch
1237 14 kreverch
                try {
1238 14 kreverch
                        InputStream resource = getClass().getResourceAsStream("config.properties");
1239 14 kreverch
1240 14 kreverch
                        prop.load(resource);
1241 14 kreverch
                        log.debug(prop);
1242 14 kreverch
                } catch (FileNotFoundException e) {
1243 14 kreverch
                        // TODO Auto-generated catch block
1244 14 kreverch
                        e.printStackTrace();
1245 14 kreverch
                } catch (IOException e) {
1246 14 kreverch
                        // TODO Auto-generated catch block
1247 14 kreverch
                        e.printStackTrace();
1248 14 kreverch
                }
1249 14 kreverch
        }
1250 14 kreverch
        public String getUserPassword() {
1251 14 kreverch
                return userPassword;
1252 14 kreverch
        }
1253 14 kreverch
1254 14 kreverch
1255 14 kreverch
1256 14 kreverch
        public void setUserPassword(String userPassword) {
1257 14 kreverch
                this.userPassword = userPassword;
1258 14 kreverch
        }
1259 14 kreverch
1260 14 kreverch
1261 14 kreverch
1262 14 kreverch
        public String getUserLogin() {
1263 14 kreverch
                return userLogin;
1264 14 kreverch
        }
1265 14 kreverch
1266 14 kreverch
1267 14 kreverch
1268 14 kreverch
        public void setUserLogin(String userLogin) {
1269 14 kreverch
                this.userLogin = userLogin;
1270 14 kreverch
        }
1271 14 kreverch
1272 14 kreverch
1273 14 kreverch
1274 14 kreverch
        public String getSshHost() {
1275 14 kreverch
                return sshHost;
1276 14 kreverch
        }
1277 14 kreverch
1278 14 kreverch
1279 14 kreverch
1280 14 kreverch
        public void setSshHost(String sshHost) {
1281 14 kreverch
                this.sshHost = sshHost;
1282 14 kreverch
        }
1283 14 kreverch
1284 14 kreverch
1285 14 kreverch
1286 14 kreverch
        public int getSshPort() {
1287 14 kreverch
                return sshPort;
1288 14 kreverch
        }
1289 14 kreverch
1290 14 kreverch
1291 14 kreverch
1292 14 kreverch
        public void setSshPort(int sshPort) {
1293 14 kreverch
                this.sshPort = sshPort;
1294 14 kreverch
        }
1295 14 kreverch
1296 14 kreverch
        public String getOutCmd() {
1297 14 kreverch
                return outCmd;
1298 14 kreverch
        }
1299 14 kreverch
1300 14 kreverch
        public void setOutCmd(String out) {
1301 14 kreverch
                this.outCmd=out;
1302 14 kreverch
        }
1303 14 kreverch
1304 14 kreverch
        public Session getSession() {
1305 14 kreverch
                return session;
1306 14 kreverch
        }
1307 14 kreverch
1308 14 kreverch
        public void setSession(Session session) {
1309 14 kreverch
                this.session = session;
1310 14 kreverch
        }
1311 14 kreverch
1312 14 kreverch
        /**
1313 14 kreverch
         * @return the zSnapshot
1314 14 kreverch
         */
1315 14 kreverch
        public zsnapshots getZsnapshots() {
1316 14 kreverch
                return zsnapshots;
1317 14 kreverch
        }
1318 14 kreverch
1319 14 kreverch
        /**
1320 14 kreverch
         * @param zSnapshot the zSnapshot to set
1321 14 kreverch
         */
1322 14 kreverch
        public void setZsnapshots() {
1323 14 kreverch
                this.zsnapshots = new zsnapshots();
1324 14 kreverch
        }
1325 14 kreverch
1326 14 kreverch
        public zreplicas getZreplicas() {
1327 14 kreverch
                return zreplicas;
1328 14 kreverch
        }
1329 14 kreverch
1330 14 kreverch
        public void setZreplicas() {
1331 14 kreverch
                this.zreplicas = new zreplicas();
1332 14 kreverch
        }
1333 14 kreverch
1334 14 kreverch
        /**
1335 14 kreverch
         * @return the ziscsi
1336 14 kreverch
         */
1337 14 kreverch
        public ziscsi getZiscsi() {
1338 14 kreverch
                return ziscsi;
1339 14 kreverch
        }
1340 14 kreverch
1341 14 kreverch
        /**
1342 14 kreverch
         * @param ziscsi the ziscsi to set
1343 14 kreverch
         */
1344 14 kreverch
        public void setZiscsi() {
1345 14 kreverch
                this.ziscsi = new ziscsi();
1346 14 kreverch
        }
1347 14 kreverch
1348 14 kreverch
        /**
1349 14 kreverch
         * @return the zserver
1350 14 kreverch
         */
1351 14 kreverch
        public zserver getZserver() {
1352 14 kreverch
                return zserver;
1353 14 kreverch
        }
1354 14 kreverch
1355 14 kreverch
        /**
1356 14 kreverch
         * @param zserver the zserver to set
1357 14 kreverch
         */
1358 14 kreverch
        public void setZserver() {
1359 14 kreverch
                this.zserver = new zserver();
1360 14 kreverch
        }
1361 14 kreverch
1362 14 kreverch
        /**
1363 14 kreverch
         * @return the cacheSession
1364 14 kreverch
         */
1365 14 kreverch
        public Hashtable<String,Session> getCacheSession() {
1366 14 kreverch
                return cacheSession;
1367 14 kreverch
        }
1368 14 kreverch
1369 14 kreverch
        /**
1370 14 kreverch
         * @param cacheSession the cacheSession to set
1371 14 kreverch
         */
1372 14 kreverch
        public void setCacheSession(Hashtable<String,Session> cacheSession) {
1373 14 kreverch
                this.cacheSession = cacheSession;
1374 14 kreverch
        }
1375 14 kreverch
1376 14 kreverch
        /**
1377 14 kreverch
         * @return the zpool
1378 14 kreverch
         */
1379 14 kreverch
        public zpool getZpool() {
1380 14 kreverch
                return zpool;
1381 14 kreverch
        }
1382 14 kreverch
1383 14 kreverch
        /**
1384 14 kreverch
         * @param zpool the zpool to set
1385 14 kreverch
         */
1386 14 kreverch
        public void setZpool() {
1387 14 kreverch
                this.zpool = new zpool();
1388 14 kreverch
        }
1389 14 kreverch
1390 14 kreverch
1391 14 kreverch
        public zdisk getZdisk() {
1392 14 kreverch
                return zdisk;
1393 14 kreverch
        }
1394 14 kreverch
1395 14 kreverch
        public void setZdisk() {
1396 14 kreverch
                this.zdisk = new zdisk();
1397 14 kreverch
        }
1398 14 kreverch
1399 14 kreverch
        /**
1400 14 kreverch
         * @return the error
1401 14 kreverch
         */
1402 14 kreverch
        public Hashtable<String,Object> getError() {
1403 14 kreverch
                return error;
1404 14 kreverch
        }
1405 14 kreverch
1406 14 kreverch
        /**
1407 14 kreverch
         * @param error the error to set
1408 14 kreverch
         */
1409 14 kreverch
        public void setError(Hashtable<String,Object> error) {
1410 14 kreverch
                this.error = error;
1411 14 kreverch
        }
1412 14 kreverch
1413 14 kreverch
        public Hashtable<String, zdisk> getHashDisks() {
1414 14 kreverch
                return hashDisks;
1415 14 kreverch
        }
1416 14 kreverch
1417 14 kreverch
        public void setHashDisks(Hashtable<String, zdisk> hashDisks) {
1418 14 kreverch
                this.hashDisks = hashDisks;
1419 14 kreverch
        }
1420 14 kreverch
1421 14 kreverch
        public zraid getZraid() {
1422 14 kreverch
                return zraid;
1423 14 kreverch
        }
1424 14 kreverch
1425 14 kreverch
        public void setZraid() {
1426 14 kreverch
                this.zraid = new zraid();
1427 14 kreverch
        }
1428 14 kreverch
1429 14 kreverch
1430 14 kreverch
1431 14 kreverch
        public Hashtable<String, zraid> getHashZRaid() {
1432 14 kreverch
                return hashZRaid;
1433 14 kreverch
        }
1434 14 kreverch
1435 14 kreverch
        public void setHashZRaid(Hashtable<String, zraid> hashZRaid) {
1436 14 kreverch
                this.hashZRaid = hashZRaid;
1437 14 kreverch
        }
1438 14 kreverch
1439 14 kreverch
}