]> git.datanom.net - omvzfs.git/commitdiff
Added inherit method together with support method to Zvol class.
authorNiclas Berglind <nb@kjam.se>
Wed, 12 Mar 2014 19:46:46 +0000 (20:46 +0100)
committerMichael Rasmussen <mir@datanom.net>
Wed, 12 Mar 2014 22:51:05 +0000 (23:51 +0100)
Signed-off-by: Niclas Berglind <nb@kjam.se>
src/Zvol.php

index c6fd20d5037364e976317fd7a8ad41a0bd205482..9ace6cfd494c114fd36cbe93ea79a33ddb3e4738 100644 (file)
@@ -135,6 +135,20 @@ class OMVModuleZFSZvol {
                }
        }
 
+       /**
+        * Get single Datset property from commandline and update object property attribute
+        * 
+        * @param string $property Name of the property to update
+        * @return void
+        * @access private
+        */
+       private function updateProperty($property) {
+               $cmd = "zfs get -H " . $property . " " . $this->name;
+               $this->exec($cmd,$out,$res);
+               $tmpary = preg_split('/\t+/', $out[0]);
+               $this->properties["$tmpary[1]"] = array("value" => $tmpary[2], "source" => $tmpary[3]);
+       }
+
        /**
         * Create a Zvol on commandline. Optionally provide a number of properties to set.
         * 
@@ -167,6 +181,20 @@ class OMVModuleZFSZvol {
                $this->exec($cmd,$out,$res);
        }
 
+       /**
+        * Clears a previously set proporty and specifies that it should be
+        * inherited from it's parent.
+        * 
+        * @param string $property Name of the property to inherit.
+        * @return void
+        * @access public
+        */
+       public function inherit($property) {
+               $cmd = "zfs inherit " . $property . " " . $this->name . " 2>&1";
+               $this->exec($cmd,$out,$res);
+               $this->updateProperty($property);
+       }
+
        /**
         * Helper function to execute a command and throw an exception on error
         * (requires stderr redirected to stdout for proper exception message).
This page took 0.032723 seconds and 5 git commands to generate.