X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/a238c1a16ee1162aa28919ea82d20b83a69c03c1..HEAD:/gui/rpc/zfs.inc diff --git a/gui/rpc/zfs.inc b/gui/rpc/zfs.inc index ead4ee5..22011e4 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,23 @@ 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); + foreach ($disks as $disk) { + OMVModuleZFSUtil::setGPTLabel($disk); + } + //Use /dev/disk/by-path as suggested in ZoL FAQ. + if ($params['diskpath']) { + try { + if (file_exists("/dev/disk/by-path/")) { + $tmp_disks = array(); + foreach ($disks as $disk) { + $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk); + } + $disks = $tmp_disks; + } + } catch (OMVModuleZFSException $e) { + //Do nothing if an excpetion is thrown } - $disks = $tmp_disks; } $vdev = new OMVModuleZFSVdev($params['name'], $pooltype, $disks); @@ -130,7 +140,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { "path":{"type":"string"}, "name":{"type":"string"}, "size":{"type":"string"}, - "clonename":{"type":"string"} + "clonename":{"type":"string"}, + "mountpoint":{"type":"string"} } }'); switch ($params['type']) { @@ -141,6 +152,10 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { case "filesystem": $name = $params['path'] . "/" . $params['name']; $tmp = new OMVModuleZFSDataset($name); + if (strlen($params['mountpoint']) > 0) { + $properties = array("mountpoint"=>$params['mountpoint']); + $tmp->setProperties($properties); + } break; case "snapshot": $name = $params['path'] . "@" . $params['name']; @@ -542,7 +557,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']); @@ -569,14 +585,23 @@ 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); + foreach ($disks as $disk) { + OMVModuleZFSUtil::setGPTLabel($disk); + } + //Use /dev/disk/by-path as suggested in ZoL FAQ. + if ($params['diskpath']) { + try { + if (file_exists("/dev/disk/by-path/")) { + $tmp_disks = array(); + foreach ($disks as $disk) { + $tmp_disks[] = OMVModuleZFSUtil::getDiskPath($disk); + } + $disks = $tmp_disks; + } + } catch (OMVModuleZFSException $e) { + //Do nothing if an exception is thrown } - $disks = $tmp_disks; } $vdev[] = new OMVModuleZFSVdev($params['name'], $pooltype, $disks); $pool->addVdev($vdev, $opts);