]> git.datanom.net - omvzfs.git/blame - gui/rpc/zfs.inc
Made it possible to force create Vdevs.
[omvzfs.git] / gui / rpc / zfs.inc
CommitLineData
6b3ce31b
MR
1<?php
2
3require_once("openmediavault/object.inc");
4require_once("openmediavault/config.inc");
5require_once("openmediavault/error.inc");
6require_once("openmediavault/util.inc");
7require_once("openmediavault/rpcservice.inc");
8require_once("openmediavault/notify.inc");
9require_once("zfs/Utils.php");
10require_once("zfs/Dataset.php");
11require_once("zfs/Snapshot.php");
12require_once("zfs/Zvol.php");
503ffcc8 13require_once("zfs/Zpool.php");
c0253592 14require_once("zfs/NotifyListener.php");
6b3ce31b
MR
15
16class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
a36352f7
NB
17 public function getName() {
18 return "ZFS"; // RPC Service name. Same as in .js files
19 }
6b3ce31b 20
a36352f7
NB
21 /* Initialize the RPC service. Different methods of the RPC service are declared here*/
22 public function initialize() {
42856e8b 23 $this->registerMethod("addPool");
a36352f7
NB
24 $this->registerMethod("getObjectTree");
25 $this->registermethod("passParam");
26 $this->registermethod("addObject");
27 $this->registermethod("deleteObject");
28 $this->registermethod("getProperties");
29 $this->registermethod("setProperties");
30 $this->registermethod("inherit");
31 $this->registermethod("getSharedParams");
32 $this->registermethod("createShare");
54b9d43e 33 $this->registermethod("getObjectDetails");
a6c3a4dd 34 $this->registermethod("expandPool");
a36352f7 35 }
6b3ce31b 36
42856e8b
NB
37 public function addPool($params, $context) {
38 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
39 // Validate the parameters of the RPC service method.
40 $this->validateMethodParams($params, '{
41 "type":"object",
42 "properties":{
43 "pooltype":{"type":"string","enum":["basic","mirror",' .
44 '"raidz1","raidz2","raidz3"]},
45 "force":{"type":"boolean"},
46 "mountpoint":{"type":"string"},
47 "name":{"type":"string"},
48 "devices":{"type":"string"}
49 }
50 }');
42856e8b
NB
51 switch ($params['pooltype']) {
52 case "basic":
53 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSPLAIN;
54 break;
55 case "mirror":
56 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSMIRROR;
57 break;
58 case "raidz1":
59 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ1;
60 break;
61 case "raidz2":
62 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ2;
63 break;
64 case "raidz3":
65 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ3;
66 break;
67 default:
68 throw new OMVModuleZFSException("Incorrect pool type specified");
69 break;
70 }
7d6b772c
NB
71 //Check for user supplied options
72 $opts = "";
73 if ($params['force']) {
74 $opts .= "-f ";
75 }
c6117b32
NB
76 if (strlen($params['mountpoint']) > 0) {
77 $opts .= "-m " . $params['mountpoint'] . " ";
78 }
79
e20fe312 80 //Use /dev/disk/by-path as deafult when creating new pools as suggested in ZoL FAQ.
42856e8b 81 $disks = preg_split("/[,;]/", $params['devices']);
e20fe312
NB
82 if (file_exists("/dev/disk/by-path/")) {
83 $tmp_disks = array();
84 foreach ($disks as $disk) {
85 $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
86 }
87 $disks = $tmp_disks;
88 }
89
42856e8b 90 $vdev = new OMVModuleZFSVdev($params['name'], $pooltype, $disks);
7d6b772c 91 $pool = new OMVModuleZFSZpool($vdev, $opts);
57667eb1
NB
92 //Ugly fix to solve the problem of blkid not displaying info on newly created pools
93 $pool->export();
94 $pool->import($pool->getName());
42856e8b
NB
95 }
96
6b3ce31b
MR
97 public function getObjectTree($params, $context) {
98 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
99 $objects = OMVModuleZFSUtil::getZFSFlatArray();
100 $new = array();
101 foreach ($objects as $a){
102 $new[$a['parentid']][] = $a;
103 }
104 $tree = OMVModuleZFSUtil::createTree($new, $new['root']);
a36352f7 105 OMVModuleZFSUtil::addMissingOMVMntEnt(); //Adds missing ZFS filesystems to the OMV core
6b3ce31b
MR
106 return $tree;
107 }
108
109 public function passParam($params, $context) {
110 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
111 // Validate the parameters of the RPC service method.
112 $this->validateMethodParams($params, '{
113 "type":"object",
114 "properties":{
115 "key":{"type":"string"},
116 "value":{"type":"string"}
117 }
118 }');
6b3ce31b
MR
119 return array($params['key'] => $params['value']);
120 }
121
122 public function addObject($params, $context) {
123 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
124 // Validate the parameters of the RPC service method.
125 $this->validateMethodParams($params, '{
126 "type":"object",
127 "properties":{
128 "type":{"type":"string","enum":["filesystem","snapshot",' .
129 '"volume"]},
130 "path":{"type":"string"},
131 "name":{"type":"string"},
132 "size":{"type":"string"}
133 }
134 }');
6b3ce31b 135 switch ($params['type']) {
57667eb1 136 case "filesystem":
6b3ce31b
MR
137 $name = $params['path'] . "/" . $params['name'];
138 $tmp = new OMVModuleZFSDataset($name);
139 break;
57667eb1 140 case "snapshot":
6b3ce31b
MR
141 $name = $params['path'] . "@" . $params['name'];
142 $tmp = new OMVModuleZFSSnapshot($name);
143 break;
57667eb1 144 case "volume":
6b3ce31b
MR
145 $name = $params['path'] . "/" . $params['name'];
146 $tmp = new OMVModuleZFSZvol($name);
147 $tmp->create($params['size']);
148 break;
149 default:
150 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
151 break;
152 }
153 }
154
155 public function deleteObject($params, $context) {
156 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
157 // Validate the parameters of the RPC service method.
158 $this->validateMethodParams($params, '{
159 "type":"object",
160 "properties":{
161 "type":{"type":"string","enum":["Filesystem","Snapshot",' .
162 '"Volume","Clone","Pool"]},
163 "name":{"type":"string"}
164 }
165 }');
97e4887b
NB
166 global $xmlConfig;
167 $name = $params['name'];
6b3ce31b 168 switch ($params['type']) {
81500319 169 case "Filesystem":
216661f4
NB
170 OMVModuleZFSUtil::deleteShares($name);
171 $tmp = new OMVModuleZFSDataset($name);
172 $tmp->destroy();
173 break;
81500319 174 case "Clone":
6b3ce31b
MR
175 $tmp = new OMVModuleZFSDataset($name);
176 $tmp->destroy();
177 break;
178 case "Snapshot":
6b3ce31b
MR
179 $tmp = new OMVModuleZFSSnapshot($name);
180 $tmp->destroy();
181 break;
182 case "Volume":
6b3ce31b
MR
183 $tmp = new OMVModuleZFSZvol($name);
184 $tmp->destroy();
185 break;
503ffcc8 186 case "Pool":
97e4887b
NB
187 $disks = OMVModuleZFSUtil::getDevDisksByPool($name);
188 $pooluuid = OMVModuleZFSUtil::getUUIDbyName($name);
503ffcc8
MR
189 $tmp = new OMVModuleZFSZpool($name);
190 $tmp->destroy();
97e4887b
NB
191 $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "' and type='zfs']";
192 $object = $xmlConfig->get($xpath);
193 $xmlConfig->delete($xpath);
97e4887b 194 OMVModuleZFSUtil::clearZFSLabel($disks);
503ffcc8 195 break;
6b3ce31b
MR
196 default:
197 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
198 break;
199 }
200 }
201
202 public function getProperties($params, $context) {
203 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
204 // Validate the parameters of the RPC service method.
205 $this->validateMethodParams($params, '{
206 "type":"object",
207 "properties":{
208 "type":{"type":"string"},
209 "name":{"type":"string"},
210 "start":{"type":"integer"},
211 "limit":{'.$GLOBALS['OMV_JSONSCHEMA_COUNTFIELD'].'},
212 "sortfield":{'.$GLOBALS['OMV_JSONSCHEMA_SORTFIELD'].'},
213 "sortdir":{'.$GLOBALS['OMV_JSONSCHEMA_SORTDIR'].'}
214 }
215 }');
6b3ce31b
MR
216 $objects = array();
217 $name = $params['name'];
218 switch ($params['type']) {
5ff626ba
MR
219 case "Filesystem":
220 case "Clone":
6b3ce31b
MR
221 $tmp = new OMVModuleZFSDataset($name);
222 break;
223 case "Snapshot":
224 $tmp = new OMVModuleZFSSnapshot($name);
225 break;
226 case "Volume":
227 $tmp = new OMVModuleZFSZvol($name);
228 break;
503ffcc8 229 case "Pool":
a36352f7
NB
230 $tmp = new OMVModuleZFSZpool($name);
231 break;
6b3ce31b
MR
232 default:
233 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
234 break;
235 }
236 $properties = $tmp->getProperties();
237 foreach ($properties as $propertyk => $propertyv) {
238 if (!(strcmp($propertyv['source'], "-") == 0)) {
239 $objects[] = array('property' => $propertyk,
240 'value' => $propertyv['value'],
241 'source' => $propertyv['source'],
242 'modified' => "false");
243 }
244 }
245 return $objects;
246 }
247
248 public function setProperties($params, $context) {
249 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
250 // Validate the parameters of the RPC service method.
251 $this->validateMethodParams($params, '{
252 "type":"object",
253 "properties":{
254 "type":{"type":"string","enum":["Filesystem","Snapshot",' .
255 '"Volume","Clone","Pool"]},
256 "name":{"type":"string"},
257 "properties":{"type":"array","items":{
258 "type":"object",
259 "properties":{
260 "property":{"type":"string"},
261 "value":{"type":"string"}}}}
262 }
263 }');
cc1caa78 264 global $xmlConfig;
6b3ce31b 265 switch ($params['type']) {
5ff626ba
MR
266 case "Filesystem":
267 case "Clone":
6b3ce31b
MR
268 $tmp = new OMVModuleZFSDataset($params['name']);
269 break;
270 case "Snapshot":
271 $tmp = new OMVModuleZFSSnapshot($params['name']);
272 break;
273 case "Volume":
274 $tmp = new OMVModuleZFSZvol($params['name']);
275 break;
503ffcc8
MR
276 case "Pool":
277 $tmp = new OMVModuleZFSZpool($params['name']);
278 break;
6b3ce31b
MR
279 default:
280 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
281 break;
81500319 282 }
6b3ce31b 283 foreach ($params['properties'] as $property) {
cc1caa78
NB
284 unset($objects);
285 $objects = array();
6b3ce31b 286 $objects[$property['property']] = $property['value'];
cc1caa78
NB
287 $tmp->setProperties($objects);
288 if ((strcmp($property['property'], "mountpoint") === 0) && (strcmp($params['type'], "Filesystem") === 0)) {
289 OMVModuleZFSUtil::relocateFilesystem($params['name']);
290 }
6b3ce31b 291 }
6b3ce31b
MR
292 }
293
294 public function inherit($params, $context) {
295 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
296 // Validate the parameters of the RPC service method.
297 $this->validateMethodParams($params, '{
298 "type":"object",
299 "properties":{
300 "type":{"type":"string","enum":["Filesystem","Snapshot",' .
301 '"Volume","Clone","Pool"]},
302 "name":{"type":"string"},
303 "property":{"type":"string"}
304 }
305 }');
6b3ce31b
MR
306 // Create a background process.
307 $bgStatusFilename = $this->createBgProcStatus();
308 $pid = $this->fork();
309 if($pid > 0) { // Parent process.
310 $this->initializeBgProcStatus($bgStatusFilename, $pid);
311 return $bgStatusFilename;
312 }
313 // Child process.
314 try {
315 $bgOutputFilename = $this->createBgProcOutput();
316 $this->updateBgProcStatus($bgStatusFilename, "outputfilename", $bgOutputFilename);
317 switch ($params['type']) {
5ff626ba
MR
318 case "Filesystem":
319 case "Clone":
6b3ce31b
MR
320 $tmp = new OMVModuleZFSDataset($params['name']);
321 break;
322 case "Snapshot":
323 $tmp = new OMVModuleZFSSnapshot($params['name']);
324 break;
325 case "Volume":
326 $tmp = new OMVModuleZFSZvol($params['name']);
327 break;
503ffcc8
MR
328 case "Pool":
329 $tmp = new OMVModuleZFSZpool($params['name']);
330 break;
6b3ce31b
MR
331 default:
332 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
333 break;
334 }
335 $tmp->inherit($params['property']);
336 $this->finalizeBgProcStatus($bgStatusFilename, $output);
337 exit(0);
338 } catch(Exception $e) {
339 $this->finalizeBgProcStatus($bgStatusFilename, "", $e);
340 exit(1);
341 }
342 }
343
344 public function getSharedParams($params, $context) {
345 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
346 // Validate the parameters of the RPC service method.
347 $this->validateMethodParams($params, '{
348 "type":"object",
349 "properties":{
350 "type":{"type":"string"},
351 "name":{"type":"string"}
352 }
353 }');
6b3ce31b 354 $objects = array();
cc1caa78
NB
355 //$ds = new OMVModuleZFSDataset($params['name']);
356 //$mountpoint = $ds->getMountPoint();
6b3ce31b 357 return array(
cc1caa78 358 //"mountpoint" => $mountpoint,
6b3ce31b
MR
359 "name" => $params['name'],
360 "type" => $params['type']);
361 }
362
363 public function createShare($params, $context) {
364 global $xmlConfig;
365 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
ecee099b
NB
366 // Validate the parameters of the RPC service method.
367 $this->validateMethodParams($params, '{
368 "type":"object",
369 "properties":{
370 "name":{"type":"string"},
371 "type":{"type":"string","enum":["Filesystem","Clone"]},
372 "sharename":{'.$GLOBALS['OMV_JSONSCHEMA_SHARENAME'].'},
373 "comment":{"type":"string"},
374 "mode":{"type":"string","enum":["700","750","755",'.
375 '"770","775","777"],"optional":true},
376 "mountpoint":{"type":"string"}
377 }
378 }');
cc1caa78
NB
379
380 // The field 'reldirpath' may not contain the characters '..'. This
381 // is because of security reasons: the given canonicalized absolute
382 // path MUST be below the given mount point.
383 if(1 == preg_match("/\.\./", $params['mountpoint'])) {
384 throw new OMVException(OMVErrorMsg::E_RPC_SERVICE_METHOD_INVALID_PARAMS,
385 sprintf(gettext("The field '%s' contains forbidden two-dot symbols"), "mountpoint"));
386 }
387
6b3ce31b
MR
388 // Prepare the configuration object. Use the name of the shared
389 // folder as the relative directory name of the share.
390 switch ($params['type']) {
5ff626ba 391 case "Filesystem":
a36352f7
NB
392 $tmp = new OMVModuleZFSDataset($params['name']);
393 break;
5ff626ba 394 case "Clone":
a36352f7 395 $tmp = new OMVModuleZFSDataset($params['name']);
6b3ce31b
MR
396 break;
397 default:
398 throw new OMVModuleZFSException("Illegal type provided: " . $params['type']);
399 break;
400 }
401
cc1caa78
NB
402 $poolname = OMVModuleZFSUtil::getPoolname($params['name']);
403 $pooluuid = OMVModuleZFSUtil::getUUIDbyName($poolname);
404 $dir = $tmp->getMountPoint();
405
406 //Get the mntent object and fetch it's uuid.
407 $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "' and dir='" . $dir . "' and type='zfs']";
408 $mountpoint = $xmlConfig->get($xpath);
409 $mntentref = $mountpoint['uuid'];
410
6b3ce31b 411 $uuid = OMVUtil::uuid();
cc1caa78
NB
412 $pathName = $dir . "/" . trim($params['mountpoint'], "/");
413 $reldirpath = trim($params['mountpoint'], "/");
6b3ce31b
MR
414 $object = array(
415 "uuid" => $uuid,
416 "name" => $params['sharename'],
cc1caa78 417 "comment" => $params['comment'] . "*** ZFS share on " . $params['name'] . " ***",
6b3ce31b
MR
418 "mntentref" => $mntentref,
419 "reldirpath" => $reldirpath
420 );
421
422 // Set the configuration object.
423 $success = FALSE;
424 // Check uniqueness. The share name must be global unique because
425 // the name is also used when exporting a shared folder via NFS for
426 // example.
427 $xpath = sprintf("//system/shares/sharedfolder[name='%s']",
428 $params['name']);
429 if(TRUE === $xmlConfig->exists($xpath)) {
430 throw new OMVException(OMVErrorMsg::E_CONFIG_OBJECT_UNIQUENESS,
431 gettext("A shared folder with the given name already exists"));
432 }
433
434 // Add empty list of privileges per default.
435 $object['privileges'] = array();
436
437 // Append object to configuration.
438 $success = $xmlConfig->set("//system/shares",
439 array("sharedfolder" => $object));
440 if(FALSE === $success) {
441 throw new OMVException(OMVErrorMsg::E_CONFIG_SET_OBJECT_FAILED);
442 }
443
444 // Append the file mode field to the notification object if set.
445 // Defaults to 775.
446 $object['mode'] = "775";
447 if(array_key_exists("mode", $params)) {
448 $object['mode'] = $params['mode'];
449 }
450
cc1caa78
NB
451 // Create the shared folder directory if necessary.
452 if(FALSE === file_exists($pathName)) {
453 // Create the directory. Note, the function seems to have a bug
454 // when using the mask parameter. E.g. octdec("777") does not
455 // create the correct permissions as expected, thus change the
456 // mode using chmod.
457 if(FALSE === mkdir($pathName, 0700, TRUE)) {
458 throw new OMVException(OMVErrorMsg::E_MISC_FAILURE,
459 sprintf("Failed to create the directory '%s'", $pathName));
460 }
461 // Change the directory mode.
462 if(FALSE === chmod($pathName, octdec($object['mode']))) {
463 throw new OMVException(OMVErrorMsg::E_MISC_FAILURE,
464 sprintf("Failed to set file mode to '%s' for '%s'",
465 $object['mode'], $pathName));
466 }
467 }
468
6b3ce31b
MR
469 // Change group owner of directory to configured default group,
470 // e.g. 'users'.
471 if(FALSE === chgrp($pathName, $GLOBALS['OMV_USERMGMT_DEFAULT_GROUP'])) {
472 throw new OMVException(OMVErrorMsg::E_MISC_FAILURE,
473 sprintf("Failed to set file group to '%s' for '%s'",
474 $GLOBALS['OMV_USERMGMT_DEFAULT_GROUP'], $pathName));
475 }
476
477 // Set the setgid bit. Setting this permission means that all files
478 // created in the folder will inherit the group of the folder rather
479 // than the primary group of the user who creates the file.
480 $mode = fileperms($pathName) | 02000;
481 if(FALSE === chmod($pathName, $mode)) {
482 throw new OMVException(OMVErrorMsg::E_MISC_FAILURE,
483 sprintf("Failed to set file mode to '%o' for '%s'",
484 $mode, $pathName));
485 }
486
487 // Notify configuration changes.
488 $dispatcher = &OMVNotifyDispatcher::getInstance();
489 $dispatcher->notify(OMV_NOTIFY_CREATE,"org.openmediavault.system.shares.sharedfolder", $object);
490 // Return the configuration object.
491 return $object;
6b3ce31b
MR
492 }
493
54b9d43e
NB
494 public function getObjectDetails($params, $context) {
495 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
496 // Validate the parameters of the RPC service method.
497 $this->validateMethodParams($params, '{
498 "type":"object",
499 "properties":{
500 "name":{"type":"string"},
501 "type":{"type":"string"}
502 }
503 }');
504 $output = "";
505 switch ($params['type']) {
506 case "Filesystem":
507 $output .= "Filesystem details (zfs get all):\n\r\n\r";
508 $cmd = "zfs get all {$params['name']}";
509 break;
510 case "Volume":
511 $output .= "Volume details (zfs get all):\n\r\n\r";
512 $cmd = "zfs get all {$params['name']}";
513 break;
514 case "Snapshot":
515 $output .= "Snapshot details (zfs get all):\n\r\n\r";
516 $cmd = "zfs get all {$params['name']}";
517 break;
518 case "Pool":
519 $output .= "Pool details (zpool get all):\n\r\n\r";
520 $cmd = "zpool get all {$params['name']}";
521 break;
522 default:
523 throw new OMVModuleZFSException("Incorrect type provided");
524 }
525 OMVModuleZFSUtil::exec($cmd,$out,$res);
526 $output .= implode("\n\r", $out);
527 return array("details" => $output);
528 }
a6c3a4dd
NB
529
530 public function expandPool($params, $context) {
531 $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
532 // Validate the parameters of the RPC service method.
533 $this->validateMethodParams($params, '{
534 "type":"object",
535 "properties":{
77a007e0
NB
536 "vdevtype":{"type":"string","enum":["basic","mirror",' .
537 '"raidz1","raidz2","raidz3"]},
a6c3a4dd 538 "name":{"type":"string"},
47e63d33
NB
539 "devices":{"type":"string"},
540 "force":{"type":"boolean"}
a6c3a4dd
NB
541 }
542 }');
543 $pool = new OMVModuleZFSZpool($params['name']);
77a007e0
NB
544 switch ($params['vdevtype']) {
545 case "basic":
a6c3a4dd
NB
546 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSPLAIN;
547 break;
77a007e0 548 case "mirror":
a6c3a4dd
NB
549 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSMIRROR;
550 break;
77a007e0 551 case "raidz1":
a6c3a4dd
NB
552 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ1;
553 break;
77a007e0 554 case "raidz2":
a6c3a4dd
NB
555 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ2;
556 break;
77a007e0 557 case "raidz3":
a6c3a4dd
NB
558 $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ3;
559 break;
560 default:
561 throw new OMVModuleZFSException("Incorrect pool type specified");
562 break;
563 }
47e63d33
NB
564 if ($params['force']) {
565 $opts .= "-f ";
566 }
a6c3a4dd
NB
567 //Use /dev/disk/by-path as deafult when creating new pools as suggested in ZoL FAQ.
568 $disks = preg_split("/[,;]/", $params['devices']);
569 if (file_exists("/dev/disk/by-path/")) {
570 $tmp_disks = array();
571 foreach ($disks as $disk) {
572 $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
573 }
574 $disks = $tmp_disks;
575 }
576 $vdev[] = new OMVModuleZFSVdev($params['name'], $pooltype, $disks);
47e63d33 577 $pool->addVdev($vdev, $opts);
a6c3a4dd
NB
578 //Ugly fix to solve the problem of blkid not displaying info on newly created pools
579 $pool->export();
580 $pool->import($pool->getName());
581 }
6b3ce31b
MR
582}
583
584// Register the RPC service.
81500319 585$rpcServiceMgr = &OMVRpcServiceMgr::getInstance(); // Get the "root" instance for the Services
6b3ce31b
MR
586$rpcServiceMgr->registerService(new OMVRpcServiceZFS()); // Register a new instance of the RPC service described above
587?>
588
This page took 0.130502 seconds and 5 git commands to generate.