]> git.datanom.net - omvzfs.git/commitdiff
Patches to OMV core
authorMichael Rasmussen <mir@datanom.net>
Thu, 18 Sep 2014 21:46:02 +0000 (23:46 +0200)
committerMichael Rasmussen <mir@datanom.net>
Thu, 18 Sep 2014 21:46:02 +0000 (23:46 +0200)
patches/10filesystem.patch [new file with mode: 0644]
patches/Filesystem.patch [new file with mode: 0644]
patches/filesystemmgmt.patch [new file with mode: 0644]

diff --git a/patches/10filesystem.patch b/patches/10filesystem.patch
new file mode 100644 (file)
index 0000000..afe3e26
--- /dev/null
@@ -0,0 +1,11 @@
+--- omv/10filesystem.org       2014-09-18 10:13:05.796103231 +0200
++++ omv/10filesystem   2014-09-18 10:16:50.584113483 +0200
+@@ -25,7 +25,7 @@
+ . /usr/share/openmediavault/scripts/helper-functions
+ xmlstarlet sel -t \
+-  -m "//system/fstab/mntent[not(contains(opts,'bind') or contains(opts,'loop'))]" \
++      -m "//system/fstab/mntent[not(contains(opts,'bind') or contains(opts,'loop') or contains(type,'zfs'))]" \
+       -v uuid \
+       -i "position() != last()" -n -b \
+   -b \
diff --git a/patches/Filesystem.patch b/patches/Filesystem.patch
new file mode 100644 (file)
index 0000000..694be09
--- /dev/null
@@ -0,0 +1,17 @@
+--- omv/Filesystem.js.org      2014-09-18 10:52:09.777037347 +0200
++++ omv/Filesystem.js  2014-09-18 21:18:41.363038848 +0200
+@@ -642,6 +642,14 @@
+                               tbarBtnDisabled["quota"] = true;
+                       }
+               }
++              //Disable all buttons for zfs filesystems. These actions should be
++              //handled by 3rd party plugin.
++              if([ "zfs_member" ].indexOf(
++                      records[0].get("type")) == 0) {
++                              tbarBtnDisabled["mount"] = true;
++                              tbarBtnDisabled["unmount"] = true;
++                              tbarBtnDisabled["delete"] = true;
++              }
+               // Update the button controls.
+               Ext.Object.each(tbarBtnDisabled, function(key, value) {
+                       this.setToolbarButtonDisabled(key, value);
diff --git a/patches/filesystemmgmt.patch b/patches/filesystemmgmt.patch
new file mode 100644 (file)
index 0000000..31b197c
--- /dev/null
@@ -0,0 +1,85 @@
+--- omv/filesystemmgmt.inc.org 2014-09-18 09:39:59.956015279 +0200
++++ omv/filesystemmgmt.inc     2014-09-18 15:36:01.981792621 +0200
+@@ -83,7 +83,7 @@
+                       if (!in_array($objectv['type'], array("ext", "ext2", "ext3",
+                         "ext4", "xfs", "jfs", "iso9660", "msdos", "ntfs", "udf",
+                         "umsdos", "vfat", "ufs", "reiserfs", "btrfs", "hfsplus",
+-                        "zfs")))
++                        "zfs", "zfs_member")))
+                               continue;
+                       // Use the devicefile to get the filesystem details because vfat
+                       // filesystems do not have a valid UUID. Any idea why?
+@@ -117,24 +117,46 @@
+                       // exists, then check if it is referenced by any other object,
+                       // e.g. by a shared folder configuration object.
+                       if (FALSE !== ($meObject = OMVRpc::exec("FsTab", "getByFsName",
+-                        array("id" => $fs->getDeviceFile()), $context))) {
+-                              $xpath = sprintf("//mntentref[contains(.,'%s')]",
+-                                $meObject['uuid']);
+-                              if (TRUE === $xmlConfig->exists($xpath))
+-                                      $object['_used'] = TRUE;
+-                      }
++                              array("id" => $fs->getDeviceFile()), $context))) {
++                                      if (strcmp($object['type'], "zfs_member") === 0) {
++                                              //This is a zfs filesystem which uses another format for UUID.
++                                              //The UUID of the filesystem is stored in the fsname property.
++                                              $xpath = "//system/fstab/mntent[fsname='" . $object['uuid'] . "']";
++                                              $zfs_obj = $xmlConfig->get($xpath);
++                                              if (!is_null($zfs_obj)) {
++                                                      $xpath = sprintf("//mntentref[contains(.,'%s')]",$zfs_obj['uuid']);
++                                                      if (TRUE === $xmlConfig->exists($xpath)) {
++                                                              $object['_used'] = TRUE;
++                                                      }
++                                              }
++                                      } else {
++                                              $xpath = sprintf("//mntentref[contains(.,'%s')]",
++                                                      $meObject['uuid']);
++                                              if (TRUE === $xmlConfig->exists($xpath))
++                                                      $object['_used'] = TRUE;
++                                      }
++                              }
+                       // Mark the device where the operating system is installed on
+                       // as used and read-only.
+                       if (OMVSystem::isRootDeviceFile($object['devicefile'])) {
+                               $object['_used'] = TRUE;
+                               $object['_readonly'] = TRUE;
+                       }
++                      //zfs filesystems are not detected by the isMounted method, but can be
++                      //probed via /proc/mounts
++                      $zfs_mounted = FALSE;
++                      if (strcmp($object['type'], "zfs_member") === 0) {
++                              $cmd = "cat /proc/mounts | grep '^" . $object['label'] . "[[:space:]]' 2>&1";
++                              $this->exec($cmd, $output, $result);
++                              if (count($output) === 1)
++                                      $zfs_mounted = TRUE;
++                      }
+                       // If the filesystem is mounted then try to get more
+                       // informations about it. Note,it is not possible to get
+                       // details from unmounted filesystems, because on most kinds
+                       // of systems doing so requires very nonportable intimate
+                       // knowledge of filesystem structures. See man (1) df.
+-                      if (TRUE === $fs->isMounted()) {
++                      if ((TRUE === $fs->isMounted()) || ($zfs_mounted)) {
+                               $object['mounted'] = TRUE;
+                               // Get some more filesystem details if possible.
+                               if (FALSE !== ($fsStats = $fs->getStatistics())) {
+@@ -183,8 +205,8 @@
+                                         "includeRoot":{"type":"boolean","optional":true}
+                                 }
+                         }');
+-              // Get list of mount points, except bind mounts.
+-              $xpath = "//system/fstab/mntent[not(contains(opts,'bind'))]";
++              // Get list of mount points, except bind mounts and zfs mountpoints
++              $xpath = "//system/fstab/mntent[not(contains(opts,'bind') or contains(type,'zfs'))]";
+               $objects = $xmlConfig->getList($xpath);
+               if (is_null($objects)) {
+                       throw new OMVException(OMVErrorMsg::E_CONFIG_GET_OBJECT_FAILED,
+@@ -344,7 +366,7 @@
+               // exist anymore. This is necessary to be able remove invalid mount
+               // point configuration objects. Mark such filesystem as missing.
+               $xpath = "//system/fstab/mntent[not(contains(opts,'bind') or ".
+-                "contains(opts,'loop'))]";
++                "contains(opts,'loop') or contains(type,'zfs'))]";
+               $mntents = $xmlConfig->getList($xpath);
+               if(is_null($mntents)) {
+                       throw new OMVException(OMVErrorMsg::E_CONFIG_GET_OBJECT_FAILED,
This page took 0.036656 seconds and 5 git commands to generate.