X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/81500319084173b0fd4e5533d741161f962eaa91..8a2223a43e8e699a92efe950117edd4179866335:/gui/rpc/zfs.inc diff --git a/gui/rpc/zfs.inc b/gui/rpc/zfs.inc index 6fe448d..c7fcb26 100644 --- a/gui/rpc/zfs.inc +++ b/gui/rpc/zfs.inc @@ -10,6 +10,7 @@ require_once("zfs/Utils.php"); require_once("zfs/Dataset.php"); require_once("zfs/Snapshot.php"); require_once("zfs/Zvol.php"); +require_once("zfs/Zpool.php"); class OMVRpcServiceZFS extends OMVRpcServiceAbstract { public function getName() { return "ZFS";} // RPC Service name. Same as in .js files @@ -48,19 +49,23 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { public function addObject($params, $context) { $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR)); switch ($params['type']) { - case "filesystem": + case "Filesystem": $name = $params['path'] . "/" . $params['name']; $tmp = new OMVModuleZFSDataset($name); break; - case "snapshot": + case "Snapshot": $name = $params['path'] . "@" . $params['name']; $tmp = new OMVModuleZFSSnapshot($name); break; - case "volume": + case "Volume": $name = $params['path'] . "/" . $params['name']; $tmp = new OMVModuleZFSZvol($name); $tmp->create($params['size']); break; + case "Pool": + $name = $params['path'] . "/" . $params['name']; + $tmp = new OMVModuleZFSZpool($name); + break; default: throw new OMVModuleZFSException("Illegal type provided: " . $params['type']); break; @@ -86,6 +91,11 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $tmp = new OMVModuleZFSZvol($name); $tmp->destroy(); break; + case "Pool": + $name = $params['name']; + $tmp = new OMVModuleZFSZpool($name); + $tmp->destroy(); + break; default: throw new OMVModuleZFSException("Illegal type provided: " . $params['type']); break; @@ -97,7 +107,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $objects = array(); $name = $params['name']; switch ($params['type']) { - case "Filesystem" || "Clone": + case "Filesystem": + case "Clone": $tmp = new OMVModuleZFSDataset($name); break; case "Snapshot": @@ -106,6 +117,9 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { case "Volume": $tmp = new OMVModuleZFSZvol($name); break; + case "Pool": + $tmp = new OMVModuleZFSZpool($name); + break; default: throw new OMVModuleZFSException("Illegal type provided: " . $params['type']); break; @@ -126,7 +140,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR)); $objects = array(); switch ($params['type']) { - case "Filesystem" || "Clone": + case "Filesystem": + case "Clone": $tmp = new OMVModuleZFSDataset($params['name']); break; case "Snapshot": @@ -135,6 +150,9 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { case "Volume": $tmp = new OMVModuleZFSZvol($params['name']); break; + case "Pool": + $tmp = new OMVModuleZFSZpool($params['name']); + break; default: throw new OMVModuleZFSException("Illegal type provided: " . $params['type']); break; @@ -159,7 +177,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $bgOutputFilename = $this->createBgProcOutput(); $this->updateBgProcStatus($bgStatusFilename, "outputfilename", $bgOutputFilename); switch ($params['type']) { - case "Filesystem" || "Clone": + case "Filesystem": + case "Clone": $tmp = new OMVModuleZFSDataset($params['name']); break; case "Snapshot": @@ -168,6 +187,9 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { case "Volume": $tmp = new OMVModuleZFSZvol($params['name']); break; + case "Pool": + $tmp = new OMVModuleZFSZpool($params['name']); + break; default: throw new OMVModuleZFSException("Illegal type provided: " . $params['type']); break; @@ -230,7 +252,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { // Prepare the configuration object. Use the name of the shared // folder as the relative directory name of the share. switch ($params['type']) { - case "Filesystem" || "Clone": + case "Filesystem": + case "Clone": $tmp = new OMVModuleZFSDataset($name); break; default: