Marek Marczykowski-Górecki
f6bc61997a
qubes/vm: fix handling dynamic netvm change
...
Correctly detach network before attaching new one.
2016-09-08 04:17:48 +02:00
Marek Marczykowski-Górecki
c534b68665
qubes/vm: start VM daemons as normal user
...
This is migration of core2 commits:
commit d0ba43f253
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Mon Jun 6 02:21:08 2016 +0200
core: start guid as normal user even when VM started by root
Another attempt to avoid permissions-related problems...
QubesOS/qubes-issues#1768
commit 89d002a031
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Mon Jun 6 02:19:51 2016 +0200
core: use runuser instead of sudo for switching root->user
There are problems with using sudo in early system startup
(systemd-logind not running yet, pam_systemd timeouts). Since we don't
need full session here, runuser is good enough (even better: faster).
commit 2265fd3d52
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Sat Jun 4 17:42:24 2016 +0200
core: start qubesdb as normal user, even when VM is started by root
On VM start, old qubesdb-daemon is terminated (if still running). In
practice it happen only at VM startart (shutdown and quickly start
again). But in that case, if the VM was started by root, such operation
would fail.
So when VM is started by root, make sure that qubesdb-daemon will be
running as normal user (the first user in group 'qubes' - there should
be only one).
Fixes QubesOS/qubes-issues#1745
2016-09-08 04:17:47 +02:00
Marek Marczykowski-Górecki
16db68b053
Merge branch 'core3-devices' into core3-devel
...
* core3-devices:
Fix core2migration and tests for new devices API
tests: more qubes.devices tests
qubes/ext/pci: implement pci-no-strict-reset/BDF feature
qubes/tools: allow calling qvm-device as qvm-devclass (like qvm-pci)
qubes: make pylint happy
qubes/tools: add qvm-device tool (and tests)
tests: load qubes.tests.tools.qvm_ls
tests: PCI devices tests
tests: add context manager to catch stdout
qubes/ext/pci: move PCI devices handling to an extension
qubes/devices: use more detailed exceptions than just KeyError
qubes/devices: allow non-persistent attach
qubes/storage: misc fixes for VM-exposed block devices handling
qubes: new devices API
Fixes QubesOS/qubes-issues#2257
2016-09-04 21:32:01 +02:00
Marek Marczykowski-Górecki
6cb624daf3
Merge remote-tracking branch 'qubesos/pr/51' into core3-devel
...
* qubesos/pr/51:
Make pylint happy ♥ qubes.storage.lvm
Fix lvm AppVM startup from lvm
qubes.storage.lvm.qubes_lvm use debug not info
Fix qvm-create lvm based AppVM
qvm-block & qvm-pool add better Exception handling
Remove unexpected property
qvm-start --debug don't catch exceptions
2016-09-04 21:02:19 +02:00
Marek Marczykowski-Górecki
c2617663e5
qubes/vm/standalonevm: volatile image should be writable
...
QubesOS/qubes-issues#2256
2016-09-04 20:58:11 +02:00
Marek Marczykowski-Górecki
aa67a4512e
qubes/ext/pci: move PCI devices handling to an extension
...
Implement required event handlers according to documentation in
qubes.devices.
A modification of qubes.devices.DeviceInfo is needed to allow dynamic,
read-only properties.
QubesOS/qubes-issues#2257
2016-09-03 20:41:03 +02:00
Marek Marczykowski-Górecki
d7a3c0d319
qubes: new devices API
...
Allow device plugin to list attached and available devices. Enforce
at API level every device being exposed by some domain.
This commit only changes devices API, but not update existing users
(pci) yet.
QubesOS/qubes-issues#2257
2016-09-03 20:40:39 +02:00
Bahtiar `kalkin-` Gadimov
b712d0f6f3
Remove unexpected property
2016-08-29 00:05:18 +02:00
Marek Marczykowski-Górecki
3e30dc17cb
qubes/vm: remove special case for 'meminfo-writer' feature
...
It should be either in a plugin, or handled entirely from inside of VM.
But surely not in main QubesVM class.
Fixes QubesOS/qubes-issues#2101
2016-08-18 11:59:45 +02:00
Marek Marczykowski-Górecki
0293c1c7ef
qubes/vm: move misc XML tags loading to separate method
2016-08-18 11:57:11 +02:00
Marek Marczykowski-Górecki
46791e05f4
qubes/dispvm: do not clone 'template' property from base VM
...
template should point at the base VM itself.
2016-08-17 02:14:19 +02:00
Marek Marczykowski-Górecki
53b2b30c0a
qubes: fix some error messages
2016-08-17 02:13:59 +02:00
Marek Marczykowski-Górecki
3a2a87839f
qubes/vm: fix TemplateVM.commit_changes
...
Storage method was renamed to just `commit`, as it applies not only to
templates now.
2016-08-17 01:47:09 +02:00
Marek Marczykowski-Górecki
5d8ecd60de
qubes: minor fixes in handling defaults
...
- fix assigning 'template' property - do not do it if VM already have it
set
- cap default maxmem at 4000, as we clamp it to 10*memory anyway (and
default memory is 400)
2016-08-17 00:50:38 +02:00
Marek Marczykowski-Górecki
460f0849a7
qubes/features: handle recursive templates in check_with_template
...
This is the case for DispVMs: DispVM -> AppVM -> TemplateVM
2016-08-17 00:47:32 +02:00
Marek Marczykowski-Górecki
1a215e47ab
qubes: add 'default_dispvm' property - both Qubes and QubesVM
...
QubesOS/qubes-issues#2253
2016-08-17 00:46:43 +02:00
Marek Marczykowski-Górecki
ab6f961931
qubes/dispvm: misc fixes, make it actually working
...
- DispVM is no longer a special case for storage
- Add missing 'rw=True' for volatile volume
- Handle storage initialization (copy&paste from AppVM)
- Clone properties from DispVM template
QubesOS/qubes-issues#2253
2016-08-17 00:42:17 +02:00
Marek Marczykowski-Górecki
d4e534bc05
qubes/vm: fix pause handling
...
1. There is no such thing as libvirt_domain.pause().
2. libvirt_domain.state() returns [state, reason]
2016-08-09 05:14:12 +02:00
Marek Marczykowski-Górecki
3f6c96ee39
qubes/vm: fix handling autostart set/reset
...
1. Service symlink must have ".service" extension
2. Disable service on property reset to default
2016-08-09 05:14:09 +02:00
Marek Marczykowski-Górecki
5b4e30524a
qubes/vm: remove duplicated check for duplicate name on rename
2016-08-09 03:02:04 +02:00
Marek Marczykowski-Górecki
4e022382a5
Merge remote-tracking branch 'origin/master' into core3-devel
2016-08-08 00:11:46 +02:00
Wojtek Porczyk
288ff85731
Merge remote-tracking branch 'origin/pull/48/head' into core3-devel
2016-08-03 18:25:02 +02:00
Bahtiar `kalkin-` Gadimov
9d30bb132a
Fix umask
2016-08-03 02:57:44 +02:00
Bahtiar `kalkin-` Gadimov
0dd1875fb6
Add vm.shutdown(wait)
2016-08-01 15:09:28 +02:00
Wojtek Porczyk
ecb626d64b
qubes/vm/qubesvm: Simplify error message
2016-07-21 19:40:45 +02:00
Wojtek Porczyk
f915115cfb
Merge remote-tracking branch 'woju/pull/25/head' into core3-devel
2016-07-21 19:38:58 +02:00
Bahtiar `kalkin-` Gadimov
bcf1cfcb1f
Add qvm-clone(1)
2016-07-13 22:35:58 +02:00
Bahtiar `kalkin-` Gadimov
1f735669bc
Migrate qubes.vm modules to new API
2016-07-13 22:34:33 +02:00
Bahtiar `kalkin-` Gadimov
1cbabc79ff
qubes.vm.QubesVM use new storage api
2016-07-13 22:34:32 +02:00
Bahtiar `kalkin-` Gadimov
3952cef556
QubesVM serialize bool values from XML
2016-07-13 22:21:32 +02:00
Bahtiar `kalkin-` Gadimov
bba9b38e8e
Avoid libvirt access in qubes.vm.qubesvm.QubesVM
2016-07-13 22:21:30 +02:00
Bahtiar `kalkin-` Gadimov
de5487bf14
Dumb down qvm-remove
...
- Move `vm.is_halted()` check in to VMCollection.__delitem__()
- `vm.remove_from_disk()` will raise exception if is called on a running vm
2016-07-13 18:24:29 +02:00
Wojtek Porczyk
d28ab908cc
Network and storage fixes
2016-06-29 16:42:35 +02:00
Wojtek Porczyk
b53c572f1d
Merge remote-tracking branch 'woju/pull/23/head' into core3-devel
2016-06-28 15:19:57 +02:00
Wojtek Porczyk
c9accc258c
Merge remote-tracking branch 'woju/pull/15/head' into core3-devel
...
Conflicts:
qubes/storage/__init__.py
qubes/storage/file.py
qubes/vm/qubesvm.py
2016-06-28 15:15:00 +02:00
Bahtiar `kalkin-` Gadimov
7081bd433a
Make pylint happy
2016-06-23 14:23:34 +02:00
Bahtiar `kalkin-` Gadimov
0ab27d7426
qubes.vm.__init__ Remove unneeded time import
2016-06-23 14:23:33 +02:00
Bahtiar `kalkin-` Gadimov
b584d1a4bb
Remove QubesVM.is_netvm() and is_disposablevm()
2016-06-23 14:23:33 +02:00
Bahtiar `kalkin-` Gadimov
4a0b7585d1
Remove QubesVM.is_proxyvm()
2016-06-23 14:23:32 +02:00
Bahtiar `kalkin-` Gadimov
b0a7d0c283
Remove QubesVM.is_appvm()
2016-06-23 14:23:32 +02:00
Bahtiar `kalkin-` Gadimov
e08ca1ff57
Remove QubesVM.is_template()
2016-06-23 14:23:31 +02:00
Bahtiar `kalkin-` Gadimov
ba3b191702
QubesVM add docstrings & fix pylint errors
2016-06-23 14:23:31 +02:00
Bahtiar `kalkin-` Gadimov
a2668d81e3
QubesVM remove resize functions
2016-06-23 14:23:30 +02:00
Bahtiar `kalkin-` Gadimov
9132690eef
Add QubesVM.is_halted()
2016-06-23 14:23:24 +02:00
Bahtiar `kalkin-` Gadimov
bb2e6a2ad3
Add QubesVM.attached_volumes()
2016-06-23 13:16:09 +02:00
Bahtiar `kalkin-` Gadimov
09727b1cbd
Add Volume.internal field
...
- Linux kernel volumes are always internal volumes
2016-06-23 13:16:03 +02:00
Bahtiar `kalkin-` Gadimov
87ae5a3b65
Fix qvm-start
2016-06-21 17:44:35 +02:00
Bahtiar `kalkin-` Gadimov
d56f02598a
Replace QubesVM.verify_files() with Storage.verify_files()
2016-06-21 14:58:12 +02:00
Bahtiar `kalkin-` Gadimov
296fa17322
QubesVM remove obsolete *_img methods
2016-06-21 14:58:12 +02:00
Bahtiar `kalkin-` Gadimov
29633f43f8
qubes.vm.templatevm Add LICENSE & docstring
2016-06-16 17:11:49 +02:00
Bahtiar `kalkin-` Gadimov
91ee455a37
NetVMMixin add docstrings & fix pylint errors
2016-06-16 17:06:19 +02:00
Bahtiar `kalkin-` Gadimov
b77c36b224
Remove NetVMMixin.vif()
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
7ccba17a38
qubes.vm.__init__ Replace TODOs with SEE: #1815
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
ec9550c7cc
qubes.vm.__init__ Remove debug xml file creation
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
94d9fd040f
qubes.vm.__init__ Add docstrings
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
77d54b55ad
qubes.vm.__init__ Fix pylint warnings
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
f318871279
qubes.vm.__init__ Remove uses_custom_config bits
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
b5fe49f422
qubes.vm.__init__ Remove unneeded imports
2016-06-16 17:01:34 +02:00
Bahtiar `kalkin-` Gadimov
93e68a6796
qubes.vm.dispvm Fix XXX, add docstring & LICENSE
2016-06-16 17:01:33 +02:00
Bahtiar `kalkin-` Gadimov
d25c44ca71
qubes.vm.appvm Fix XXX, add docstrings & LICENSE
2016-06-16 17:01:33 +02:00
Bahtiar `kalkin-` Gadimov
0cd667a1f5
qubes.vm.adminvm fix XXX and add docstrings
2016-06-16 17:01:33 +02:00
Bahtiar `kalkin-` Gadimov
e5906df0c7
AdminVM remove get_private_img_sz
2016-06-16 16:59:27 +02:00
Bahtiar `kalkin-` Gadimov
a4577c0dce
Rename Storage.create_on_disk to Storage.create
2016-06-16 16:59:27 +02:00
Bahtiar `kalkin-` Gadimov
930fe417a8
Remove storage size and usage methods from QubesVM
2016-06-16 16:59:26 +02:00
Wojtek Porczyk
e47043ebd7
More pylint fixes
2016-06-16 13:29:16 +02:00
Wojtek Porczyk
3cb5f031a9
Fix storage initialisation
2016-06-16 13:29:15 +02:00
Wojtek Porczyk
1f302fb776
Fix "pylint fixes" wrt dir_path
2016-06-16 13:29:15 +02:00
Wojtek Porczyk
677a3e51f4
Move libvirt XML network device to jinja
2016-06-16 13:29:15 +02:00
Wojtek Porczyk
ba20254888
Rewrite PCI attaching/detaching from xl to libvirt
...
The only remaining part is querying vm-side BDF. That can't be done
in libvirt.
2016-06-16 13:29:15 +02:00
Wojtek Porczyk
6ade5736d7
pylint fixes
2016-06-10 21:27:29 +02:00
Wojtek Porczyk
6895f34a7f
qubes/vm/qubesvm: change type of exception
2016-06-10 21:27:29 +02:00
Wojtek Porczyk
5a76d0b03b
qubes/vm/dispvm: Add methods for creating and destroying
...
fixes QubesOS/qubes-issues#866
2016-06-02 19:55:42 +02:00
Wojtek Porczyk
476b681749
qubes/vm/qubesvm: return self from methods modifying state
...
This is helpful when writing oneliners.
QubesOS/qubes-issues#866
2016-06-02 17:17:05 +02:00
Wojtek Porczyk
a615a45ecd
Merge remote-tracking branch 'woju/pull/13/head' into core3-devel
2016-06-02 13:24:15 +02:00
Marek Marczykowski-Górecki
7e0af81ecc
qubes/vm: fix PCI device detach
2016-06-02 13:22:48 +02:00
Marek Marczykowski-Górecki
bb2e1f2870
qubes/vm: handle VM toplevel directory in QubesVM object not Storage
...
This directory is not only for disk images (in fact disk images may be
elsewhere depending on choosen volume pool), so it would be cleaner to
handle (create/remove) it directly in QubesVM class.
2016-06-02 13:22:07 +02:00
Marek Marczykowski-Górecki
ed6e69b77e
qubes/vm: minor
2016-06-02 13:14:19 +02:00
Marek Marczykowski-Górecki
2d8d78bebe
qubes/vm/standalonevm: set volume_config
...
Otherwise VM wouldn't have any hard disk...
2016-06-02 13:14:02 +02:00
Marek Marczykowski-Górecki
5b5f290c23
qubes/vm: fix setting autostart property
...
This is actually workaround for systemd bug reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1181922
qubesos/qubes-issues#925
This is migration of 9bfcb72722
commit to
core3.
2016-06-02 13:13:21 +02:00
Marek Marczykowski-Górecki
b37bf55f5e
qubes/vm: fix handling rename
...
Libvirt VM config is no longer named after VM.
2016-06-02 13:10:56 +02:00
Marek Marczykowski-Górecki
5e2b617c6f
qubes/vm: fix parameters for some even handlers
2016-06-02 13:10:43 +02:00
Marek Marczykowski-Górecki
2bb73ab0a1
qubes/vm: add validators for many properties
2016-06-02 13:10:28 +02:00
Marek Marczykowski-Górecki
36644f3710
qubes/vm: initialize vm.volumes in one place
...
Move it to QubesVM, instead of each class separately.
2016-06-02 13:10:02 +02:00
Marek Marczykowski-Górecki
ff78b26f66
qubes: implement offline mode
...
Apparently the most important (the only?) property required in offline
mode is "is_running". So let's patch it to return False and make sure
any other libvirt usage would result in failure.
Or maybe better simply returh False in vm.is_running, when libvirt
connection fails? But then it would not be possible to use offline mode
and have (some, probably unrelated) libvirtd running at the same time.
Fixes QubesOS/qubes-issues#2008
2016-06-02 12:41:26 +02:00
Marek Marczykowski-Górecki
c965024287
qubes/vm: Implement Disposable VM
...
Implement DispVM as a VM based on AppVM.
QubesOS/qubes-issues#866
2016-06-02 12:37:19 +02:00
Marek Marczykowski-Górecki
b24ab45d00
qubes/vm: fix network attach/detach
2016-06-02 12:28:53 +02:00
Bahtiar `kalkin-` Gadimov
3f5a92772a
A QubesVM always has an empty DomainPool
...
- A DomainPool is initialized by QubesVM after Storage initialization on a
`domain-load` event
2016-05-22 22:09:56 +02:00
Bahtiar `kalkin-` Gadimov
8959e5a77e
Implement qvm-remove
...
- Remove old qvm-remove
- Remove a log line from Storage, because it prints confusing lines, like:
Removing volume kernel: /var/lib/qubes/vm-kernels/4.1.13-6/modules.img
2016-05-21 01:35:30 +02:00
Wojtek Porczyk
786884ad7a
qubes: fix netvm properties and tests
...
fixes QubesOS/qubes-issues#1816
2016-05-19 03:02:23 +02:00
Wojtek Porczyk
63c09a090c
qubes: Combat import cycles
...
This commit eliminates import statements happening in the middle of the
file (between two classes definition). The cycles are still there. The
only magic module is qubes itself.
2016-05-05 14:33:09 +02:00
Bahtiar `kalkin-` Gadimov
29f4be0f10
If vm doesnt support volume_config raise TypeError
2016-04-25 07:17:21 +02:00
Bahtiar `kalkin-` Gadimov
d7ff4b9057
Move volume xml config from QubesVM to Volume
2016-04-25 07:17:20 +02:00
Bahtiar `kalkin-` Gadimov
49b4951389
Storage move rename() logic to XenPool
...
- Fix config renaming
2016-04-25 07:17:20 +02:00
Bahtiar `kalkin-` Gadimov
2c2a778a1d
Serialize volume_config from qubes.xml
2016-04-25 07:17:19 +02:00
Bahtiar `kalkin-` Gadimov
fe6a35155e
Move kernel file checks to LinuxKernel pool
2016-04-25 07:17:19 +02:00
Bahtiar `kalkin-` Gadimov
5f7cb41a21
Move Storage.clone_disk_files logic to XenPool
...
- Add XenVolume to identify volumes which can be cloned even if they are not in
the same pool
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
973c83cedd
Move most resize logic to XenPool
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
bdfb85ac19
Refactor Storage, Pool and XenPool
...
- Remove all *_dev_config methods
- Checks if a storage image exists moved to XenPool
- Storage.remove wraps Pool.remove()
- Stop volumes on domain sutdown/kill
- Warn when using deprecated methods
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
32255a7916
Reverted Storage ←→ Pool dependency
...
- Storage() operates on a pool and in future on multiple pools
2016-04-25 07:17:16 +02:00
Bahtiar `kalkin-` Gadimov
9d646aabd3
Add volume_config to AppVM and TemplateVM
2016-04-25 07:17:13 +02:00