+
+ /**
+ * Constructor. If the Zvol already exists in the system the object will be updated with all
+ * associated properties from commandline.
+ *
+ * @param string $name Name of the new Zvol
+ * @return void
+ * @access public
+ */
+ public function __construct($name) {
+ $this->name = $name;
+ $qname = preg_quote($name, '/');
+ $cmd = "zfs list -H -t volume";
+ $this->exec($cmd, $out, $res);
+ foreach ($out as $line) {
+ if (preg_match('/^' . $qname . '\t.*$/', $line)) {
+ $this->updateAllProperties();
+ $this->mountPoint = $this->properties["mountpoint"]["value"];
+ $this->size = $this->properties["size"]["value"];
+ continue;
+ }
+ }
+ }
+