+ public function addPool(array $disks, $name = null, array $options = array()) {
+ $this->initPool($name);
+ return $this->updatePool(OMVModulePoolAction::OMVModulePoolAction_TYPE_ADD,
+ $disks, count($disks), $name, $options);
+ }
+
+ public function removeDevice(array $disks, $name = null) {
+ }
+
+ public function destroyPool($name = null) {
+ }
+
+ public function scrubPool($name = null) {
+ }
+
+ public function exportPool($name = null){
+ }
+
+ public function importPool($name = null){
+ }
+
+ /*
+ * public function attachDevice($extingDisk, $newDisk, $name = null)
+ * public function detachDevice($disk, $name = null)
+ * public function onlineDevice($disk, $name = null)
+ * public function offlineDevice($disk, $name = null)
+ * public function replaceDevice($extingDisk, $newDisk, $name = null)
+ * public function upgradePool($name = null)
+ */
+
+ private function initPool($name = null) {
+ // Replace with OMVUtil::exec
+ $this->validateName($name);
+ }
+
+ private function validateName($name = null) {
+ $oldname = null;
+ if ($name != null) {
+ $oldname = $this->params['name'];
+ $this->params['name'] = $name;
+ }
+ if (! $this->params['name'] || ! preg_match('/^\w+$/', $this->params['name'])) {
+ if ($oldname) {
+ $this->params['name'] = $oldname;
+ }
+ throw new Exception("Name of pool cannot be null or empty");
+ }
+ }
+
+ /**
+ * Update pool.
+ * @param action Action to be taken. create or add.
+ * @param disks Array of disks. Format: /dev/disk/by-id/...
+ * @param disk_num Number of disk(s) in the pool.
+ * @param name Name for the pool.
+ * @param options Array which can contain all or a subset of
+ * the following fields:
+ * <ul>
+ * <li> log Array which contains the following fields:
+ * <ul>
+ * <li> disks Array of disks. Format: /dev/disk/by-id/...
+ * <li> mirror Either true or false. <b>Default is false</b>.
+ * </ul>
+ * <li> cache Array which contains the following fields:
+ * <ul>
+ * <li> disks Array of disks. Format: /dev/disk/by-id/... <b>Default use internal</b>.
+ * </ul>
+ * <li> spare Array of disks. Format: /dev/disk/by-id/...
+ * </ul>
+ * @throws Exception.
+ */
+ private function updatePool($action, array $disks, $disk_num, $name = null, array $options = array()) {
+ OMVModulePoolAction::toString($action);
+ $cmd = 'zpool ' . OMVModulePoolAction::getAction($action);