]> git.datanom.net - omvzfs.git/commitdiff
Added try/catch when using /dev/disk/by-path
authorNiclas Berglind <nb@kjam.se>
Tue, 14 Oct 2014 20:25:18 +0000 (22:25 +0200)
committerMichael Rasmussen <mir@datanom.net>
Tue, 14 Oct 2014 20:47:19 +0000 (22:47 +0200)
Signed-off-by: Niclas Berglind <nb@kjam.se>
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.032745 seconds and 5 git commands to generate.