]> git.datanom.net - omvzfs.git/blobdiff - src/Zpool.php
Removed some unused code.
[omvzfs.git] / src / Zpool.php
index 61220a616827887f3ff5e6fa110e9d53df49b0a1..87e5f0cb4637e88badb4eab36aa32e394e896469 100644 (file)
@@ -16,8 +16,7 @@ require_once("Exception.php");
  * @version   0.1
  * @copyright Michael Rasmussen <mir@datanom.net>
  */
-class OMVModuleZFSZpool extends OMVModuleAbstract
-               implements OMVINotifyListener {
+class OMVModuleZFSZpool extends OMVModuleAbstract {
     // Attributes
     /**
      * Name of pool
@@ -123,7 +122,7 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
      * @throws OMVModuleZFSException
         */
 
-       public function __construct($vdev) {
+       public function __construct($vdev, $opts = "") {
                $create_pool = true;
 
                if (is_array($vdev)) {
@@ -145,11 +144,11 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
                $this->cache = null;
                $this->features = array();
                if ($create_pool) {
-                       $cmd = "zpool create $name $cmd";
+                       $cmd = "zpool create $opts$name $cmd 2>&1";
 
                        OMVUtil::exec($cmd, $output, $result);
                        if ($result)
-                               throw new OMVModuleZFSException($output);
+                               throw new OMVModuleZFSException(implode("\n", $output));
                        else {
                                $this->name = $name;
                                $this->type = $type;
@@ -525,70 +524,6 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
                        throw new OMVModuleZFSException($output);
     }
 
-    public function bindListeners(OMVNotifyDispatcher $dispatcher) {
-               // Update service if configuration has been modified
-               $dispatcher->addListener(
-                 OMV_NOTIFY_MODIFY,
-                 "org.openmediavault.services.nfs",
-                 array($this, "onUpdateNFSService"));
-               $dispatcher->addListener(
-                 OMV_NOTIFY_CREATE,
-                 "org.openmediavault.services.nfs.shares.share",
-                 array($this, "onCreateNFSShare"));
-               $dispatcher->addListener(
-                 OMV_NOTIFY_DELETE,
-                 "org.openmediavault.services.nfs.shares.share",
-                 array($this, "onDeleteNFSShare"));
-               $dispatcher->addListener(
-                 OMV_NOTIFY_MODIFY,
-                 "org.openmediavault.services.nfs.shares.share",
-                 array($this, "onUpdateNFSShare"));
-    }
-
-       /**
-        * XXX
-        * org.openmediavault.services.nfs
-        *
-        * @param string event
-        * @access public
-        */
-       public function onUpdateNFSService($args) {
-        $this->debug(sprintf("onUpdateNFSService args=%s", var_export($args, true)));
-       }
-
-       /**
-        * XXX
-        * org.openmediavault.services.nfs.shares.share
-        *
-        * @param string event
-        * @access public
-        */
-       public function onCreateNFSShare($args) {
-        $this->debug(sprintf("onCreateNFSShare args=%s", var_export($args, true)));
-       }
-
-       /**
-        * XXX
-        * org.openmediavault.services.nfs.shares.share
-        *
-        * @param string event
-        * @access public
-        */
-       public function onDeleteNFSShare($args) {
-        $this->debug(sprintf("onDeleteNFSShare args=%s", var_export($args, true)));
-       }
-
-       /**
-        * XXX
-        * org.openmediavault.services.nfs.shares.share
-        *
-        * @param string event
-        * @access public
-        */
-       public function onUpdateNFSShare($args) {
-        $this->debug(sprintf("onUpdateNFSShare args=%s", var_export($args, true)));
-       }
-
        /**
         * Get a single property value associated with the Dataset
         *
@@ -701,7 +636,7 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
         * @param string $attribute
         * @return string value
         */
-       private function getAttribute($attribute) {
+       public function getAttribute($attribute) {
                $cmd = "zpool list -H -o $attribute {$this->name}";
                OMVUtil::exec($cmd, $output, $result);
                if ($result) {
@@ -818,7 +753,7 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
                                                                        $dev = null;
                                                                }
                                                                $type = $match[1];
-                                                       } else if (preg_match("/^\s*([\w\d-]+)\s+/", $line, $match)) {
+                                                       } else if (preg_match("/^\s*([\w\d-a-z0-9\:\.\-]+)\s+/", $line, $match)) {
                                                                if ($dev)
                                                                        $dev .= " $match[1]";
                                                                else
@@ -911,5 +846,4 @@ class OMVModuleZFSZpool extends OMVModuleAbstract
        }
 
 }
-
 ?>
This page took 0.196562 seconds and 5 git commands to generate.