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

index 82569d433531965ce6f6b377c0c15e5cf30c8362..496e360feda5e1712c152e5b2c0f9f06e1fe6c4a 100644 (file)
@@ -23,7 +23,7 @@ class OMVModuleZFSZvol {
        /**
         * Size of Zvol
         *
-        * @var int $size
+        * @var string $size
         * @access private
         */
        private $size;
@@ -95,24 +95,28 @@ class OMVModuleZFSZvol {
        }
 
        /**
-        * XXX
+        * Get the total size of the Zvol
         *
-        * @return int XXX
+        * @return string $size
         * @access public
         */
        public function getSize() {
-               trigger_error('Not Implemented!', E_USER_WARNING);
+               return $this->size;
        }
 
        /**
-        * XXX
-        *
-        * @param   $list<Feature> XXX
-        * @return void XXX
+        * Sets a number of Zvol properties. If a property is already set it will be updated with the new value.
+        * 
+        * @param  array $properties An associative array with properties to set
+        * @return void
         * @access public
         */
        public function setProperties($properties) {
-               trigger_error('Not Implemented!', E_USER_WARNING);
+               foreach ($properties as $newpropertyk => $newpropertyv) {
+                       $cmd = "zfs set " . $newpropertyk . "=" . $newpropertyv . " " . $this->name;
+                       $this->exec($cmd,$out,$res);
+                       $this->updateProperty($newpropertyk);
+               }
        }
 
        /**
@@ -135,11 +139,12 @@ class OMVModuleZFSZvol {
         * Create a Zvol on commandline. Optionally provide a number of properties to set.
         * 
         * @param string $size Size of the Zvol that should be created
-        * @param array $properties Properties to set when creating the dataset.
+        * @param array $properties Properties to set when creatiing the dataset.
+        * @param boolean $sparse Defines if a sparse volume should be created.
         * @return void
         * @access public
         */
-       public function create($size, array $properties = null, bool $sparse = null) {
+       public function create($size, array $properties = null, $sparse = null) {
                $cmd = "zfs create -p ";
                if (isset($sparse) && $sparse == true) {
                        $cmd .= "-s ";
This page took 0.032845 seconds and 5 git commands to generate.