+ /**
+ * Constructor
+ *
+ * @param $pool pool this mirror belongs to
+ * @throws OMVModuleZFSException
+ */
+
+ public function __construct($vdev) {
+ if (is_array($vdev)) {
+ $cmd = $this->getCommandString($vdev);
+ $name = $vdev[0]->getPool();
+ $type = $vdev[0]->getType();
+ }
+ else {
+ $cmd = $this->getCommandString(array($vdev));
+ $name = $vdev->getPool();
+ $type = $vdev->getType();
+ }
+ $cmd = "zpool create $name $cmd";
+
+ OMVUtil::exec($cmd, $output, $result);
+ if ($result)
+ throw new OMVModuleZFSException($output);
+ else {
+ $this->vdevs = array();
+ $this->spare = array();
+ $this->log = array();
+ $this->cache = array();
+ $this->features = array();
+ $this->name = $name;
+ $this->type = $type;
+ if (is_array($vdev))
+ $this->vdevs = $vdev;
+ else
+ array_push ($this->vdevs, $vdev);
+ $this->size = $this->getAttribute("size");
+ $this->mountPoint = $this->getAttribute("mountpoint");
+ }
+ }
+