]> git.datanom.net - omvzfs.git/commitdiff
Started work on Zvol class.
authorNiclas Berglind <nb@kjam.se>
Wed, 12 Mar 2014 19:34:16 +0000 (20:34 +0100)
committerMichael Rasmussen <mir@datanom.net>
Wed, 12 Mar 2014 22:50:18 +0000 (23:50 +0100)
Signed-off-by: Niclas Berglind <nb@kjam.se>
src/Zvol.php

index 286d6abf4f3e9710a67c1e10fcf368beaf3c2563..5c07ebb427d1ba9cc920c43f4d8a78b4bc35e4a7 100644 (file)
  * @copyright XXX
  */
 class OMVModuleZFSZvol {
-    // Attributes
-    /**
-     * XXX
-     *
-     * @var    string $name
-     * @access private
-     */
-    private $_name;
+       // Attributes
+       
+       /**
+        * Name of Zvol
+        *
+        * @var string $name
+        * @access private
+        */
+       private $name;
 
-    /**
-     * XXX
-     *
-     * @var    int $size
-     * @access private
-     */
-    private $_size;
+       /**
+        * Size of Zvol
+        *
+        * @var int $size
+        * @access private
+        */
+       private $size;
 
-    /**
-     * XXX
-     *
-     * @var    string $mountPoint
-     * @access private
-     */
-    private $_mountPoint;
+       /**
+        * Mountpoint of the Zvol
+        *
+        * @var    string $mountPoint
+        * @access private
+        */
+       private $mountPoint;
 
-    /**
-     * XXX
-     *
-     * @var    list<Feature> $features
-     * @access private
-     */
-    private $_features;
+       /**
+        * Array with properties assigned to the Zvol
+        * 
+        * @var    array $properties
+        * @access private
+        */
+       private $properties;
 
-    // Associations
-    // Operations
-    /**
-     * XXX
-     *
-     * @return string XXX
-     * @access public
-     */
-    public function getName() {
-        trigger_error('Not Implemented!', E_USER_WARNING);
-    }
+       // Associations
+       // Operations
+       /**
+        * XXX
+        *
+        * @return string XXX
+        * @access public
+        */
+       public function getName() {
+               trigger_error('Not Implemented!', E_USER_WARNING);
+       }
 
-    /**
-     * XXX
-     *
-     * @return int XXX
-     * @access public
-     */
-    public function getSize() {
-        trigger_error('Not Implemented!', E_USER_WARNING);
-    }
+       /**
+        * XXX
+        *
+        * @return int XXX
+        * @access public
+        */
+       public function getSize() {
+               trigger_error('Not Implemented!', E_USER_WARNING);
+       }
 
-    /**
-     * XXX
-     *
-     * @return string XXX
-     * @access public
-     */
-    public function getMountPoint() {
-        trigger_error('Not Implemented!', E_USER_WARNING);
-    }
+       /**
+        * XXX
+        *
+        * @return string XXX
+        * @access public
+        */
+       public function getMountPoint() {
+               trigger_error('Not Implemented!', E_USER_WARNING);
+       }
 
-    /**
-     * XXX
-     *
-     * @return list<Feature> XXX
-     * @access public
-     */
-    public function getFeatures() {
-        trigger_error('Not Implemented!', E_USER_WARNING);
-    }
+       /**
+        * XXX
+        *
+        * @return list<Feature> XXX
+        * @access public
+        */
+       public function getProperties() {
+               trigger_error('Not Implemented!', E_USER_WARNING);
+       }
 
-    /**
-     * XXX
-     *
-     * @param   $list<Feature> XXX
-     * @return void XXX
-     * @access public
-     */
-    public function setFeatures($list<Feature>) {
-        trigger_error('Not Implemented!', E_USER_WARNING);
-    }
+       /**
+        * XXX
+        *
+        * @param   $list<Feature> XXX
+        * @return void XXX
+        * @access public
+        */
+       public function setProperties($properties) {
+               trigger_error('Not Implemented!', E_USER_WARNING);
+       }
+
+       /**
+        * Helper function to execute a command and throw an exception on error
+        * (requires stderr redirected to stdout for proper exception message).
+        * 
+        * @param string $cmd Command to execute
+        * @param array &$out If provided will contain output in an array
+        * @param int &$res If provided will contain Exit status of the command
+        * @return string Last line of output when executing the command
+        * @throws OMVModuleZFSException
+        * @access private
+        */
+       private function exec($cmd, &$out = null, &$res = null) {
+               $tmp = OMVUtil::exec($cmd, $out, $res);
+               if ($res) {
+                       throw new OMVModuleZFSException(implode("\n", $out));
+               }
+               return $tmp;
+       }
 
 }
 
This page took 0.043138 seconds and 5 git commands to generate.