]> git.datanom.net - omvzfs.git/blobdiff - gui/rpc/zfs.inc
Create GPT label before creating/expanding pools.
[omvzfs.git] / gui / rpc / zfs.inc
index 881372aebb6fbbe1578c3cee7dbb08a65db79a17..22011e4ada941ab42311e14d103a9e052cff146a 100644 (file)
@@ -79,14 +79,21 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                }
 
                $disks = preg_split("/[,;]/", $params['devices']);
+               foreach ($disks as $disk) {
+                       OMVModuleZFSUtil::setGPTLabel($disk);
+               }
                //Use /dev/disk/by-path as suggested in ZoL FAQ.
                if ($params['diskpath']) {
-                       if (file_exists("/dev/disk/by-path/")) {
-                               $tmp_disks = array();
-                               foreach ($disks as $disk) {
-                                       $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
+                       try {
+                               if (file_exists("/dev/disk/by-path/")) {
+                                       $tmp_disks = array();
+                                       foreach ($disks as $disk) {
+                                               $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
+                                       }
+                                       $disks = $tmp_disks;
                                }
-                               $disks = $tmp_disks;
+                       } catch (OMVModuleZFSException $e) {
+                               //Do nothing if an excpetion is thrown
                        }
                }
 
@@ -579,14 +586,21 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                        $opts .= "-f ";
                }
                $disks = preg_split("/[,;]/", $params['devices']);
+               foreach ($disks as $disk) {
+                       OMVModuleZFSUtil::setGPTLabel($disk);
+               }
                //Use /dev/disk/by-path as suggested in ZoL FAQ.
                if ($params['diskpath']) {
-                       if (file_exists("/dev/disk/by-path/")) {
-                               $tmp_disks = array();
-                               foreach ($disks as $disk) {
-                                       $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
+                       try {
+                               if (file_exists("/dev/disk/by-path/")) {
+                                       $tmp_disks = array();
+                                       foreach ($disks as $disk) {
+                                               $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk);
+                                       }
+                                       $disks = $tmp_disks;
                                }
-                               $disks = $tmp_disks;
+                       } catch (OMVModuleZFSException $e) {
+                               //Do nothing if an exception is thrown
                        }
                }
                $vdev[] = new OMVModuleZFSVdev($params['name'], $pooltype, $disks);
This page took 0.030669 seconds and 5 git commands to generate.