backup: use vm.run_service instead of vm.run

This should be the only way used to call services.
This commit is contained in:
Marek Marczykowski-Górecki 2016-04-03 03:19:30 +02:00 committed by Wojtek Porczyk
parent e8f21929ad
commit ed88b5a9a3

View File

@ -531,11 +531,9 @@ class Backup(object):
tar_sparse = None tar_sparse = None
if self.target_vm is not None: if self.target_vm is not None:
# Prepare the backup target (Qubes service call) # Prepare the backup target (Qubes service call)
backup_target = "QUBESRPC qubes.Backup dom0"
# If APPVM, STDOUT is a PIPE # If APPVM, STDOUT is a PIPE
vmproc = self.target_vm.run( vmproc = self.target_vm.run_service('qubes.Backup',
command=backup_target, passio_popen=True, passio_stderr=True) passio_popen=True, passio_stderr=True)
vmproc.stdin.write(self.target_dir. vmproc.stdin.write(self.target_dir.
replace("\r", "").replace("\n", "") + "\n") replace("\r", "").replace("\n", "") + "\n")
backup_stdout = vmproc.stdin backup_stdout = vmproc.stdin
@ -1340,12 +1338,9 @@ class BackupRestore(object):
vmproc = None vmproc = None
if self.backup_vm is not None: if self.backup_vm is not None:
# Prepare the backup target (Qubes service call)
backup_target = "QUBESRPC qubes.Restore dom0"
# If APPVM, STDOUT is a PIPE # If APPVM, STDOUT is a PIPE
vmproc = self.backup_vm.run( vmproc = self.backup_vm.run_service('qubes.Restore',
command=backup_target, passio_popen=True, passio_stderr=True) passio_popen=True, passio_stderr=True)
vmproc.stdin.write( vmproc.stdin.write(
self.backup_location.replace("\r", "").replace("\n", "") + "\n") self.backup_location.replace("\r", "").replace("\n", "") + "\n")