Commit Graph

150 Commits

Author SHA1 Message Date
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
Wojtek Porczyk
2b0ad51b18 Merge remote-tracking branch 'origin/pull/68/head' into core3-devel 2016-11-15 17:41:47 +01:00
Bahtiar `kalkin-` Gadimov
5db67fca8d
Fix init property swap in DomainVolumes 2016-11-07 23:26:53 +01:00
Marek Marczykowski-Górecki
b59463e8e8
qvm-block: fix listing non-internal volumes
In case of LVM (at least), "internal" flag is initialized only when
listing volume attached to given VM, but not when listing them from the
pool. This looks like a limitation (bug?) of pool driver, it looks like
much nicer fix is to handle the flag in qvm-block tool (which list VMs
volumes anyway), than in LVM storage pool driver (which would need to
keep second copy of volumes list - just like file driver).

QubesOS/qubes-issues#2256
2016-11-04 14:18:56 +01:00
Marek Marczykowski-Górecki
1a7f2892d1
storage/lvm: fix logic regarding snapshots, start, stop etc
There are mutiple cases when snapshots are inconsistently created, for
example:
 - "-back" snapshot created from the "new" data, instead of old one
 - "-snap" created even when volume.snap_on_start=False
 - probably more

Fix this by following volume.snap_on_start and volume.save_on_stop
directly, instead of using abstraction of old volume types.

QubesOS/qubes-issues#2256
2016-11-04 14:18:56 +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
4323651afb
storage/lvm: remove duplicated _reset function
There were two: _reset and _reset_volume. Neither of them was working,
but the later was closer. Remove the other one.

QubesOS/qubes-issues#2256
2016-11-04 14:18:55 +01:00
Marek Marczykowski-Górecki
37dbf29bc1
storage/lvm: don't fail on removing already removed volumes
This may happen when removing not fully created VM.

QubesOS/qubes-issues#2256
2016-11-04 14:18:55 +01:00
Marek Marczykowski-Górecki
400e92b25a
storage/lvm: misc fixes
- add missing lvm remove call when commiting changes
- delay creating volatile image until domain startup (it will be created
  then anyway)
- reset cache only when really changed anything
- attach VM to the volume (snapshot) created for its runtime - to not
  expose changes (for example in root volume) to child VMs until
  shutdown

QubesOS/qubes-issues#2412
QubesOS/qubes-issues#2256
2016-11-04 14:18:55 +01:00
Marek Marczykowski-Górecki
0471453773
storage/lvm: call lvm directly, don't use qubes-lvm wrapper
The wrapper doesn't do anything else than translating command
parameters, but it's load time is significant (because of python imports
mostly). Since we can't use python lvm API from non-root user anyway,
lets drop the wrapper and call `lvm` directly (or through sudo when
necessary).

This makes VM startup much faster - storage preparation is down from
over 10s to about 3s.

QubesOS/qubes-issues#2256
2016-11-04 14:18:55 +01:00
Marek Marczykowski-Górecki
9197bde76e
storage/lvm: use dd for importing volumes
...instead of manual copy in python. DD is much faster and when used
with `conv=sparse` it will correctly preserve sparse image.

QubesOS/qubes-issues#2256
2016-11-04 14:18:54 +01:00
Marek Marczykowski-Górecki
ae42308f5f
storage: improve handling volume export
1. Add a helper function on vm.storage. This is equivalent of:

    vm.storage.get_pool(vm.volumes[name]).export(vm.volumes[name])

2. Make sure the path returned by `export` on LVM volume is accessible.
2016-09-29 01:59:54 +02:00
Marek Marczykowski-Górecki
1af1784c69
Merge remote-tracking branch 'qubesos/pr/54' into core3-devel
* qubesos/pr/54:
  Fix file storage resize
  Fix lvm reset_cache size cache
2016-09-19 20:36:20 +02:00
Bahtiar `kalkin-` Gadimov
d63d93b0ab
Fix file storage resize 2016-09-05 16:56:57 +02:00
Bahtiar `kalkin-` Gadimov
d72448615d
Fix lvm reset_cache size cache 2016-09-04 23:25:39 +02:00
Marek Marczykowski-Górecki
2285789b49
Merge remote-tracking branch 'qubesos/pr/54' into core3-devel
* qubesos/pr/54:
  Volume add size property wrapper
2016-09-04 22:38:06 +02:00
Bahtiar `kalkin-` Gadimov
b863152f73
Volume add size property wrapper 2016-09-04 21:55:56 +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
ae72e294cd
Merge remote-tracking branch 'qubesos/pr/52' into core3-devel
* qubesos/pr/52:
  qvm-block extend Fix help message
  Fix a few typo bugs in qubes.storage.lvm
  qvm-block extends volumes to NEW_SIZE
  Make pylint happy ♥ qubes.storage.lvm
  Fix ThinVolume _size access
  qvm-block extend use qubes.utils.parse_size
  Make pylint happy ♥ qubes_lvm
  Fix lvm size/usage
  Add ThinPool.resize()
  Document qubes-block extend command in the manpage
  Fix file storage resize
  qvm-block add extend sub command
  qvm-block refactor attach/detach sub_parser init
