- $pooluuid = OMVModuleZFSUtil::getUUIDbyName($name);
- $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "']";
- $mountpoint = $xmlConfig->get($xpath);
- if (is_null($mountpoint)) {
- $uuid = OMVUtil::uuid();
- $pool = new OMVModuleZFSZpool($name);
- $dir = $pool->getMountPoint();
- $object = array(
- "uuid" => $uuid,
- "fsname" => $pooluuid,
- "dir" => $dir,
- "type" => "zfs",
- "opts" => "rw,relatime,xattr,noacl",
- "freq" => "0",
- "passno" => "0"
- );
- $xmlConfig->set("//system/fstab",array("mntent" => $object));
- $dispatcher = &OMVNotifyDispatcher::getInstance();
- $dispatcher->notify(OMV_NOTIFY_CREATE,"org.openmediavault.system.fstab.mntent", $object);
+ if (preg_match('/[\/]+/', $name)) {
+ $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']";
+ if (!($xmlConfig->exists($xpath))) {
+ $uuid = OMVUtil::uuid();
+ $object = array(
+ "uuid" => $uuid,
+ "fsname" => $pooluuid,
+ "dir" => $dir,
+ "type" => "zfs",
+ "opts" => "rw,relatime,xattr,noacl",
+ "freq" => "0",
+ "passno" => "0",
+ "hidden" => "1"
+ );
+ $xmlConfig->set("//system/fstab",array("mntent" => $object));
+ }