X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/d5f2a5099bed3fbe461aadeb763978b22c5ae383..54b9d43e43e2d6ab2212ba9abbac04290de925e0:/gui/rpc/zfs.inc diff --git a/gui/rpc/zfs.inc b/gui/rpc/zfs.inc index 3a98d58..7a6b364 100644 --- a/gui/rpc/zfs.inc +++ b/gui/rpc/zfs.inc @@ -30,6 +30,7 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { $this->registermethod("inherit"); $this->registermethod("getSharedParams"); $this->registermethod("createShare"); + $this->registermethod("getObjectDetails"); } public function addPool($params, $context) { @@ -460,6 +461,41 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { return $object; } + public function getObjectDetails($params, $context) { + $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR)); + // Validate the parameters of the RPC service method. + $this->validateMethodParams($params, '{ + "type":"object", + "properties":{ + "name":{"type":"string"}, + "type":{"type":"string"} + } + }'); + $output = ""; + switch ($params['type']) { + case "Filesystem": + $output .= "Filesystem details (zfs get all):\n\r\n\r"; + $cmd = "zfs get all {$params['name']}"; + break; + case "Volume": + $output .= "Volume details (zfs get all):\n\r\n\r"; + $cmd = "zfs get all {$params['name']}"; + break; + case "Snapshot": + $output .= "Snapshot details (zfs get all):\n\r\n\r"; + $cmd = "zfs get all {$params['name']}"; + break; + case "Pool": + $output .= "Pool details (zpool get all):\n\r\n\r"; + $cmd = "zpool get all {$params['name']}"; + break; + default: + throw new OMVModuleZFSException("Incorrect type provided"); + } + OMVModuleZFSUtil::exec($cmd,$out,$res); + $output .= implode("\n\r", $out); + return array("details" => $output); + } } // Register the RPC service.