]> git.datanom.net - omvzfs.git/blobdiff - src/Zpool.php
More info displayed for pools.
[omvzfs.git] / src / Zpool.php
index 41fd05267b89a1e4be1476b5bdaefc7c8ba1b307..56ec8c64d4426e98d239710d5e3d8b70448c24d5 100644 (file)
@@ -122,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)) {
@@ -144,7 +144,7 @@ class OMVModuleZFSZpool extends OMVModuleAbstract {
                $this->cache = null;
                $this->features = array();
                if ($create_pool) {
-                       $cmd = "zpool create $name $cmd 2>&1";
+                       $cmd = "zpool create $opts$name $cmd 2>&1";
 
                        OMVUtil::exec($cmd, $output, $result);
                        if ($result)
@@ -192,11 +192,11 @@ class OMVModuleZFSZpool extends OMVModuleAbstract {
      * @throws OMVModuleZFSException
      * @access public
      */
-    public function addVdev(array $vdevs) {
-               $cmd = "zpool add " . $this->name . " " . $this->getCommandString($vdevs);
+    public function addVdev(array $vdevs, $opts= "") {
+               $cmd = "zpool add " . $this->name . " " . $opts . $this->getCommandString($vdevs) . " 2>&1";
                OMVUtil::exec($cmd, $output, $result);
                if ($result)
-                       throw new OMVModuleZFSException($output);
+                       throw new OMVModuleZFSException(implode("\n", $output));
                else
                        $this->vdevs = array_merge($this->vdevs, $vdevs);
                $this->size = $this->getAttribute("size");
@@ -636,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) {
@@ -753,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
This page took 0.059959 seconds and 5 git commands to generate.