Vinzenz Feenstra has uploaded a new change for review.

Change subject: linux: Ignore filesystems in disks usage with zero size
......................................................................

linux: Ignore filesystems in disks usage with zero size

This patch introduces a new option in the linux configuration files
to ignore mounted filesystems with zero size.
We're currently black listing file system types and with every
new distribution we support new filesystem types have to be added
which usually have no size. (total/used size equals 0)

This patch introduces the ignore_zero_size_fs option to allow users
to revert back to the old behaviour by setting the value to `false`.

Change-Id: Iacaf57966aec2d973be39776b5f2457b27dac689
Bug-Url: https://bugzilla.redhat.com/1130993
Signed-off-by: Vinzenz Feenstra <vfeen...@redhat.com>
(cherry picked from commit cc8d0418fcfa23bfcc60ef150f4375bea7bc4751)
---
M configurations/default.conf
M configurations/ovirt-guest-agent.conf
M ovirt-guest-agent/GuestAgentLinux2.py
M tests/guest_agent_test.py
4 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent 
refs/changes/10/32110/1

diff --git a/configurations/default.conf b/configurations/default.conf
index f5d79db..fb4f005 100644
--- a/configurations/default.conf
+++ b/configurations/default.conf
@@ -16,6 +16,7 @@
 # openSUSE Packages:    xf86-video-qxl kernel-desktop kernel-default 
kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen
 applications_list = kernel ovirt-guest-agent ovirt-guest-agent-common 
xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl xf86-video-qxl 
kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug 
kernel-ec2 kernel-xen
 ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs 
devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc 
fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs
+ignore_zero_size_fs = true
 
 [virtio]
 device = /dev/virtio-ports/com.redhat.rhevm.vdsm
diff --git a/configurations/ovirt-guest-agent.conf 
b/configurations/ovirt-guest-agent.conf
index 1e8a964..9e3165b 100644
--- a/configurations/ovirt-guest-agent.conf
+++ b/configurations/ovirt-guest-agent.conf
@@ -16,6 +16,7 @@
 ## openSUSE Packages:    xf86-video-qxl kernel-desktop kernel-default 
kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen
 # applications_list = kernel ovirt-guest-agent ovirt-guest-agent-common 
xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl xf86-video-qxl 
kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug 
kernel-ec2 kernel-xen
 # ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc 
sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc 
fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs
+# ignore_zero_size_fs = true
 
 [virtio]
 # device = /dev/virtio-ports/com.redhat.rhevm.vdsm
diff --git a/ovirt-guest-agent/GuestAgentLinux2.py 
b/ovirt-guest-agent/GuestAgentLinux2.py
index f929414..e5c3be5 100644
--- a/ovirt-guest-agent/GuestAgentLinux2.py
+++ b/ovirt-guest-agent/GuestAgentLinux2.py
@@ -223,6 +223,7 @@
             self.list_nics = nicmgr.list_nics
         self.app_list = ""
         self.ignored_fs = ""
+        self.ignore_zero_size_fs = True
         self._init_vmstat()
         DataRetriverBase.__init__(self)
 
@@ -276,6 +277,8 @@
                         statvfs = os.statvfs(path)
                         total = statvfs.f_bsize * statvfs.f_blocks
                         used = total - statvfs.f_bsize * statvfs.f_bfree
+                        if self.ignore_zero_size_fs and used == total == 0:
+                            continue
                         usages.append({'path': path, 'fs': fs, 'total': total,
                                        'used': used})
                 except:
@@ -369,6 +372,8 @@
         self.dr = LinuxDataRetriver()
         self.dr.app_list = config.get("general", "applications_list")
         self.dr.ignored_fs = set(config.get("general", "ignored_fs").split())
+        self.dr.ignore_zero_size_fs = config.get("general",
+                                                 "ignore_zero_size_fs")
         self.commandHandler = CommandHandlerLinux(self)
         self.cred_server = CredServer()
 
diff --git a/tests/guest_agent_test.py b/tests/guest_agent_test.py
index 1962e19..3f896b9 100644
--- a/tests/guest_agent_test.py
+++ b/tests/guest_agent_test.py
@@ -22,6 +22,7 @@
              'nfds proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts '
              'securityfs debugfs binfmt_misc fuse.gvfsd-fuse '
              'fuse.gvfs-fuse-daemon fusectl usbfs')
+    conf.set('general', 'ignore_zero_size_fs', 'true')
     from GuestAgentLinux2 import LinuxVdsAgent
     return port_name, LinuxVdsAgent
 


-- 
To view, visit http://gerrit.ovirt.org/32110
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iacaf57966aec2d973be39776b5f2457b27dac689
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Vinzenz Feenstra <vfeen...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to