]>
Commit | Line | Data |
---|---|---|
f891182f MR |
1 | <?php |
2 | ||
3 | /** | |
4 | * XXX detailed description | |
5 | * | |
6 | * @author XXX | |
7 | * @version XXX | |
8 | * @copyright XXX | |
9 | */ | |
63617ac2 | 10 | class OMVModuleZFSZvol { |
4e7d4caf NB |
11 | // Attributes |
12 | ||
13 | /** | |
14 | * Name of Zvol | |
15 | * | |
16 | * @var string $name | |
17 | * @access private | |
18 | */ | |
19 | private $name; | |
f891182f | 20 | |
4e7d4caf NB |
21 | /** |
22 | * Size of Zvol | |
23 | * | |
24 | * @var int $size | |
25 | * @access private | |
26 | */ | |
27 | private $size; | |
f891182f | 28 | |
4e7d4caf NB |
29 | /** |
30 | * Mountpoint of the Zvol | |
31 | * | |
32 | * @var string $mountPoint | |
33 | * @access private | |
34 | */ | |
35 | private $mountPoint; | |
f891182f | 36 | |
4e7d4caf NB |
37 | /** |
38 | * Array with properties assigned to the Zvol | |
39 | * | |
40 | * @var array $properties | |
41 | * @access private | |
42 | */ | |
43 | private $properties; | |
f891182f | 44 | |
4e7d4caf NB |
45 | // Associations |
46 | // Operations | |
91f56fbc | 47 | |
4e7d4caf | 48 | /** |
91f56fbc NB |
49 | * Return name of the Zvol |
50 | * | |
51 | * @return string $name | |
4e7d4caf NB |
52 | * @access public |
53 | */ | |
54 | public function getName() { | |
91f56fbc | 55 | return $this->name; |
4e7d4caf | 56 | } |
f891182f | 57 | |
4e7d4caf | 58 | /** |
91f56fbc NB |
59 | * Get the mountpoint of the Zvol |
60 | * | |
61 | * @return string $mountPoint | |
4e7d4caf NB |
62 | * @access public |
63 | */ | |
91f56fbc NB |
64 | public function getMountPoint() { |
65 | return $this->mountPoint; | |
4e7d4caf | 66 | } |
f891182f | 67 | |
4e7d4caf | 68 | /** |
91f56fbc NB |
69 | * Get a single property value associated with the Zvol |
70 | * | |
71 | * @param string $property Name of the property to fetch | |
72 | * @return array The returned array with the property. The property is an associative array with | |
73 | * two elements, <value> and <source>. | |
4e7d4caf NB |
74 | * @access public |
75 | */ | |
91f56fbc NB |
76 | public function getProperty($property) { |
77 | return $this->properties["$property"]; | |
78 | } | |
79 | ||
80 | /** | |
81 | * Get an associative array of all properties associated with the Zvol | |
82 | * | |
83 | * @return array $properties Each entry is an associative array with two elements | |
84 | * <value> and <source> | |
85 | * @access public | |
86 | */ | |
87 | public function getProperties() { | |
88 | return $this->properties; | |
4e7d4caf | 89 | } |
f891182f | 90 | |
91f56fbc | 91 | |
4e7d4caf NB |
92 | /** |
93 | * XXX | |
94 | * | |
91f56fbc | 95 | * @return int XXX |
4e7d4caf NB |
96 | * @access public |
97 | */ | |
91f56fbc | 98 | public function getSize() { |
4e7d4caf NB |
99 | trigger_error('Not Implemented!', E_USER_WARNING); |
100 | } | |
f891182f | 101 | |
4e7d4caf NB |
102 | /** |
103 | * XXX | |
104 | * | |
105 | * @param $list<Feature> XXX | |
106 | * @return void XXX | |
107 | * @access public | |
108 | */ | |
109 | public function setProperties($properties) { | |
110 | trigger_error('Not Implemented!', E_USER_WARNING); | |
111 | } | |
112 | ||
113 | /** | |
114 | * Helper function to execute a command and throw an exception on error | |
115 | * (requires stderr redirected to stdout for proper exception message). | |
116 | * | |
117 | * @param string $cmd Command to execute | |
118 | * @param array &$out If provided will contain output in an array | |
119 | * @param int &$res If provided will contain Exit status of the command | |
120 | * @return string Last line of output when executing the command | |
121 | * @throws OMVModuleZFSException | |
122 | * @access private | |
123 | */ | |
124 | private function exec($cmd, &$out = null, &$res = null) { | |
125 | $tmp = OMVUtil::exec($cmd, $out, $res); | |
126 | if ($res) { | |
127 | throw new OMVModuleZFSException(implode("\n", $out)); | |
128 | } | |
129 | return $tmp; | |
130 | } | |
f891182f MR |
131 | |
132 | } | |
133 | ||
134 | ?> |