Commit Graph

4238 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
1939cf7ce8 backups: report exception on backup write error
This is only partial solution - this happens in separate thread so main
thread may not notice this problem (and simply will wait on work queue).
2013-12-02 14:04:20 +01:00
Marek Marczykowski-Górecki
bc92c20d67 core: do not truncate qubes.xml during save()
Save the next one in temporary file, then move over to destination file.
This way when writing the file to disk fails (e.g. out of disk space),
user still have old file version intact.
2013-12-02 03:50:55 +01:00
Marek Marczykowski-Górecki
93b7924bc6 backups: hide unwanted "next volume requests" from tar 2013-12-02 03:49:44 +01:00
Marek Marczykowski-Górecki
4ce3acd64d hvm: always use qrexec for clipboard operations
This is temporary solution until Windows GUI agent will handle
MSG_CLIPBOARD_* commands.

Also fix code style - wrap long lines
2013-12-02 03:47:49 +01:00
Marek Marczykowski-Górecki
e9f08aefd7 backups: disable debugging code 2013-12-01 02:35:42 +01:00
Marek Marczykowski-Górecki
27f6f0e64e Merge branch 'new-backups'
Conflicts:
	core-modules/000QubesVm.py
2013-11-29 04:00:58 +01:00
Marek Marczykowski-Górecki
79cbf3d06f Merge remote-tracking branch 'joanna/master' 2013-11-29 03:58:25 +01:00
Marek Marczykowski-Górecki
b73970c62d core: rename QubesDom0NetVm to QubesAdminVm
This is somehow related to #757, but only first (easier) step. Actual
change of QubesAdminVm base class requires somehow more changes, for
example qvm-ls needs to know how to display this type of VM (none of
template, appvm, netvm).

Make this first step change now, because starting with R2Beta3 dom0 will
be stored in qubes.xml (for new backups purposes) so this rename would
be complicated later.
2013-11-29 03:42:56 +01:00
Marek Marczykowski-Górecki
3d70402778 backups: add support for restoring old backup format
Actually the code is quite similar, so just add few "if" instead of
copying the whole functions.
2013-11-29 03:25:41 +01:00
Marek Marczykowski-Górecki
8cee6e22f4 dispvm:
Remove temp file if already existed. It could be created with different
owner, so unavailable for this process.
2013-11-27 03:22:24 +01:00
Marek Marczykowski-Górecki
eaebf04b34 backups: remove some old unneeded code 2013-11-27 03:21:17 +01:00
Marek Marczykowski-Górecki
c8b8cd0d1f backups: fix restore in non-debug mode 2013-11-27 03:20:45 +01:00
Marek Marczykowski-Górecki
105428accb backups: fix encrypted backup restore 2013-11-27 03:20:26 +01:00
Marek Marczykowski-Górecki
10100767da backups: hide VM names in encrypted backup
Even when encrypted backup is selected, file list isn't encrypted. Do
not leak VM names in the filenames.
2013-11-27 03:19:23 +01:00
Marek Marczykowski-Górecki
8bdea5b0ab backups: fix backup of selected appmenus for VM
This wasn't working for a long time...
2013-11-27 03:18:14 +01:00
Marek Marczykowski-Górecki
3c99ac1d07 Performance optimization regarding xenstore access
Reduce number of xenstore access during checking current domain XID.
2013-11-26 20:16:10 +01:00
Marek Marczykowski-Górecki
59b9e43060 Fix VM autostart - set $DISPLAY env variable
Without this, started qrexec-daemon would not have access to GUI,
especially can't display Qubes RPC confirmation dialogs.
2013-11-26 16:53:26 +01:00
Marek Marczykowski-Górecki
2d68b79bff backups: fix backup of templates
Template is saved as single archive of the whole VM directory. Preserve
backup directory structure regardless of its content - in this case it
means we need "." archive (with template directory content) placed in
"vm-tempates/<template-name>/" backup directory. This allows restore
process to select right files to restore regardless of VM type.
2013-11-26 16:46:34 +01:00
Marek Marczykowski-Górecki
50662bf090 backups: correctly calculate size of file to backup 2013-11-26 16:46:09 +01:00
Marek Marczykowski-Górecki
0b0d50edf3 backups: move import at the beginning of .py file 2013-11-26 16:45:51 +01:00
Joanna Rutkowska
78a2e72483 version 2.1.31 2013-11-25 22:59:33 +01:00
Joanna Rutkowska
473491032d Merge branch 'master' of git://git.qubes-os.org/marmarek/core-admin 2013-11-25 22:59:23 +01:00
Marek Marczykowski-Górecki
fa35b1dd55 qvm-tools: add --root-move-from/--root-copy-from options to qvm-create 2013-11-25 17:15:45 +01:00
Marek Marczykowski-Górecki
17c5d22083 qvm-tools: fix qvm-create --hvm* --root args parsing 2013-11-25 17:15:15 +01:00
Joanna Rutkowska
0f3b55df92 version 2.1.30 2013-11-25 15:08:21 +01:00
Joanna Rutkowska
bfc95bae78 Merge branch 'master' of git://git.qubes-os.org/marmarek/core-admin 2013-11-25 15:07:57 +01:00
Marek Marczykowski-Górecki
919b9455f8 qvm-tools: fix args parsing for qvm-create --hvm-template 2013-11-25 14:27:43 +01:00
Joanna Rutkowska
e88514aab7 version 2.1.29 2013-11-25 13:35:09 +01:00
Marek Marczykowski-Górecki
dc55720738 core: QubesTemplateHVm.is_appvm = False 2013-11-25 07:22:21 +01:00
Marek Marczykowski-Górecki
09393734a3 core: refuse to set template for standalone VM 2013-11-25 07:18:01 +01:00
Marek Marczykowski-Górecki
5033b53543 core: split HVM template into separate class 2013-11-25 07:18:01 +01:00
Marek Marczykowski-Górecki
0fcceb324d backups: fix appvm handling in qvm-backup-restore 2013-11-25 06:33:31 +01:00
Marek Marczykowski-Górecki
0743531244 backups: fix VM exclude logic (restore) 2013-11-25 06:33:06 +01:00
Marek Marczykowski-Górecki
bf6bf8ed8f backups: fix backup header extraction
Pass only 'qubes.xml.000' to tar2qfile - this way it will stop reading
the source after requested file(s).
2013-11-25 06:31:38 +01:00
Marek Marczykowski-Górecki
cc37927080 backups: fix backup cleanup 2013-11-25 05:46:57 +01:00
Marek Marczykowski-Górecki
d7e3f3cb0a backups: qvm-backup: check if /var/tmp have enough space 2013-11-25 05:43:15 +01:00
Marek Marczykowski-Górecki
3a898db663 backups: Prompt for password twice for verification 2013-11-25 05:42:47 +01:00
Marek Marczykowski-Górecki
c781a522d8 backups: move backup code to separate file
Also some major cleanups: Reduce some more code duplication
(verify_hmac, simplify backup_restore_prepare). Rename
backup_dir/backup_tmpdir variables to better match its purpose. Rename
backup_do_copy back to backup_do.  Require QubesVm object (instead of VM
name) as appvm param.
2013-11-25 05:41:13 +01:00
Marek Marczykowski-Górecki
657beaf655 backups: move extracted dom0 home from /var/tmp instead of copy 2013-11-25 01:11:29 +01:00
Marek Marczykowski-Górecki
e31c3ae8e7 backup: reduce volume size to 100M and limit queue length
This way backup process won't need more than 1GB for temporary files and
also will give more precise progress information. For now it looks like
the slowest element is qrexec, so without such limit, all the data would
be prepared (basically making second copy of it in dom0) while only
first few files would be transfered to the VM.
Also backup progress is calculated based on preparation thread, so when
it finishes there is some other time needed to flush all the data to the
VM. Limiting this amount makes progress somehow more accurate (but still
off by 1GB...).
2013-11-25 00:55:59 +01:00
Marek Marczykowski-Górecki
07ae02915f backups: add missing import in qvm-backup 2013-11-25 00:55:10 +01:00
Marek Marczykowski-Górecki
10a01010bb backups: fix handling multi-volume archive during restore
We can't wait for tar next volume prompt using stderr.readline(),
because tar don't output EOL marker after this prompt. The other way
would be switching file descriptor to non-blocking mode and using lower
level os.read(), but this looks like more error-prone way (races...).
So change idea of handling such archives: after switching to next
archive volume, simply send '\n' to tar (which will receive when
needed). When getting "*.000" file, assume that previous archive was
over and wait for previous tar process. Then start the new one.

