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
27d0e11872
qubes/tests/vm: fix tests
2016-06-02 15:46:01 +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
485e75091b
tests: fix checking rename
2016-06-02 13:22:43 +02:00
Marek Marczykowski-Górecki
077dec8d2e
tests: fix rename test
2016-06-02 13:22:40 +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
28591fa6be
tests: remove/skip some tests
...
1. It is unclear yet whether dispvm_netvm will be implemented in core3, but
probably not.
2. Remove tests for setting memory/cpu above host resouces - rejecting
those values at property set time would break backup restore on some
machines (when migrating from bigger to smaller system).
2016-06-02 13:09:39 +02:00
Marek Marczykowski-Górecki
bf0966bfcf
tests: fix get_label mockup to return meaningful values
...
Reject invalid argument.
2016-06-02 13:08:48 +02:00
Marek Marczykowski-Górecki
98115eb541
tests/backup: fix to core3 API - there is no verbose= argument
2016-06-02 13:08:03 +02:00
Marek Marczykowski-Górecki
0a21300872
qubes/storage: unify _remove_if_exists argument type
...
In some places full volume object was called, in others - just file
path. Since this function is also used in some volume init/teardown, use
path everywhere.
2016-06-02 13:07:35 +02:00
Marek Marczykowski-Górecki
574834ac68
qubes/core2migration: rework load order
...
To successfully load all the data, proceed in order:
- set app.default_kernel
- load all templates
- set app.default_template
- load other VMs
- update network dependencies between VMs
- set other global properties
2016-06-02 12:44:31 +02:00
Marek Marczykowski-Górecki
554a99610f
qubes/core2migration: use app.load_initial_values
...
Reduce code duplication.
2016-06-02 12:43:25 +02:00
Marek Marczykowski-Górecki
692f75353e
qubes/app: split initialising empty Qubes object from saving it
...
It may be useful to create fresh Qubes() object but not save it yet
before setting other things. One such case is migration from core2.
2016-06-02 12:42:37 +02:00
Marek Marczykowski-Górecki
2909d252d6
backup: get_fisk_usage is now in storage.file
2016-06-02 12:41:59 +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
b119b2c36b
storage/file: simplify search for origin volume of snapshot/read-only
...
Check directly vm.template, throwing AttributeError when not found.
There may be some value in converting it to more descriptive error, but
since that's mostly for internal users (not user facing actions) don't
bother for now.
QubesOS/qubes-issues#1842
2016-06-02 12:38:07 +02:00
Marek Marczykowski-Górecki
07b72ef3fd
tests: fix after moving VMCollection to qubes.app
2016-06-02 12:37:30 +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
54c70766a4
qubes/storage: allow snapshots of snapshots
...
It may make sense to create 'snapshot' volume out of already 'snapshot',
not only 'origin'. In pracice it will exactly the same as 'snapshot
connected directly to 'origin'.
QubesOS/qubes-issues#866
2016-06-02 12:37:00 +02:00
Marek Marczykowski-Górecki
48176d51f1
qubes/storage: minor error message fix
2016-06-02 12:29:39 +02:00
Marek Marczykowski-Górecki
d80f34888d
qubes/storage: fix getting origin pool
...
volume_config parameter is about target volume, not origin.
QubesOS/qubes-issues#1842
2016-06-02 12:29:30 +02:00
Marek Marczykowski-Górecki
b24ab45d00
qubes/vm: fix network attach/detach
2016-06-02 12:28:53 +02:00
Marek Marczykowski-Górecki
3b407eb79e
qubes/app: do not enable domain events when loading XML
...
Event should be enabled only after all the domains are loaded (and
domain-load event if fired).
QubesOS/qubes-issues#1816
2016-06-02 12:28:14 +02:00
Bahtiar `kalkin-` Gadimov
17790c32bb
Fix DomainPool missing a continue
2016-06-01 17:28:55 +02:00
Bahtiar `kalkin-` Gadimov
90928dc4a0
qubes-pool skip DomainPools without volumes
2016-05-30 13:31:58 +02:00
Bahtiar `kalkin-` Gadimov
c8363cfc95
qvm-pool simplify options parsing
2016-05-30 13:31:57 +02:00
Bahtiar `kalkin-` Gadimov
27305dd85d
qvm-pool actions remove access to app
2016-05-30 13:31:56 +02:00
Bahtiar `kalkin-` Gadimov
ed1a6977c0
Qubes.add_pool() add name parameter
2016-05-30 13:31:55 +02:00
Bahtiar `kalkin-` Gadimov
d703f2f44b
Add qvm-pool and manpage for it
...
- Use full import paths in qvm-pool
- Add, Remove, Info and List options set `Namespace.command`. This fixes a crash
when `-o dir_path=/mnt/foo` is specified after `-a foo xen`.
- Remove `_List`
- Remove 'added pool' and 'removed pool' messages. Unix tools are quiet
- qvm-pool call app.save()
- Rename create_parser in get_parser
- Rename local_parser variables to just parser
- qvm-pool uses print_table
2016-05-30 13:31:54 +02:00
Bahtiar `kalkin-` Gadimov
9ef9575d4e
Fix typo in "No driver FOO for pool BAR" message
2016-05-30 13:31:54 +02:00
Bahtiar `kalkin-` Gadimov
357e8125eb
Add qubes.tools.PoolsAction
2016-05-30 13:31:53 +02:00
Bahtiar `kalkin-` Gadimov
0319df25e5
Add print_table function to qubes.tools
...
- print_table uses the `column` tool with the ASCII Unit Separator to print a
pretty table
2016-05-30 13:31:51 +02:00
Bahtiar `kalkin-` Gadimov
35974a5dbf
DomainPool check the untrusted data from qubes-db
2016-05-25 17:39:34 +02:00
Wojtek Porczyk
0484be518c
Merge remote-tracking branch 'woju/pull/12/head' into core3-devel
...
Conflicts:
doc/manpages/qvm-kill.rst
2016-05-25 11:01:19 +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
ddf040ae64
Do not serialize the domain pool config
2016-05-22 22:09:55 +02:00
Bahtiar `kalkin-` Gadimov
baaac858bc
Add DomainPool
...
- All domain pool volumes are removable volumes
- DomainVolume uses device name as vid
2016-05-22 22:09:54 +02:00
Bahtiar `kalkin-` Gadimov
e30f894df9
Add Volume.removable field
2016-05-22 21:42:27 +02:00
Bahtiar `kalkin-` Gadimov
116ba64e51
Storage.remove() catch IO/OSError and log it
2016-05-21 01:35:32 +02:00
Bahtiar `kalkin-` Gadimov
c5810758c5
FilePool fix origin volume removale
2016-05-21 01:35:31 +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
91f72dc56c
Rework argument checking when generating manpages
...
Add the ability to handle commands having subcommands, like `qvm-block`
Split the ArgumentCheckVisitor in an OptionsCheckVisitor &
SubCommandCheckVisitor. The OptionsCheckVisitor checks options given
in a section named 'Options' (case insensitive), while the
SubCommandCheckVisitor dispatches on a section named 'Commands' (case
insensitive).
This also fixes finding the undocumented command arguments. The previous
solution with depart_document did not work. NodeVisitor does not dispatch to
depart_document() even if it's mentioned in the documentation.
2016-05-21 01:25:14 +02:00
Bahtiar `kalkin-` Gadimov
e580131465
Add AliasedSubParsersAction
2016-05-21 01:25:13 +02:00
Bahtiar `kalkin-` Gadimov
910276e898
Rename want_vm_* in vmname_nargs
2016-05-21 01:24:17 +02:00
Bahtiar `kalkin-` Gadimov
d4c74d210f
Implement vmname parsing
2016-05-21 01:24:16 +02:00
Bahtiar `kalkin-` Gadimov
3549a9d4ec
Add VmNameGroup
2016-05-21 01:24:14 +02:00
Bahtiar `kalkin-` Gadimov
7fe827d858
Add VmNameAction
2016-05-21 01:24:13 +02:00
Bahtiar `kalkin-` Gadimov
c22d9e88c9
Add QubesAction
2016-05-21 01:24:12 +02:00
Wojtek Porczyk
e757444c35
qubes/tools/qvm-features: add tool for managing qvm-features
...
QubesOS/qubes-issues#1637
2016-05-19 03:02:24 +02:00
Bahtiar `kalkin-` Gadimov
a65b0edcd4
Add QubesArgumentParser.print_error()
2016-05-19 03:02:24 +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
d728f4b9ff
qubes/app: reconnect to libvirtd after crash
...
Sometimes libvirt crashes. After that the connection (and all
vm.libvirt_domain-s) were unusable.
fixes QubesOS/qubes-issues#990
2016-05-05 17:33:00 +02:00
Wojtek Porczyk
e3aae7bc17
qubes: Minor fixes
...
Fix mock TestApp object and argument parsing in qvm-run.
2016-05-05 16:58:43 +02:00
Wojtek Porczyk
c76790fbde
qubes/tests/vm/qubesvm: fix test for vm.internal
...
On flipping .internal vm (re)creates appmenus. They need label.
2016-05-05 14:38:04 +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
Wojtek Porczyk
f8270a07bb
qubes: add filename= argument to Qubes.save()
...
fixes QubesOS/qubes-issues#1846
2016-05-05 00:40:45 +02:00
Bahtiar `kalkin-` Gadimov
1d5b89f0d5
LinuxKernel keep track of own volumes
...
This is squashed woju/qubes-core-admin#8 by @kalkin
- LinuxKernel.volumes() lists all available kernels
- LinuxKernel use kernel version as vid
- LinuxKernel add docstrings
- Linux.kernel use os.listdir instead of os.walk
- LinuxKernel dynamically list available kernels
2016-05-04 17:21:05 +02:00
Bahtiar `kalkin-` Gadimov
7200e6153b
Rename default storage driver from xen to file
...
- Rename XenPool ⇒ FilePool
- Rename XenVolume ⇒ FileVolume
2016-04-30 20:42:46 +02:00
Bahtiar `kalkin-` Gadimov
b2c1017488
Fix missing parameter in Pool.__init__()
2016-04-30 20:42:00 +02:00
Wojtek Porczyk
7f2f4a4e75
Fix GUI extension
2016-04-27 15:27:01 +02:00
Bahtiar `kalkin-` Gadimov
04a3e80311
SizeMixIn first assert than call super()
2016-04-25 07:17:21 +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
37ca33b0d1
Add docstring to xen volumes implementations
2016-04-25 07:17:21 +02:00
Bahtiar `kalkin-` Gadimov
8f060a8746
Fix Pool and Volume __init__
2016-04-25 07:17:20 +02:00
Bahtiar `kalkin-` Gadimov
591134833b
Replace Volume.__str__ with enhanced __repr__
2016-04-25 07:17:20 +02:00
Bahtiar `kalkin-` Gadimov
04536c5950
Don't exec app.save() after add_pool & remove_pool
2016-04-25 07:17:20 +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
2e28849c90
Move pool xml config from Qubes to Pool
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
e3ae6cdc1b
BackupTestsMixin.create_backup_vms uses volumes
...
Instead of using root_img to access the path it uses now the proper volumes
2016-04-25 07:17:20 +02:00
Bahtiar `kalkin-` Gadimov
d7fd66070a
Fix revert template changes test
2016-04-25 07:17:19 +02:00
Bahtiar `kalkin-` Gadimov
8cc31e86a7
qvm-create handle --pool argument
2016-04-25 07:17:19 +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
ef485ca32a
Add linux-kernel to defaults['pool_config']
2016-04-25 07:17:19 +02:00
Bahtiar `kalkin-` Gadimov
62c81044c5
Add XenPool.setup/destroy
2016-04-25 07:17:18 +02:00
Bahtiar `kalkin-` Gadimov
97d04791b7
After add/remove_pool execute Pool.setup/destroy
2016-04-25 07:17:18 +02:00
Bahtiar `kalkin-` Gadimov
9674d03088
Add pool LinuxKernel
2016-04-25 07:17:18 +02:00
Bahtiar `kalkin-` Gadimov
d1a0542c85
Add XenPool.remove()
2016-04-25 07:17:18 +02:00
Bahtiar `kalkin-` Gadimov
a37fc2464a
Add XenPool.config()
2016-04-25 07:17:18 +02:00
Bahtiar `kalkin-` Gadimov
971c4ae91d
Add XenPool.driver field
2016-04-25 07:17:18 +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
3c66d4b54c
Fix storage_xen test
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
79ac3d3770
Fix storage test and simplify TestVM
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
88238c80f3
Add XenPool._reset_volume
2016-04-25 07:17:17 +02:00
Bahtiar `kalkin-` Gadimov
3dab5193c6
XenPool add snapshot handling
2016-04-25 07:17:16 +02:00
Bahtiar `kalkin-` Gadimov
792d94959f
Add implementations of xen volumes
2016-04-25 07:17:16 +02:00
Bahtiar `kalkin-` Gadimov
f02f9e3a41
Add XenPool init_volume
2016-04-25 07:17:16 +02:00
Bahtiar `kalkin-` Gadimov
4d4b846ce8
Replace XenStorage with XenPool
2016-04-25 07:17:16 +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