2016-09-04 21:21:43 +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
0af5fdd267
qubes/storage/file: clone file images as normal user
No need to be root here.

QubesOS/qubes-issues#2256
2016-09-04 20:56:02 +02:00
Marek Marczykowski-Górecki
70d3f58024
qubes/storage: misc fixes for VM-exposed block devices handling
Add 'backenddomain' element when source (not target) domain is not dom0.
Fix XML elemenet name. Actually set volume.domain when listing
VM-exposed devices.

QubesOS/qubes-issues#2256
2016-09-03 20:41:02 +02:00
Bahtiar `kalkin-` Gadimov
e4433f9a65
Make pylint happy ♥ qubes.storage.lvm 2016-09-02 20:16:03 +02:00
Bahtiar `kalkin-` Gadimov
46eb4a72dd
Fix a few typo bugs in qubes.storage.lvm 2016-09-02 19:57:35 +02:00
Bahtiar `kalkin-` Gadimov
be48d48e56
Make pylint happy ♥ qubes.storage.lvm 2016-09-02 19:46:11 +02:00
Bahtiar `kalkin-` Gadimov
8974b2cbc0
Fix ThinVolume _size access 2016-09-02 19:45:31 +02:00
Bahtiar `kalkin-` Gadimov
1ca3c00797
Fix lvm size/usage
- Uses a size_cache, because it's faster than doing a call for each volume
2016-08-29 00:15:47 +02:00
Bahtiar `kalkin-` Gadimov
0561dfce60
Add ThinPool.resize() 2016-08-29 00:13:50 +02:00
Bahtiar `kalkin-` Gadimov
e7caa14a85
Fix file storage resize 2016-08-29 00:09:55 +02:00
Bahtiar `kalkin-` Gadimov
355ea0c2a8
Fix lvm AppVM startup from lvm 2016-08-29 00:05:19 +02:00
Bahtiar `kalkin-` Gadimov
24bbc971b0
qubes.storage.lvm.qubes_lvm use debug not info 2016-08-29 00:05:19 +02:00
Bahtiar `kalkin-` Gadimov
e0bf4bdb8e
Fix qvm-create lvm based AppVM 2016-08-29 00:05:18 +02:00
Marek Marczykowski-Górecki
06f46243ec
qubes/storage: add resize to Pool API
It was already implemented by FilePool and used by Storage object, but
wasn't included in base class.
2016-08-18 11:42:00 +02:00
Marek Marczykowski-Górecki
42d6fddcd3
qubes/storage: support on-line resize
Call `qubes.ResizeDisk` qrexec service after resizing volume, to adjust
filesystem size there.
2016-08-18 11:40:38 +02:00
Marek Marczykowski-Górecki
6e383c703d
qubes/storage: allow passing just volume name to storage.resize
It makes much more sense to call:

    vm.storage.resize('private', 10000000000)

instead of:

    vm.storage.resize(vm.volumes['private'], 10000000000)
2016-08-17 22:42:15 +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
6490767278
qubes/storage: update vm.storage.commit
Better name it 'commit', as it isn't only for template. And also fix to
call `pool.commit`
2016-08-09 05:14:11 +02:00
Bahtiar `kalkin-` Gadimov
02c8fc999c
ThinPool.import() skips not saveable volumes 2016-08-03 02:57:46 +02:00
Bahtiar `kalkin-` Gadimov
064629b63a
Fix qubes.lvm _reset 2016-08-03 02:57:44 +02:00
Bahtiar `kalkin-` Gadimov
9d30bb132a
Fix umask 2016-08-03 02:57:44 +02:00
Bahtiar `kalkin-` Gadimov
824c359319
Fix ThinPool revision handling 2016-08-03 02:57:43 +02:00
Bahtiar `kalkin-` Gadimov
3ae6530cd8
Add lvm thin pool storage implementation 2016-08-03 02:57:42 +02:00
Bahtiar `kalkin-` Gadimov
1467f1ede5
Storage add clone support 2016-07-13 22:35:57 +02:00
Bahtiar `kalkin-` Gadimov
95fed1eb71
qubes.linux.kernel use new storage api 2016-07-13 22:34:34 +02:00
Bahtiar `kalkin-` Gadimov
f60ccb235d
qubes.storage.domain use new storage API 2016-07-13 22:34:34 +02:00
Bahtiar `kalkin-` Gadimov
d1c606b952
qubes.storage.file use new storage API 2016-07-13 22:34:33 +02:00
Bahtiar `kalkin-` Gadimov
7e1563c88d
Add handling for old volume config 2016-07-13 22:34:31 +02:00
Bahtiar `kalkin-` Gadimov
1bccb146d8
Add qubes.storage.isodate() helper function 2016-07-13 22:34:31 +02:00
Bahtiar `kalkin-` Gadimov
7841e3f6c0
qubes.storage rework api 2016-07-13 22:34:30 +02:00