]> git.datanom.net - omvzfs.git/blobdiff - src/Dataset.php
Added inherit method to Dataset
[omvzfs.git] / src / Dataset.php
index f3d81fa5779fe39f66866d9ea0159f1ecfbcc50b..2ba1bede28e5f4af83fd2077eeb1c2632e243d38 100644 (file)
@@ -46,7 +46,7 @@ class OMVModuleZFSDataset {
         *
         */
        public function __construct($name, array $properties = null) {
-               $cmd = "zfs create " . $name . " 2>&1";
+               $cmd = "zfs create -p " . $name . " 2>&1";
                OMVUtil::exec($cmd,$out,$res);
                if ($res) {
                        throw new OMVModuleZFSException(implode("\n", $out));
@@ -121,6 +121,7 @@ class OMVModuleZFSDataset {
        /**
         * Get all Dataset properties from commandline and update object properties attribute
         *
+        * @return void
         * @throws OMVModuleZFSException
         * @access private
         */ 
@@ -141,6 +142,7 @@ class OMVModuleZFSDataset {
         * Get single Datset property from commandline and update object property attribute
         *
         * @param string $property Name of the property to update
+        * @return void
         * @throws OMVModuleZFSException
         * @access private
         */
@@ -157,6 +159,7 @@ class OMVModuleZFSDataset {
        /**
         * Destroy the Dataset.
         *
+        * @return void
         * @throws OMVModuleZFSException
         * @access public
         */
@@ -168,6 +171,41 @@ class OMVModuleZFSDataset {
                }
        }
 
+       /**
+        * Renames a Dataset
+        *
+        * @param string $newname New name of the Dataset
+        * @return void
+        * @throws OMVModuleZFSException
+        * @access public
+        */
+       public function rename($newname) {
+               $cmd = "zfs rename -p " . $this->name . " " . $newname . " 2>&1";
+               OMVUtil::exec($cmd,$out,$res);
+               if ($res) {
+                       throw new OMVModuleZFSException(implode("\n", $out));
+               }
+               $this->name = $newname;
+       }
+
+       /**
+        * 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
+        * @throws OMVModuleZFSException
+        * @access public
+        */
+       public function inherit($property) {
+               $cmd = "zfs inherit " . $property . " " . $this->name . " 2>&1";
+               OMVUtil::exec($cmd,$out,$res);
+               if ($res) {
+                       throw new OMVModuleZFSException(implode("\n", $out));
+               }
+               $this->updateProperty($property);
+       }
+
 }
 
 ?>
This page took 0.032034 seconds and 5 git commands to generate.