Commit Graph

327 Commits

Author SHA1 Message Date
Bahtiar `kalkin-` Gadimov
e446e7a2f4
Rename qubes.devices.BlockDevice to qubes.storage.BlockDevice
Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 23:49:36 +02:00
Bahtiar `kalkin-` Gadimov
990cfd8ab9
Migrate DeviceCollection to new API
- Use PersistentCollection as _set()
- attach/detach expect DeviceAssignment as parater
- attached(persistent=True) is now persistent()
- attached() returns all attached devices
- assigned() returns all attached device assignments

`#	modified:   templates/libvirt/xen.xml

Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 18:05:28 +02:00
Marek Marczykowski-Górecki
96db9a46d1 Fix start-related asyncio integration
cherry-picked commit 05fc3a4
2017-04-07 17:46:54 +02:00
Wojtek Porczyk
3bc4ec1e98 add mock libvirtaio module + pylint fixes 2017-04-05 17:06:45 +02:00
Wojtek Porczyk
64d358562b qubes: revert async def, use @asyncio.coroutine
Current pylint (any released version) stumbles on async def'ined
functions. Let's use @asyncio.coroutines for now.

Seems like python-3.5 is not that mature yet.

QubesOS/qubes-issues#2622
QubesOS/qubes-issues#2738
PyCQA/pylint#1126
2017-04-05 17:05:52 +02:00
Wojtek Porczyk
78693c265c qubes/vm/qubesvm: rework QubesVM.run*() methods
0) All those methods are now awaitable rather than synchronous.

1) The base method is run_service(). The method run() was rewritten
   using run_service('qubes.VMShell', input=...). There is no provision
   for running plain commands.

2) Get rid of passio*= arguments. If you'd like to get another return
   value, use another method. It's as simple as that.
   See:
      - run_service_for_stdio()
      - run_for_stdio()

   Also gone are wait= and localcmd= arguments. They are of no use
   inside qubesd.

3) The qvm-run tool and tests are left behind for now and will be fixed
   later. This is because they also need event loop, which is not
   implemented yet.

fixes QubesOS/qubes-issues#1900
QubesOS/qubes-issues#2622
2017-04-05 17:05:22 +02:00
Wojtek Porczyk
1b9479837a Merge remote-tracking branch 'marmarek/core3-mgmt-methods1' into core3-devel
Conflicts:
	qubes/mgmt.py
2017-04-01 18:33:54 +02:00
Wojtek Porczyk
cce809c2cb qubes/vm/qubesvm: async def start
QubesOS/qubes-issues#2622
2017-03-30 23:04:55 +02:00
Marek Marczykowski-Górecki
ce3bedbf2c
vm: move validate_name to qubes/vm
This will be needed by VMProperty class in the next commit.

QubesOS/qubes-issues#2622
2017-03-28 21:04:05 +02:00
Marek Marczykowski-Górecki
da51e6f032
vm/qubesvm: add validator for default_user property
Don't allow characters potentially interfering with qrexec. To be on the
safe side, allow only alphanumeric characters + very few selected
punctuations.
2017-03-16 20:04:03 +01:00
Marek Marczykowski-Górecki
0f8fab088e
vm/qubesvm: remove pool_name property
It isn't used anywhere - in core3 each storage volume have pool assigned
- which may be different for each volume.
2017-03-16 20:04:03 +01:00
Marek Marczykowski-Górecki
123feced36
vm/qubesvm: forbid '/' in kernel property
It would give VM access to some files outside of
/var/lib/qubes/vm-kernels.
2017-03-16 20:04:02 +01:00
Marek Marczykowski-Górecki
a036e2a8a0
vm/qubesvm: improve name property setter
Split it into two functions: validate_name - context-less verification,
and actual _setter_name which perform additional verification in
context of actual VM.
Switch to qubes.exc.* exceptions where appropriate.
2017-03-16 20:04:02 +01:00
Marek Marczykowski-Górecki
3b36e92b6d
vm/qubesvm: fix few more keyword arguments for events 2017-03-16 20:04:02 +01:00
Marek Marczykowski-Górecki
772293d0b5
vm/qubesvm: define 'updateable' as qubes.property
This will allow property being accessed through management API
2017-03-16 20:04:01 +01:00
Marek Marczykowski-Górecki
f7d73893d7
qubes/storage: py3k related fixes 2017-03-01 21:50:06 +01:00
Marek Marczykowski-Górecki
570cbe5225
qubes: py3k related fixes 2017-02-27 02:37:45 +01:00
Wojtek Porczyk
be53db4db9 qubes/events: they accept only keyword arguments
Positional arguments are hereby deprecated, with immediate effect.

QubesOS/qubes-issues#2622
2017-02-21 14:46:42 +01:00
Marek Marczykowski-Górecki
bcab92ee64
qubes/vm: make sure to close qmemman socket after failed startup
If qmemman socket isn't closed, it will block other VM startups.
2017-02-14 23:59:07 +01:00
Wojtek Porczyk
1be75d9c83 misc python3 fixes 2017-02-07 17:07:52 +01:00
Wojtek Porczyk
d74567d65f qubes: port core to python3
fixes QubesOS/qubes-issues#2074
2017-01-20 16:42:51 +01:00
Marek Marczykowski-Górecki
8f443547fb
qubes/vm: disconnect from old QubesDB when going to start new instance
QubesDB daemon no longer remove socket created by new instance, so one
part of VM restart race condition is solved. The only remaining part is
to ensure that we really connect to the new instance, instead of talking
to the old one (soon to be terminated).

Fixes QubesOS/qubes-issues#1694
2016-11-26 04:09:00 +01:00
Marek Marczykowski-Górecki
1418555346
qubes/vm: don't fail on removing VM without files
VM files may be already removed. Don't fail on this while removing a
VM, it's probably the reason why domain is being removed.

qvm-remove tool have its own guard for this, but it isn't enough - if
rmtree(dir_path) fails, storage.remove() would not be called, so
non-file storages would not be cleaned up.

This is also needed to correctly handle template reinstallation - where
VM directory is moved away to call create_on_disk again.

QubesOS/qubes-issues#2412
2016-11-26 04:08:07 +01:00
Wojtek Porczyk
37bfd0d2a3 Merge remote-tracking branch 'marmarek/core3-fake-ip' into core3-devel 2016-11-15 17:40:30 +01:00
Wojtek Porczyk
a4d50409df Merge remote-tracking branch 'marmarek/core3-storage-fixes' into core3-devel 2016-11-15 17:36:53 +01:00
Marek Marczykowski-Górecki
ab9d7fbb76
storage: improve/fix handling extra volumes
Just calling pool.init_volume isn't enough - a lot of code depends on
additional data loaded into vm.storage object. Provide a convenient
wrapper for this.

At the same time, fix loading extra volumes from qubes.xml - don't fail
on volume not mentioned in initial vm.volume_config.

QubesOS/qubes-issues#2256
2016-11-04 14:18:56 +01:00
Marek Marczykowski-Górecki
2c6c476410
qubes/vm/net: add feature of hiding real IP from the VM
This helps hiding VM IP for anonymous VMs (Whonix) even when some
application leak it. VM will know only some fake IP, which should be set
to something as common as possible.
The feature is mostly implemented at (Proxy)VM side using NAT in
separate network namespace. Core here is only passing arguments to it.
It is designed the way that multiple VMs can use the same IP and still
do not interfere with each other. Even more: it is possible to address
each of them (using their "native" IP), even when multiple of them share
the same "fake" IP.

Original approach (marmarek/old-qubes-core-admin#2) used network script
arguments by appending them to script name, but libxl in Xen >= 4.6
fixed that side effect and it isn't possible anymore. So use QubesDB
instead.

From user POV, this adds 3 "features":
 - net/fake-ip - IP address visible in the VM
 - net/fake-gateway - default gateway in the VM
 - net/fake-netmask - network mask
The feature is enabled if net/fake-ip is set (to some IP address) and is
different than VM native IP. All of those "features" can be set on
template, to affect all of VMs.
Firewall rules etc in (Proxy)VM should still be applied to VM "native"
IP.

Fixes QubesOS/qubes-issues#1143
2016-10-31 02:06:01 +01:00
Wojtek Porczyk
3553b2e1d4 Make pylint happy 2016-10-25 17:27:02 +02:00
Wojtek Porczyk
8edbf0e406 qubes: Document all the events
fixes QubesOS/qubes-issues#1811
2016-10-25 17:11:38 +02:00
Marek Marczykowski-Górecki
9395e8fc33
storage: set only 'default' pool when creating VM on custom one
Do not replace 'linux-kernel' pool for example.
2016-09-29 01:59:54 +02:00
Marek Marczykowski-Górecki
e01f7b97d9
qubes/vm: plug in new firewall code, create QubesDB entries
QubesOS/qubes-issues#1815
2016-09-19 20:36:31 +02:00
Marek Marczykowski-Górecki
8b408a7a70
qubes/vm: minor formating 2016-09-13 02:15:25 +02:00
Marek Marczykowski-Górecki
a2d9b15413
qmemman: support simple VM meminfo format
Instead of excerpt from /proc/meminfo, use just one integer. This make
qmemman handling much easier and ease implementation for non-Linux OSes
(where /proc/meminfo doesn't exist).

For now keep also support for old format.

Fixes QubesOS/qubes-issues#1312
2016-09-08 04:17:48 +02:00
Marek Marczykowski-Górecki
aa0674e8bb
qubes/vm: make VM QubesDB interface as much compatible as possible
All the base keys can be kept easily the same, so do it.

QubesOS/qubes-issues#1812
2016-09-08 04:17:48 +02:00
Marek Marczykowski-Górecki
d5a41e838f
Revert "qubes/vm/qubesvm: remove prefixes from qubesdb keys"
There is no point in changing *public API* for just a change without any
better reason. It turned out most of those settings will be the same in
Qubes 4.0, so keep names the same.

This reverts commit 2d6ad3b60c.

QubesOS/qubes-issues#1812
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Bahtiar `kalkin-` Gadimov
428dd5bc1b QubesVM.dir_path is set independent of storage 2016-04-25 07:16:37 +02:00
Bahtiar `kalkin-` Gadimov
cc7dd625d9 Loop over QubesVM.block_devices in libvirt xml 2016-04-25 07:16:36 +02:00
Bahtiar `kalkin-` Gadimov
ebb79e9c4f Fix TC_01_Properties/test_030_rename_conflict_app 2016-04-20 14:02:04 +02:00
Bahtiar `kalkin-` Gadimov
6aac0a5732 On startup-failure only force_shutdown if running
This avoids losing the exception if an exception is raised in
self.force_shutdown(), because the vm is not running or paused
2016-04-20 13:59:17 +02:00
Wojtek Porczyk
fe8fdb264b qubes/vm/qubesvm: move is_guid_running to GUI extension 2016-04-20 13:54:56 +02:00
Marek Marczykowski-Górecki
8c6fe7ed90
Merge remote-tracking branch 'origin/master' into core3-devel-mm 2016-04-11 13:03:12 +02:00
Marek Marczykowski-Górecki
424d3054f3 backup: use vm.features to store backup-specific metadata
Do not keep them in system qubes.xml.
2016-04-07 13:21:00 +02:00
Marek Marczykowski-Górecki
e8f21929ad backup: by default include all the VMs with vm.include_in_backups
If there is a need for more robust default, it should be handled at that
property.
2016-04-07 13:21:00 +02:00
Marek Marczykowski-Górecki
45d6ab3862 qubes/vm: store libvirt config in libvirt.xml, fix rename handling 2016-04-07 13:03:46 +02:00
Marek Marczykowski-Górecki
7cbe2dbd38 qubes/vm: add passio_stderr argument to vm.run_service
This allows getting error messages from service call, to provide more
meaningful error messages.
2016-04-07 12:58:05 +02:00
Marek Marczykowski-Górecki
15e032cddb qubes/vm: fix handling "None" kernel
The "None" value still makes sense for HVM domains.
2016-03-21 11:44:59 +01:00
Wojtek Porczyk
04cc2099f7 HVM part 2 2016-03-21 11:44:54 +01:00
Marek Marczykowski-Górecki
8da7416f30 vm: Remove reference to old libvirt config template
This file isn't installed anymore
2016-03-21 11:44:54 +01:00
Wojtek Porczyk
5eaf03c4a2 HVM part 1 2016-03-21 11:44:46 +01:00
Wojtek Porczyk
d766b8e110 qubes: Fix "unify event names" 2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
736773dbec vm: remove obsolete firewall handling code
There is no vm.write_iptables_xenstore_entry().

QubesOS/qubes-issues#1815
2016-03-21 11:43:33 +01:00
Wojtek Porczyk
0f9ca47d90 qubes/ext/guid: Move gui-related code to extension 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
75dd882b83 qubes: Unify event names
Events will be named <object>-[pre-]-<verb>, where verb is in infinitive
form.
2016-03-21 11:43:32 +01:00
Wojtek Porczyk
d09bd5ab6a qubes: Convert QubesVM and Extension discovery to pkg_resources
QubesOS/qubes-issues#1238
2016-03-21 11:43:32 +01:00
Wojtek Porczyk
93686eae06 qubes/vm: change services to features 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
bf78e662f6 Import qubesdb from the new module
fixes QubesOS/qubes-issues#1252
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
5375dce90d Prefer human readable output in qvm-prefs and qubes-prefs tools 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
e3c94f3949 core: fix handling numeric label value set
Not sure if it should be supported this way, but surely it shouldn't
throw AttributeError.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
9633573408 core: adjust units comment for host.memory_total, and fix related places
QubesOS/qubes-issues#1737
2016-03-03 01:18:16 +01:00
Wojtek Porczyk
88a63cbe3a qubes/vm/qubesvm: do not clone VM-specific properties
This is reworked
    core: do not clone VM-unique identifiers in clone_properties
by Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2cbbe0bdb6 core: abandon 'kernels' in VM directory
Since we have PV Grub now (which is much more convenient), it is useless
now.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
9428c70d31 core: fix vm.create_on_disk
QubesOS/qubes-issues#
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
62759fb1f6 core: move maxmem default initialization to property itself
Also fix (for now?) units - memory_total is int bytes while maxmem in
megabytes.

QubesOS/qubes-issues#1737
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2f3762ee68 core: minor fixes in handling properties
Conflicts:
	qubes/vm/qubesvm.py
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
ab469e4473 vm: fix calling monitor layout notifier 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
926596cba7 Initialize vm.storage after loading all the properties
It needs at least vm.name to be set.
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
3af71ab65d storage: fix handling netvm and adminvm
@woju what was consensus on 'servicevms' dir? Since "being network
provider" is no longer separate type and can be changed during VM
lifetime, maybe we should abandon that idea? Or maybe just set it as VM
property (some storage pool config argument) - that way mgmt stack could
put all the sys-* VMs into separate directory, regardless of the type.
2016-03-03 01:18:06 +01:00
Wojtek Porczyk
c47e29ed50 Fix most errors from pylint 2016-03-03 01:14:54 +01:00
Wojtek Porczyk
9eafa57539 Merge remote-tracking branch 'marmarek/master' into core3-devel
The following list is bollocks. There were many, many more.

Conflicts:
    core-modules/003QubesTemplateVm.py
    core-modules/005QubesNetVm.py
    core/qubes.py
    core/storage/__init__.py
    core/storage/xen.py
    doc/qvm-tools/qvm-pci.rst
    doc/qvm-tools/qvm-prefs.rst
    qubes/tools/qmemmand.py
    qvm-tools/qvm-create
    qvm-tools/qvm-prefs
    qvm-tools/qvm-start
    tests/__init__.py
    vm-config/xen-vm-template-hvm.xml

This commit took 2 days (26-27.01.2016) and put our friendship to test.
    --Wojtek and Marek
2016-03-03 01:13:51 +01:00
Wojtek Porczyk
2d6ad3b60c qubes/vm/qubesvm: remove prefixes from qubesdb keys 2016-03-03 00:46:05 +01:00
Wojtek Porczyk
01319e391f qubes: port netvm
From now, there are no separate NetVM and ProxyVM class, but property
"provides_network".
2016-03-03 00:46:05 +01:00
Wojtek Porczyk
689dd64b0d qubes: misc pylint fixes 2015-12-29 22:04:00 +01:00
Wojtek Porczyk
bf4dbe07d5 qubes/tests/vm/qubesvm: add basic tests for QubesVM
And already one fix to instantiation.
2015-12-29 20:35:04 +01:00
Wojtek Porczyk
69e0b94c74 Fix for UUID management
This fixes up 75c3f355db "qubes/vm/qubesvm: fix domain's UUID management".

Previously 'domain-init' was never really fired.

fixes QubesOS/qubes-issues#1557
2015-12-29 03:50:35 +01:00
Wojtek Porczyk
f1a0b1af39 qubes/tools: add qvm-run, qvm-{,un}pause
Also change convention of calling main(): now command returns its
numeric value instead of bool.

Also fixed QSB#13

fixes QubesOS/qubes-issues#1226
2015-12-29 03:43:08 +01:00
Wojtek Porczyk
96efb4568a core3: add different exceptions
From now on there are different exceptions which can be raise on
different occasions.

fixes QubesOS/qubes-issues#1279
2015-10-17 00:17:12 +02:00
Wojtek Porczyk
ea44c0acf3 qubes: pylint fixes
Fix bunch of errors and warnings.
2015-10-05 23:49:39 +02:00
Wojtek Porczyk
c9cbf8ffe2 core3: fix mounting modules.img 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
3724d6fca1 qubes/vm/qubesvm: fix core2 compatibility 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
75c3f355db qubes/vm/qubesvm: fix domain's UUID management
Now we generate UUID on domain's instantiation. This is needed, because
we sometimes don't update XML (like in qvm-start).

fixes QubesOS/qubes-issues#1236
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
6f4951d08a install python package with setuptools 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
ce60915fb0 qvm-ls: fix listing domains and labels 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
b4d51b016b core3: some properties can be set only once
Some properties should not be changed by user at will (like UUID). The
solution is to make them write-once, so they will be set when loading
from XML and frozen for the lifespan of the object holding the property.
When desperately needed, users may edit XML by hand.

fixes QubesOS/qubes-issues#1235
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
a017d78174 Dumb down dir_path property
From now, dir_path cannot be set and is calculated from domain's class
and name.

fixes QubesOS/qubes-issues#1234
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
12329e7b35 qubes/vm/qubesvm: fix log initialisation 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
af1a6a49bd qvm-ls: fix printing label 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
0fbee4dc10 core3: more fixes 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
80d664441d core3: fixes from Marek
This is adapted from commit 90a50dca406e3d40c88ea338566e0460589df7a3.
2015-10-05 12:46:13 +02:00
Wojtek Porczyk
e9b998400d qubes/vm/qubesvm: fix __init__ wrt .storage attr 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
84eb082ed2 qubes/vm/qubesvm: fix label setting/loading 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
7886695c63 qubes/vm/qubesvm: fix qid setter to accept str
Mainly for loading from XML.
2015-06-29 17:39:29 +02:00
Wojtek Porczyk
f2d9d628c4 qubes/vm/qubesvm: Fix loading/instantiating 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
6a4820c381 qubes/tools: qvm-ls 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
e83d21c671 qubes: more documentation and doc fixes 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
5d9b92a039 qubes: pylint fixes (minor programming errors) 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
6798790e1f qubes: pylint fixes (fix signatures) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
8d3edbf133 qubes/vm: fix kernels_dir 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
adb144acfe qubes: pylint fixes (small mistakes and wrong names) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
4a85c823c3 qubes: pylint fixes (qualify imported variables) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
bf29d5e5b5 qubes: pylint fixes (disable unfounded messages) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
ac1739df6b qubes: pylint fixes (fix imports) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
ee06e7d7a2 qubes: documentation and licence fixes 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
cdc3df66c8 qubes: pylint fixes (mostly whitespace) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
d937d39c9e qubes: fix Qubes instantiation 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
8e16dd2b28 qubes/storage: fix storage instantiation 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
8afba4c5e9 core3 move: storage/* 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
04c221e924 qubes/vm/qubesvm: fix env manipulation on qrexec-daemon start 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
af154b53fe qubes: change names of XML generating methods
Methods returning lxml.etree.Elements are called xml_ or lvxml_, meant for
qubes.xml or libvirt respectively.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:26 +02:00
Wojtek Porczyk
92eca8edb9 qubes: Fix comments accross the code
Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
091ffa5444 qubes: Add parser for property docstring
From now, docstrings in properties cannot contain sphinx-specific features,
because there is no sphinx in dom0.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
c0e3281d04 qubes: fix changing domain name
Changing name of running VM is wrong.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
1deb3221c7 qubes: fix netvm semantics WRT default values
Automatic acquiring default*_netvm, default_template and {clock,update}vm is no
more. This will be moved to firstboot. Advanced users (those, who elect not to
autoconfig their initial VMs) will have to deal with that.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
41fef46db2 core3 move: QubesVM
This is a big commit and probably incomplete. Tests will follow.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
b623a71d87 core3 move: QubesVmCollection
This got split to qubes.Qubes and qubes.VMCollection.
From now on, VMCollection is a stupid bag. Some parts went elsewhere.
2015-06-29 17:39:23 +02:00
Wojtek Porczyk
65595e3b39 apidoc stub 2015-06-29 17:39:22 +02:00
Wojtek Porczyk
7f27d987cc import framework for core3 2015-06-29 17:39:22 +02:00