Make qubes_restore rexec-aware.
This commit is contained in:
parent
f263aa6b7c
commit
a7cc09071f
@ -35,6 +35,8 @@ def main():
|
|||||||
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
||||||
parser.add_option ("--no-guid", action="store_true", dest="noguid", default=False,
|
parser.add_option ("--no-guid", action="store_true", dest="noguid", default=False,
|
||||||
help="Do not start the GUId")
|
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,
|
parser.add_option ("--console", action="store_true", dest="debug_console", default=False,
|
||||||
help="Attach debugging console to the newly started VM")
|
help="Attach debugging console to the newly started VM")
|
||||||
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
|
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
|
||||||
@ -71,13 +73,14 @@ def main():
|
|||||||
print "ERROR: Cannot start qubes_guid!"
|
print "ERROR: Cannot start qubes_guid!"
|
||||||
exit (1)
|
exit (1)
|
||||||
|
|
||||||
if options.verbose:
|
if not options.norexec:
|
||||||
print "--> Starting Qubes rexec..."
|
if options.verbose:
|
||||||
|
print "--> Starting Qubes rexec..."
|
||||||
|
|
||||||
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
|
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
|
||||||
if (retcode != 0) :
|
if (retcode != 0) :
|
||||||
print "ERROR: Cannot start qrexec_daemon!"
|
print "ERROR: Cannot start qrexec_daemon!"
|
||||||
exit (1)
|
exit (1)
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -21,7 +21,7 @@ if ! [ -d $VMDIR ] ; then
|
|||||||
echo $VMDIR does not exist ?
|
echo $VMDIR does not exist ?
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! qvm-start $1 --no-guid --dvm ; then
|
if ! qvm-start $1 --no-guid --no-rexec --dvm ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -182,6 +182,29 @@ int xend_connect()
|
|||||||
return s;
|
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)
|
void start_guid(int domid, int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -197,6 +220,7 @@ void start_guid(int domid, int argc, char **argv)
|
|||||||
execv("/usr/bin/qubes_guid", guid_args);
|
execv("/usr/bin/qubes_guid", guid_args);
|
||||||
perror("execv");
|
perror("execv");
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify the savefile. fd = fd to the open savefile,
|
// modify the savefile. fd = fd to the open savefile,
|
||||||
// buf - already read 1st page of the savefile
|
// buf - already read 1st page of the savefile
|
||||||
// pattern - pattern to search for
|
// pattern - pattern to search for
|
||||||
@ -456,6 +480,7 @@ int main(int argc, char **argv)
|
|||||||
setup_xenstore(netvm_id, domid, dispid, name);
|
setup_xenstore(netvm_id, domid, dispid, name);
|
||||||
fprintf(stderr, "time=%s, starting qubes_guid\n", gettime());
|
fprintf(stderr, "time=%s, starting qubes_guid\n", gettime());
|
||||||
rm_fast_flag();
|
rm_fast_flag();
|
||||||
|
start_rexec(domid);
|
||||||
start_guid(domid, argc, argv);
|
start_guid(domid, argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user