From 201cd509e189773de358101927fe743302c50d77 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 10 May 2013 05:39:46 +0200 Subject: [PATCH] QubesDom0NetVm: provide get_mem* As libvirt doesn't keep dom0 domain object, so add special cases to get memory information. --- core-modules/006QubesAdminVm.py | 12 +++++++++++- rpm_spec/core-dom0.spec | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core-modules/006QubesAdminVm.py b/core-modules/006QubesAdminVm.py index f0d66bb0..84bbeca6 100644 --- a/core-modules/006QubesAdminVm.py +++ b/core-modules/006QubesAdminVm.py @@ -24,7 +24,8 @@ from qubes.qubes import QubesNetVm,register_qubes_vm_class from qubes.qubes import defaults -from qubes.qubes import QubesException,dry_run +from qubes.qubes import QubesException,dry_run,libvirt_conn +import psutil class QubesAdminVm(QubesNetVm): @@ -57,6 +58,15 @@ class QubesAdminVm(QubesNetVm): def get_power_state(self): return "Running" + def get_mem(self): + return psutil.virtual_memory().total/1024 + + def get_mem_static_max(self): + return libvirt_conn.getInfo()[1] + + def get_disk_usage(self, file_or_dir): + return 0 + def get_disk_utilization(self): return 0 diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index 6a3bce3e..ffa8b1df 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -50,6 +50,7 @@ Requires(postun): systemd-units Requires: python, xen-runtime, pciutils, python-inotify, python-daemon Requires: qubes-core-dom0-linux >= 2.0.24 Requires: python-lxml +Requires: python-psutil # TODO: R: qubes-gui-dom0 >= 2.1.11 Conflicts: qubes-gui-dom0 < 1.1.13 Requires: xen >= 4.1.0-2