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