Make qubes_restore rexec-aware.

This commit is contained in:
Rafal Wojtczuk 2011-03-08 13:03:55 +01:00
parent f263aa6b7c
commit a7cc09071f
3 changed files with 36 additions and 8 deletions

View File

@ -35,6 +35,8 @@ def main():
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
parser.add_option ("--no-guid", action="store_true", dest="noguid", default=False,
help="Do not start the GUId")
parser.add_option ("--no-rexec", action="store_true", dest="norexec", default=False,
help="Do not start rexec")
parser.add_option ("--console", action="store_true", dest="debug_console", default=False,
help="Attach debugging console to the newly started VM")
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
@ -71,13 +73,14 @@ def main():
print "ERROR: Cannot start qubes_guid!"
exit (1)
if options.verbose:
print "--> Starting Qubes rexec..."
if not options.norexec:
if options.verbose:
print "--> Starting Qubes rexec..."
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
if (retcode != 0) :
print "ERROR: Cannot start qrexec_daemon!"
exit (1)
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
if (retcode != 0) :
print "ERROR: Cannot start qrexec_daemon!"
exit (1)
main()

View File

@ -21,7 +21,7 @@ if ! [ -d $VMDIR ] ; then
echo $VMDIR does not exist ?
exit 1
fi
if ! qvm-start $1 --no-guid --dvm ; then
if ! qvm-start $1 --no-guid --no-rexec --dvm ; then
exit 1
fi

View File

@ -182,6 +182,29 @@ int xend_connect()
return s;
}
void start_rexec(int domid)
{
int pid, status;
char dstr[40];
snprintf(dstr, sizeof(dstr), "%d", domid);
switch (pid = fork()) {
case -1:
perror("fork");
exit(1);
case 0:
execl("/usr/lib/qubes/qrexec_daemon", "qrexec_daemon",
dstr, NULL);
perror("execl");
exit(1);
default:;
}
if (waitpid(pid, &status, 0) < 0) {
perror("waitpid");
exit(1);
}
}
void start_guid(int domid, int argc, char **argv)
{
int i;
@ -197,6 +220,7 @@ void start_guid(int domid, int argc, char **argv)
execv("/usr/bin/qubes_guid", guid_args);
perror("execv");
}
// modify the savefile. fd = fd to the open savefile,
// buf - already read 1st page of the savefile
// pattern - pattern to search for
@ -456,6 +480,7 @@ int main(int argc, char **argv)
setup_xenstore(netvm_id, domid, dispid, name);
fprintf(stderr, "time=%s, starting qubes_guid\n", gettime());
rm_fast_flag();
start_rexec(domid);
start_guid(domid, argc, argv);
return 0;
}