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

index 9ace6cfd494c114fd36cbe93ea79a33ddb3e4738..9be6f5e2e869c7cedc95d2a3296cf86d2f015c4f 100644 (file)
@@ -160,7 +160,7 @@ class OMVModuleZFSZvol {
         */
        public function create($size, array $properties = null, $sparse = null) {
                $cmd = "zfs create -p ";
-               if (isset($sparse) && $sparse == true) {
+               if ((isset($sparse)) && ($sparse == true)) {
                        $cmd .= "-s ";
                }       
                $cmd .= "-V " . $size . " " . $this->name . " 2>&1";
@@ -181,6 +181,19 @@ class OMVModuleZFSZvol {
                $this->exec($cmd,$out,$res);
        }
 
+       /**
+        * Renames a Zvol
+        * 
+        * @param string $newname New name of the Dataset
+        * @return void
+        * @access public
+        */
+       public function rename($newname) {
+               $cmd = "zfs rename -p " . $this->name . " " . $newname . " 2>&1";
+               $this->exec($cmd,$out,$res);
+               $this->name = $newname;
+       }
+
        /**
         * Clears a previously set proporty and specifies that it should be
         * inherited from it's parent.
This page took 0.031319 seconds and 5 git commands to generate.