+ /**
+ * Sets a GPT label on a disk to prevent the zpool command from generating
+ * errors.
+ *
+ */
+ public static function setGPTLabel($disk) {
+ $cmd = "parted -s " . $disk . " mklabel gpt 2>&1";
+ OMVModuleZFSUtil::exec($cmd,$out,$res);
+ }
+
+ /**
+ * Manages relocation of ZFS filesystem mountpoints in the OMV backend.
+ * Needed when the user changes mountpoint of a filesystem in the GUI.
+ *
+ */
+ public static function relocateFilesystem($name) {
+ global $xmlConfig;
+ $poolname = OMVModuleZFSUtil::getPoolname($name);
+ $pooluuid = OMVModuleZFSUtil::getUUIDbyName($poolname);
+ $ds = new OMVModuleZFSDataset($name);
+ $dir = $ds->getMountPoint();
+ $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "' and dir='" . $dir . "' and type='zfs']";
+ $object = $xmlConfig->get($xpath);
+ $object['dir'] = $property['value'];
+ $xmlConfig->replace($xpath, $object);
+ return null;
+ }
+