dom0/qvm-tools: use vm.run(...) instead of run_in_vm(vm, ...)

This commit is contained in:
Marek Marczykowski 2012-02-10 20:45:43 +01:00
parent 7c7bea6a03
commit f7d84c9a27
2 changed files with 5 additions and 7 deletions

View File

@ -24,7 +24,6 @@
from qubes.qubes import QubesVmCollection from qubes.qubes import QubesVmCollection
from qubes.qubes import QubesException from qubes.qubes import QubesException
from optparse import OptionParser from optparse import OptionParser
from qubes import qubesutils
import subprocess import subprocess
import socket import socket
import errno import errno
@ -83,7 +82,7 @@ def vm_run_cmd(vm, cmd, options):
elif level == "error": elif level == "error":
tray_notify_error(str) tray_notify_error(str)
return qubesutils.run_in_vm(vm, cmd, autostart = options.auto, return vm.run(cmd, autostart = options.auto,
verbose = options.verbose, verbose = options.verbose,
notify_function = tray_notify_generic if options.tray else None, notify_function = tray_notify_generic if options.tray else None,
passio = options.passio, localcmd = options.localcmd) passio = options.passio, localcmd = options.localcmd)

View File

@ -21,7 +21,6 @@
# #
from qubes.qubes import QubesVmCollection from qubes.qubes import QubesVmCollection
from qubes.qubesutils import run_in_vm
import os.path import os.path
import os import os
import sys import sys
@ -65,14 +64,14 @@ def main():
# Ignore retcode, try even if nm-online failed - user can setup network manually # Ignore retcode, try even if nm-online failed - user can setup network manually
# on-online has timeout 30sec by default # on-online has timeout 30sec by default
run_in_vm(net_vm, 'user:nm-online -x', verbose=verbose, wait=True) net_vm.run('user:nm-online -x', verbose=verbose, wait=True)
# Sync clock # Sync clock
if run_in_vm(clock_vm, 'root:/etc/init.d/ntpdate restart', verbose=verbose, wait=True) != 0: if clock_vm.run('root:/etc/init.d/ntpdate restart', verbose=verbose, wait=True) != 0:
print >> sys.stderr, 'Time sync failed, aborting!' print >> sys.stderr, 'Time sync failed, aborting!'
sys.exit(1) sys.exit(1)
p = run_in_vm(clock_vm, 'user:date -u', verbose=verbose, passio_popen=True) p = clock_vm.run('user:date -u', verbose=verbose, passio_popen=True)
date_out = p.stdout.read(100) date_out = p.stdout.read(100)
if not re.match(r'^[A-Za-z]* [A-Za-z]* [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [A-Z]* [0-9][0-9][0-9][0-9]$', date_out): if not re.match(r'^[A-Za-z]* [A-Za-z]* [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [A-Z]* [0-9][0-9][0-9][0-9]$', date_out):
print >> sys.stderr, 'Invalid date output, aborting!' print >> sys.stderr, 'Invalid date output, aborting!'
@ -90,7 +89,7 @@ def main():
if vm.is_running() and vm.qid != 0 and vm.qid != clock_vm.qid: if vm.is_running() and vm.qid != 0 and vm.qid != clock_vm.qid:
if verbose: if verbose:
print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name
run_in_vm(vm, 'root:date -u -s "%s"' % date_out, verbose=verbose) vm.run('root:date -u -s "%s"' % date_out, verbose=verbose)
main() main()