Commit Graph

21 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
3eccc3a633
qmemman: use try/finally to really release the lock
Currently not needed in practice, but a preparation for the next
commit(s).

QubesOS/qubes-issues#1389
2016-01-14 03:32:18 +01:00
Marek Marczykowski-Górecki
6a99b0b2ba
qmemman: add some useful logging for #1389
QubesOS/qubes-issues#1389
2016-01-14 03:15:38 +01:00
Marek Marczykowski-Górecki
78b63eb21a
qmemman: fix crash when VM fails to start
In this case, qmemman would not manage to get any memory state for such
VM, so memory_current would be 'None'. But later it would perform
arithmetics on it, which would result in qmemman crash (TypeError
exception).

Fixes QubesOS/qubes-issues#1601
2016-01-11 21:50:57 +01:00
Marek Marczykowski-Górecki
181eb3e764
qmemman: handle memory assigned to VM but not yet used
When VM got some memory assigned, balloon driver may not pick it up
immediatelly and the memory will still be seen as "free" by Xen, but VM
can use (request) it at any time. Qmemman needs to take care of such
memory (exclude it from "free" pool), otherwise it would redistribute it
to other domains, allowing the original domain to drain Xen memory pool.

Do this by redefining DomainState.memory_actual - it is now amount of
memory available to the VM (currently used, or possibly used). Then
calculate free memory by subtracting memory allocated but not used
(memory_target-memory_current).

Fixes QubesOS/qubes-issues#1389
2016-01-06 00:40:10 +01:00
Marek Marczykowski-Górecki
e30e802903
qmemman: add --debug option 2016-01-06 00:39:00 +01:00
qubesuser
9f04743388 qmemman: fix null reference bug 2015-12-05 17:25:33 +01:00
Marek Marczykowski-Górecki
fef8761f01
qmemman: improve check whether VM is still running
In some cases it may happen that qmemman or other application using
xenstore will re-create VM directory in xenstore just after VM was
destroyed. For example when multiple VMs was destroyed at the same time,
but qmemman will kick off just at first @releaseDomain event - other VMs
will still be there (at xenstore-list time). This means that qmemman
will consider them when redistributing memory (of just destroyed one),
so will update memory/target entry of every "running" VM. And at this
point it may recreate VM directory of another already destroyed VM.

Generally fixing this race condition would require running all the
operations (from xenstore-ls, to setting memory/target) in a single
xenstore transaction. But this can be lengthly process. And if any other
modification happens in the meantime, transaction will rejected and
qmemman would need to redo all the changes. Not worth the effort.

Fixes QubesOS/qubes-issues#1409
2015-11-27 20:00:33 +01:00
Marek Marczykowski-Górecki
88b4a84cce
Merge remote-tracking branch 'origin/pr/7' into HEAD
* origin/pr/7:
  Properly account for Xen memory overhead to fix large VMs

QubesOS/qubes-issues#1136
2015-10-10 05:22:13 +02:00
qubesuser
540f4f7294 Properly account for Xen memory overhead to fix large VMs 2015-10-10 01:08:56 +02:00
Marek Marczykowski-Górecki
2d8a8094ed
qmemman: add some comments about new condition for failing request
QubesOS/qubes-issues#1136
2015-10-09 19:29:15 +02:00
qubesuser
a55172d63e Support large VMs by removing the fixed balloon iteration limit 2015-10-09 13:50:34 +02:00
Wojtek Porczyk
fbdb2f07ac qmemman: add logging 2015-03-31 20:42:53 +02:00
Marek Marczykowski-Górecki
d5cb05fdc6 Move dispvm+qmemman service files to relevant directories
Remove them from global services dir.
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
0009805041 rpm+makefile: move build/install code to Makefile files
This makes build "scripts" not tied to Fedora-specific files. Especially
ease porting to other platforms.
2014-11-19 12:50:24 +01:00
Marek Marczykowski
4a4fb5e243 qmemman: change process model from forking to single process + sd_notify
Forking daemon after initializing hypervisor connection can cause
problems (and actually does in case of libvirt).
To notify systemd when daemon is ready use notify socket (previously it
was termination of parent process).
2014-11-19 12:47:00 +01:00
Marek Marczykowski-Górecki
1ed9c74d83 Rearrange code to not import PyQt on every qvm-* call
Move notification functions to separate file (out of guihelpers).
2014-06-05 01:59:42 +02:00
Marek Marczykowski-Górecki
eaac0024ca qmemman: remove dead code 2014-06-04 02:46:48 +02:00
Marek Marczykowski-Górecki
44f38fe076 Declare file encoding for all python files, fill missing copyright headers
Without that, python do not accept UTF-8 even in comments.
2014-05-18 21:03:27 +02:00
Marek Marczykowski-Górecki
bba989e0a6 Move meminfo-writer to linux-utils repo
It is common for both dom0 and VM, and also quite linux-specific
(other OSes will need other implementation). So move to linux-specific
repo (not dom0-specific).
2014-01-05 05:36:50 +01:00
Marek Marczykowski-Górecki
71960d83cc qmemman: fix maxmem handling (#736)
'static-max' as read from xenstore is string, so needs to be converted
to int. Additionally units needs to be adjusted (MB vs kB).
2013-10-22 02:04:39 +02:00
Marek Marczykowski
a84886db07 Move all files one level up 2013-03-16 19:56:51 +01:00