]> git.datanom.net - omvzfs.git/blobdiff - gui/rpc/zfs.inc
Add debian build tree
[omvzfs.git] / gui / rpc / zfs.inc
index bdf8c442179a009004486963d9703ef306d02454..c7fcb264d3e0088bed6aede3a93c9ea29fdda87f 100644 (file)
@@ -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;
@@ -70,7 +75,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
        public function deleteObject($params, $context) {
                $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
                switch ($params['type']) {
-               case "Filesystem" || "Clone":
+               case "Filesystem":
+               case "Clone":
                        $name = $params['name'];
                        $tmp = new OMVModuleZFSDataset($name);
                        $tmp->destroy();
@@ -85,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;
@@ -96,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":
@@ -105,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;
@@ -125,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":
@@ -134,10 +150,13 @@ 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;
-               }       
+               }
                foreach ($params['properties'] as $property) {
                        $objects[$property['property']] = $property['value'];
                }
@@ -158,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":
@@ -167,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;
@@ -229,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:
@@ -239,7 +263,7 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
 
                $uuid = OMVUtil::uuid();
                $pathName = $tmp->getMountPoint();
-               $subdirs = preg_split('/\//',$pathName);        
+               $subdirs = preg_split('/\//',$pathName);
                $reldirpath = $subdirs[count($subdirs)-1];
                $object = array(
                        "uuid" => $uuid,
@@ -307,7 +331,7 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
 }
 
 // Register the RPC service.
-$rpcServiceMgr = &OMVRpcServiceMgr::getInstance(); // Get the "root" instance for the Services 
+$rpcServiceMgr = &OMVRpcServiceMgr::getInstance(); // Get the "root" instance for the Services
 $rpcServiceMgr->registerService(new OMVRpcServiceZFS()); // Register a new instance of the RPC service described above
 ?>
 
This page took 0.071083 seconds and 5 git commands to generate.