Also don't give explicit tape length, only turn multi-volume mode on. So
will correctly handle all multi-volume archives, regardless of its size.
2013-11-25 00:48:54 +01:00
Marek Marczykowski-Górecki
7229b78bbf backups: minor reduce code duplication 2013-11-25 00:48:00 +01:00
Marek Marczykowski-Górecki
bc59d7e054 backups: include file path in internal archive, implement dom0 home restore
This is mostly revert of "3d1b40f backups: keep file without path in
inner tar archive" in terms of archive format, but the code is more
robust than old one. Especially reuse already computed dir paths. Also
restore only requested files (based on selected VMs and its qubes.xml
data). Change the restore workflow to restore files first to temporary
directory, then move to final dirs. This approach:
 - will be compatible with hashed vm name in the archive path
 - is required to handle dom0 home backup (directory outside of
   /var/lib/qubes)
 - it should be also more defensive - make any changes in /var/lib/qubes
 only after successful extraction of files and creating Qubes*Vm object

Second change in this commit is implement of dom0 home backup/restore.
As qubes.xml now contains data about dom0, we have information whether
it is included in the backup (before getting actual files).
2013-11-25 00:36:40 +01:00
Marek Marczykowski-Górecki
dc6fd3c8f3 core: store dom0 info in qubes.xml
At least to have there info about its backup.
2013-11-24 23:50:39 +01:00
Marek Marczykowski-Górecki
a64f7c12ad backups: desperate try to improve readability
Especially kill long lines.
2013-11-24 23:49:53 +01:00
Marek Marczykowski-Górecki
c306b9c00a backups: increase readability of long function calls 2013-11-24 23:49:53 +01:00
Marek Marczykowski-Górecki
5477aea877 backups: increase buffer size for better performance
After this change the bottleneck is qrexec throughput.
2013-11-24 23:49:53 +01:00
Marek Marczykowski-Górecki
c64b6c04ce backups: make all the debug easy to disable 2013-11-24 23:49:39 +01:00
Marek Marczykowski-Górecki
005db6a5ab backups: fix race condition in "tape" change event during backup
Ensure that outer tar/encryptor gets all the data *and EOF* before
signalling inner tar to continue. Previously it could happen that inner
tar begins to write next data chunk, while qvm-backup still holds
previous data chunk open.
2013-11-24 03:28:21 +01:00