Commit Graph

244 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
2658c9a6e6
core: detach PCI devices before shutting down VM
When VM is shutting down it doesn't disconnect PCI frontend (?), so when
VM is destroyed it ends up in timeouts in PCI backend shutdown (which
can't communicate with frontend at that stage). Prevent this by
detaching PCI devices while VM is still running.

Fixes QubesOS/qubes-issues#1494
Fixes QubesOS/qubes-issues#1425
2015-12-06 14:31:43 +01:00
Marek Marczykowski-Górecki
28886390b4
Merge branch 'always-stubdom-guid' 2015-11-28 05:10:54 +01:00
Marek Marczykowski-Górecki
f525a58134
core: adjust for updated stubdom support in libvirt
Fixes QubesOS/qubes-issues#1456
2015-11-27 20:00:33 +01:00
Marek Marczykowski-Górecki
cc3ab7aaa1
Merge remote-tracking branch 'qubesos/pr/11'
* qubesos/pr/11:
  libvirtError in _update_libvirt_domain is no longer silently swallowed.
2015-11-25 03:46:55 +01:00
Vít Šesták
eb97c5652f libvirtError in _update_libvirt_domain is no longer silently swallowed.
I had some issue with fstrim and the missing else had caused the code to continue and fail later with a non-descriptive error message. This commit makes the error message more descriptive and helpful.
2015-11-25 01:16:27 +01:00
Bahtiar `kalkin-` Gadimov
2ebd20049d Refactor appmenus paths to core-admin-linux 2015-11-22 12:21:40 +01:00
Bahtiar `kalkin-` Gadimov
710b95a6ac Fix app icons errors 2015-11-17 19:37:20 +01:00
Bahtiar `kalkin-` Gadimov
78891dd70f QubesVm save the name of the storage pool used 2015-11-17 19:37:19 +01:00
Marek Marczykowski-Górecki
7359e394bc
core: detach connected VMs when shutting down NetVM
This is workaround for missing libxl/libvirt functionality: QubesOS/qubes-issues#1426

Also it should improve system shutdown time, as this is the situation
where all the VMs are shutting down simultaneously.

Fixes QubesOS/qubes-issues#1425
2015-11-15 02:06:18 +01:00
Marek Marczykowski-Górecki
4316027fb1
core: Add 'wait' parameter to vm.run_service function
Sometimes it makes sense to "fire and forget" a service. For example
"qubes.InstallUpdatesGUI".

QubesOS/qubes-issues#1249
2015-11-13 05:43:40 +01:00
Marek Marczykowski-Górecki
540fe3f552
core: set vm.uses_default_kernel=False when setting vm.kernel
Forgetting this leads to misterious errors (VM started with different
kernel than it was just set), so simplify the API.

Fixes QubesOS/qubes-issues#1400
2015-11-10 17:07:57 +01:00
Marek Marczykowski-Górecki
ba54792c83
core: make modules.img optional even for PV
When using PVGrub it doesn't make sense to attach modules.img, since
modules are already in the VM. Initramfs there will already handle such
situation and will not try to mount it, when VM's root filesystem
already contains appropriate /lib/modules/`uname -r`.

On the other hand, error earlier when initramfs is missing. While also
not used by PV Grub, the file is always specified in libvirt config and
when missing libvirt will throw rather cryptic error message.

QubesOS/qubes-issues#1354
2015-11-10 17:04:50 +01:00
Marek Marczykowski-Górecki
34f7ddd41e
core: force QubesDB reconnection on VM start 2015-11-07 05:43:34 +01:00
Marek Marczykowski-Górecki
cf6c6baded
Improve resize2fs call for root.img resize
1. Do not start GUI session - to reduce startup time
2. Use user="root" instead of sudo - not all templates have sudo
installed (for example fedora-21-minimal)
3. Add missing wait=True - otherwise VM may be shutdown during the
operation.

QubesOS/qubes-issues#1268
2015-11-07 05:03:54 +01:00
Marek Marczykowski-Górecki
cfe782f04a
Merge remote-tracking branch 'qubesos/pr/8'
* qubesos/pr/8:
  Support more VM types in qvm-grow-root

Fixes QubesOS/qubes-issues#1268
2015-11-07 05:03:54 +01:00
Marek Marczykowski-Górecki
1c0ade6166
Fix race condition in QubesVm.get_cputime/get_mem
When domain is destroyed after isActive check, but before getting
actuall info, it would fail. So handle this situation.
2015-10-27 21:35:02 +01:00
Michal Rostecki
3be8bb31fb Support more VM types in qvm-grow-root
QubesOS/qubes-issues#1268
2015-10-24 19:58:03 +02:00
Marek Marczykowski-Górecki
75168c8aef
core: improve handling QubesDB startup errors
Kill the VM when QubesDB initialization fails, in any way, not only
QubesDB daemon itself.
2015-10-13 23:49:32 +02:00
Marek Marczykowski-Górecki
5c549e1134
core: Provide more meaningful error when failed to kill old QubesDB instance
This process may be running as root in case of default NetVM. But do not
kill it forcibly (through sudo or so), because it may also be stale
pid file. After all, QubesDB should automatically terminate when its VM
is terminated, so this code is already some error handling.

Fixes QubesOS/qubes-issues#1331
2015-10-13 23:46:59 +02:00
Marek Marczykowski-Górecki
2b7bd1f1f5
Merge remote-tracking branch 'qubesos/pr/7'
* qubesos/pr/7:
  Don't send screen layout to the VM if we haven't received it from xrandr because this breaks proper initial screen layout set by gui-agent Fixes QubesOS/qubes-issues#1305 QubesOS/qubes-issues#998
2015-10-11 02:56:25 +02:00
Marek Marczykowski-Górecki
350e279f4f
Fix handling /etc/localtime hardlink
If /etc/localtime in dom0 is a hardlink to zoneinfo file (instead of
symlink) and more than one zoneinfo file is hardlinked to this inode,
appVMs will get invalid timezone, e.g. "Europe/Warsaw\x0aPoland".

Reported by @yaqu, fix provided by @yaqu
Fixes QubesOS/qubes-issues#1315
2015-10-10 17:30:40 +02:00
Marek Marczykowski-Górecki
820e5c0e69
Update stubdom memory allocation to 44MB
Since 677a79b "hvm: change default graphics to std vga ('xen')",
stubdomain uses 44MB RAM

QubesOS/qubes-issues#1136
2015-10-10 05:22:44 +02:00
HW42
912d4c1447
qubes-random-seed: feed kernel rng with randomness from dom0 2015-10-10 05:22:43 +02: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
Ivan Konov
78c3f40f89 Don't send screen layout to the VM if we haven't received it from xrandr
because this breaks proper initial screen layout set by gui-agent
Fixes QubesOS/qubes-issues#1305 QubesOS/qubes-issues#998
2015-10-09 22:56:41 +03:00
Marek Marczykowski-Górecki
958b59cc00
core: Show the right kernel version for DispVMs
Fixes QubesOS/qubes-issues#948
2015-10-03 01:50:15 +02:00
Marek Marczykowski-Górecki
4f04c62f36
Merge branch 'bug1241'
Fixes QubesOS/qubes-issues#1241
2015-10-02 01:59:17 +02:00
Marek Marczykowski-Górecki
fa3325a2b2
Merge branch 'bug1198'
Fixes QubesOS/qubes-issues#1198
2015-10-02 01:59:05 +02:00
Marek Marczykowski-Górecki
3cdae85254
core: preserve 'autostart' setting during VM rename
Systemd unit name needs to be renamed.

Fixes QubesOS/qubes-issues#1256
2015-10-02 01:57:00 +02:00
Marek Marczykowski-Górecki
b9e6b0a076
core/hvm: fix error message when creating HVM while not supported by the hardware
libvirt reports such errors at domain definition, not startup (as was in
libxl).

QubesOS/qubes-issues#1198
2015-09-25 22:21:10 +02:00
Marek Marczykowski-Górecki
dd1bea98e1
core/start: ensure that the previous QubesDB daemon isn't running
When restarting VM (starting it just after it was shut down), it may
happen that previous `qubesdb-daemon` instance is still running - if VM
doesn't properly terminate the connection, dom0 part will not terminate
immediately, but at next alive check (every 10s). Such `qubesdb-daemon`,
when terminating, will remove pid file and socket file. In case of new
daemon already running it would be those of the new daemon, making the
whole QubesDB of this VM inaccessible for dom0 (`qubesdb-daemon` is
running, but its socket is removed).

To prevent this race, ensure that previous instance is terminated before
starting the new one.
There is no need to manually removing socket file, because if some stale
socket exists, it will be replaced by the new one when new
`qubesdb-daemon` starts up.

QubesOS/qubes-issues#1241
2015-09-25 22:06:14 +02:00
Marek Marczykowski-Górecki
76bddaa280 core: use vm.absolute_path to parse paths in qubes.xml
This makes easier to handle some corner cases. One of them is having
entry without `dir_path` defined. This may happen when migrating from R2
(using backup+restore or in-place) while some DisposableVM was running
(even if not included in the backup itself).

Fixes qubesos/qubes-issues#1124
Reported by @doncohen, thanks @wyory for providing more details.
2015-09-04 01:58:53 +02:00
Marek Marczykowski-Górecki
226a144285 core: fix vm-persistence info for DispVM
(reported by @adrelanos)
qubesos/qubes-issues#1101
2015-09-03 21:11:43 +02:00
Marek Marczykowski-Górecki
3beb307901 core: add VM persistence info to qubesdb (#1101)
Fixes qubesos/qubes-issues#1101
2015-09-02 00:15:14 +02:00
Marek Marczykowski-Górecki
1ed4a2cbb2
core: fix getting libvirt error code 2015-08-08 21:29:56 +02:00
Marek Marczykowski-Górecki
da0e5dd4ba
core: inherit kernelopts from the template by default
Fixes qubesos/qubes-issues#1091
2015-08-05 01:43:43 +02:00
Marek Marczykowski-Górecki
2ed9008a83
core: handle firewall.xml path during VM rename 2015-08-05 01:04:44 +02:00
Marek Marczykowski-Górecki
46b94b6682
Make qubes-set-updates set also default state for new VMs
This makes possible to also check if the "updates check enabled" state
is consistent across VMs.

Fixes qubesos/qubes-issues#892
2015-08-05 01:04:43 +02:00
Marek Marczykowski-Górecki
90393c33f2
core: add offline mode to qvm-create, qvm-prefs
This is required to create VMs in process of building Live system, where
libvirt isn't running.

Additionally there is no udev in the build environment, so needs to
manually create /dev/loop*p* based on sysfs info.
2015-08-01 21:58:38 +02:00
Marek Marczykowski-Górecki
8f862cdf69
core/hvm: check if VM serving cdrom content is running 2015-07-25 04:17:59 +02:00
Marek Marczykowski-Górecki
51826decec
core/hvm: start guid before qrexec, even when gui agent is installed
This way even when qrexec agent would timeout on connection, guid will
be already running.
Also use new -K guid option to terminate stubdom guid when the real guid
is connected (unless in debug mode - then both guid will be running).
2015-07-25 03:55:50 +02:00
Marek Marczykowski-Górecki
1199806b5a core: fix handling firewall configuration for VM clones and DispVMs (#1032)
There were two bugs:
1. Firewall configuration wasn't copied during qvm-clone (it is in
   separate file, so now it is included in vm.clone_disk_files).
2. Non-default firewall configuration wasn't stored in qubes.xml. This
   means that initially DispVM got proper configuration (inherited from
   calling VM), but if anything caused firewall reload (for example
   starting another VM), the firewall rules was cleared to default state
   (allow all).

Fixes qubesos/qubes-issues#1032
2015-07-08 04:46:14 +02:00
Marek Marczykowski-Górecki
e52f0a0566 core: by default call qrexec services without GUI
Most of them do not need GUI (especially those started from dom0), so
speed the things up a little (no need to wait for guid). But if some
service will need GUI access, there is "gui" parameter.
2015-07-08 01:36:28 +02:00
Marek Marczykowski-Górecki
284419b355 core: add "localcmd" support in QubesVm.run_service function 2015-07-08 01:35:59 +02:00
Marek Marczykowski-Górecki
402d1b9a3d indentation fix 2015-07-01 04:40:48 +02:00
Marek Marczykowski-Górecki
522bfc427a core: fix template-based HVM disk handling
We use only one device-mapper layer for HVMs, and this isn't the same as
for PV - it is that one, which PV does in initramfs.
Device-mapper layers summary for template-based VMs:
PV: root.img+root-cow.img (dom0) -> xvda, xvda+volatile.img (VM)
HVM: root.img+volatile.img (dom0)
2015-07-01 04:35:09 +02:00
Marek Marczykowski-Górecki
a96d49a40a core: properly redirect qrexec output to /dev/null when necessary
/dev/null was opened in read-only mode ("rw" is invalid value), so
qrexec couldn't write there.
2015-07-01 04:33:04 +02:00
Marek Marczykowski-Górecki
ad89c8f8a2 core: show clear message when a VM has non-existing PCI device assigned 2015-06-27 04:52:25 +02:00
Marek Marczykowski-Górecki
ee48954445 core: fix starting stubdom guid for HVM in debug mode
Remove artificial attribute '_start_guid_first' and use
guiagent_installed directly. This way starting guid for stubdom in debug
mode, even if guiagent_installed is set is much clearer.
2015-06-27 04:10:32 +02:00