]> git.datanom.net - omvzfs.git/blobdiff - gui/rpc/zfs.inc
Added try/catch when using /dev/disk/by-path
[omvzfs.git] / gui / rpc / zfs.inc
index 881372aebb6fbbe1578c3cee7dbb08a65db79a17..9ab61a2e7c8d60e844cd6bc2de8fa31374a7c971 100644 (file)
@@ -81,12 +81,16 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                $disks = preg_split("/[,;]/", $params['devices']);
                //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
                        }
                }
 
@@ -581,12 +585,16 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                $disks = preg_split("/[,;]/", $params['devices']);
                //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.053977 seconds and 5 git commands to generate.