+ public function addPool($params, $context) {
+ $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
+ switch ($params['pooltype']) {
+ case "basic":
+ $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSPLAIN;
+ break;
+ case "mirror":
+ $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSMIRROR;
+ break;
+ case "raidz1":
+ $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ1;
+ break;
+ case "raidz2":
+ $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ2;
+ break;
+ case "raidz3":
+ $pooltype = OMVModuleZFSVdevType::OMVMODULEZFSRAIDZ3;
+ break;
+ default:
+ throw new OMVModuleZFSException("Incorrect pool type specified");
+ break;
+ }
+ //Check for user supplied options
+ $opts = "";
+ if ($params['force']) {
+ $opts .= "-f ";
+ }
+ if (strlen($params['mountpoint']) > 0) {
+ $opts .= "-m " . $params['mountpoint'] . " ";
+ }
+
+ $disks = preg_split("/[,;]/", $params['devices']);
+ $vdev = new OMVModuleZFSVdev($params['name'], $pooltype, $disks);
+ $pool = new OMVModuleZFSZpool($vdev, $opts);
+ //Ugly fix to solve the problem of blkid not displaying info on newly created pools
+ $pool->export();
+ $pool->import($pool->getName());
+ }
+