From c08a9e590d1ca6fd5d3539f1a50832dc3a1a60ef Mon Sep 17 00:00:00 2001 From: Niclas Berglind Date: Tue, 14 Oct 2014 09:37:32 +0200 Subject: [PATCH] Made it optional to use /dev/disk/by-path Signed-off-by: Niclas Berglind --- .../omv/module/admin/storage/zfs/Overview.js | 16 +++++++++ gui/rpc/zfs.inc | 34 +++++++++++-------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/gui/js/omv/module/admin/storage/zfs/Overview.js b/gui/js/omv/module/admin/storage/zfs/Overview.js index 4acc897..7341205 100644 --- a/gui/js/omv/module/admin/storage/zfs/Overview.js +++ b/gui/js/omv/module/admin/storage/zfs/Overview.js @@ -177,6 +177,14 @@ Ext.define("OMV.module.admin.storage.zfs.AddPool", { ptype: "fieldinfo", text: _("Optional mountpoint for the pool. Default is to use pool name.") }] + },{ + xtype: "checkbox", + name: "diskpath", + fieldLabel: _("Disk-by-path"), + plugins: [{ + ptype: "fieldinfo", + text: _("Use /dev/disk/by-path when creating the pool. Recommended.") + }] },{ xtype: "checkbox", name: "force", @@ -527,6 +535,14 @@ Ext.define("OMV.module.admin.storage.zfs.ExpandPool", { flex: 1 }] } + },{ + xtype: "checkbox", + name: "diskpath", + fieldLabel: _("Disk-by-path"), + plugins: [{ + ptype: "fieldinfo", + text: _("Use /dev/disk/by-path when creating the vdev. Recommended.") + }] },{ xtype: "checkbox", name: "force", diff --git a/gui/rpc/zfs.inc b/gui/rpc/zfs.inc index 2b12b18..881372a 100644 --- a/gui/rpc/zfs.inc +++ b/gui/rpc/zfs.inc @@ -45,7 +45,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { "force":{"type":"boolean"}, "mountpoint":{"type":"string"}, "name":{"type":"string"}, - "devices":{"type":"string"} + "devices":{"type":"string"}, + "diskpath":{"type":"boolean"} } }'); switch ($params['pooltype']) { @@ -77,14 +78,16 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $opts .= "-m " . $params['mountpoint'] . " "; } - //Use /dev/disk/by-path as deafult when creating new pools as suggested in ZoL FAQ. $disks = preg_split("/[,;]/", $params['devices']); - if (file_exists("/dev/disk/by-path/")) { - $tmp_disks = array(); - foreach ($disks as $disk) { - $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($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); + } + $disks = $tmp_disks; } - $disks = $tmp_disks; } $vdev = new OMVModuleZFSVdev($params['name'], $pooltype, $disks); @@ -547,7 +550,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { '"raidz1","raidz2","raidz3"]}, "name":{"type":"string"}, "devices":{"type":"string"}, - "force":{"type":"boolean"} + "force":{"type":"boolean"}, + "diskpath":{"type":"boolean"} } }'); $pool = new OMVModuleZFSZpool($params['name']); @@ -574,14 +578,16 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { if ($params['force']) { $opts .= "-f "; } - //Use /dev/disk/by-path as deafult when creating new pools as suggested in ZoL FAQ. $disks = preg_split("/[,;]/", $params['devices']); - if (file_exists("/dev/disk/by-path/")) { - $tmp_disks = array(); - foreach ($disks as $disk) { - $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($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); + } + $disks = $tmp_disks; } - $disks = $tmp_disks; } $vdev[] = new OMVModuleZFSVdev($params['name'], $pooltype, $disks); $pool->addVdev($vdev, $opts); -- 2.39.2