Migrate backup to new storage api
This commit is contained in:
parent
bb8b58b04c
commit
61feb0ced7
@ -343,7 +343,7 @@ class Backup(object):
|
||||
# TODO this is file pool specific. Change it to a more general
|
||||
# solution
|
||||
if vm.volumes['private'] is not None:
|
||||
path_to_private_img = vm.volumes['private'].vid
|
||||
path_to_private_img = vm.volumes['private'].path
|
||||
vm_files.append(self.FileToBackup(path_to_private_img, subdir))
|
||||
|
||||
vm_files.append(self.FileToBackup(vm.icon_path, subdir))
|
||||
@ -358,7 +358,7 @@ class Backup(object):
|
||||
if vm.updateable:
|
||||
# TODO this is file pool specific. Change it to a more general
|
||||
# solution
|
||||
path_to_root_img = vm.volumes['root'].vid
|
||||
path_to_root_img = vm.volumes['root'].path
|
||||
vm_files.append(self.FileToBackup(path_to_root_img, subdir))
|
||||
files_to_backup[vm.qid] = self.VMToBackup(vm, vm_files, subdir)
|
||||
|
||||
@ -1725,11 +1725,10 @@ class BackupRestore(object):
|
||||
# wait for other processes (if any)
|
||||
for proc in self.processes_to_kill_on_cancel:
|
||||
proc.wait()
|
||||
|
||||
if vmproc.returncode != 0:
|
||||
raise qubes.exc.QubesException(
|
||||
"Backup completed, but VM receiving it reported an error "
|
||||
"(exit code {})".format(vmproc.returncode))
|
||||
if proc.returncode != 0:
|
||||
raise qubes.exc.QubesException(
|
||||
"Backup completed, but VM receiving it reported an error "
|
||||
"(exit code {})".format(proc.returncode))
|
||||
|
||||
if filename and filename != "EOF":
|
||||
raise qubes.exc.QubesException(
|
||||
|
@ -820,7 +820,7 @@ class BackupTestsMixin(SystemTestsMixin):
|
||||
name=vmname, template=template, provides_network=True, label='red')
|
||||
testnet.create_on_disk()
|
||||
vms.append(testnet)
|
||||
self.fill_image(testnet.volumes['private'].vid, 20*1024*1024)
|
||||
self.fill_image(testnet.volumes['private'].path, 20*1024*1024)
|
||||
|
||||
vmname = self.make_vm_name('test1')
|
||||
if self.verbose:
|
||||
@ -831,7 +831,7 @@ class BackupTestsMixin(SystemTestsMixin):
|
||||
testvm1.netvm = testnet
|
||||
testvm1.create_on_disk()
|
||||
vms.append(testvm1)
|
||||
self.fill_image(testvm1.volumes['private'].vid, 100*1024*1024)
|
||||
self.fill_image(testvm1.volumes['private'].path, 100*1024*1024)
|
||||
|
||||
vmname = self.make_vm_name('testhvm1')
|
||||
if self.verbose:
|
||||
@ -841,7 +841,7 @@ class BackupTestsMixin(SystemTestsMixin):
|
||||
hvm=True,
|
||||
label='red')
|
||||
testvm2.create_on_disk()
|
||||
self.fill_image(testvm2.volumes['root'].vid, 1024 * 1024 * 1024, True)
|
||||
self.fill_image(testvm2.volumes['root'].path, 1024 * 1024 * 1024, True)
|
||||
vms.append(testvm2)
|
||||
|
||||
vmname = self.make_vm_name('template')
|
||||
@ -850,7 +850,7 @@ class BackupTestsMixin(SystemTestsMixin):
|
||||
testvm3 = self.app.add_new_vm(qubes.vm.templatevm.TemplateVM,
|
||||
name=vmname, label='red')
|
||||
testvm3.create_on_disk()
|
||||
self.fill_image(testvm3.root_img, 100*1024*1024, True)
|
||||
self.fill_image(testvm3.volumes['root'].path, 100 * 1024 * 1024, True)
|
||||
vms.append(testvm3)
|
||||
|
||||
vmname = self.make_vm_name('custom')
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
import os
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import qubes
|
||||
import qubes.exc
|
||||
@ -77,10 +76,13 @@ class TC_00_Backup(qubes.tests.BackupTestsMixin, qubes.tests.QubesTestCase):
|
||||
hvmtemplate = self.app.add_new_vm(
|
||||
qubes.vm.templatevm.TemplateVM, name=vmname, hvm=True, label='red')
|
||||
hvmtemplate.create_on_disk()
|
||||
self.fill_image(os.path.join(hvmtemplate.dir_path, '00file'),
|
||||
195*1024*1024-4096*3)
|
||||
self.fill_image(hvmtemplate.private_img, 195*1024*1024-4096*3)
|
||||
self.fill_image(hvmtemplate.root_img, 1024*1024*1024, sparse=True)
|
||||
self.fill_image(
|
||||
os.path.join(hvmtemplate.dir_path, '00file'),
|
||||
195 * 1024 * 1024 - 4096 * 3)
|
||||
self.fill_image(hvmtemplate.volumes['private'].path,
|
||||
195 * 1024 * 1024 - 4096 * 3)
|
||||
self.fill_image(hvmtemplate.volumes['root'].path, 1024 * 1024 * 1024,
|
||||
sparse=True)
|
||||
vms.append(hvmtemplate)
|
||||
self.app.save()
|
||||
|
||||
@ -93,7 +95,7 @@ class TC_00_Backup(qubes.tests.BackupTestsMixin, qubes.tests.QubesTestCase):
|
||||
|
||||
def test_005_compressed_custom(self):
|
||||
vms = self.create_backup_vms()
|
||||
self.make_backup(vms, compressed="bzip2")
|
||||
self.make_backup(vms, compression_filter="bzip2")
|
||||
self.remove_vms(reversed(vms))
|
||||
self.restore_backup()
|
||||
for vm in vms:
|
||||
|
Loading…
Reference in New Issue
Block a user