Merge branch 'hvm' of 10.141.1.101:/var/lib/qubes/git/marmarek/core into hvm

This commit is contained in:
Joanna Rutkowska 2012-03-21 11:31:57 +01:00
commit 8cb24c6032
2 changed files with 44 additions and 17 deletions

View File

@ -2210,11 +2210,26 @@ class QubesHVm(QubesVm):
params['volatiledev'] = ''
if self.drive:
stat_res = os.stat(self.drive)
if stat.S_ISBLK(stat_res.st_mode):
params['otherdevs'] = "'phy:%s,xvdc:cdrom,r'," % self.drive
type_mode = ":cdrom,r"
drive_path = self.drive
# leave empty to use standard syntax in case of dom0
backend_domain = ""
if drive_path.startswith("hd:"):
type_mode = ",w"
drive_path = drive_path[3:]
backend_split = re.match(r"^([a-zA-Z0-9]*):(.*)", drive_path)
if backend_split:
backend_domain = "," + backend_split.group(1)
drive_path = backend_split.group(2)
# FIXME: os.stat will work only when backend in dom0...
stat_res = None
if backend_domain == "":
stat_res = os.stat(drive_path)
if stat_res and stat.S_ISBLK(stat_res.st_mode):
params['otherdevs'] = "'phy:%s,xvdc%s%s'," % (drive_path, type_mode, backend_domain)
else:
params['otherdevs'] = "'script:file:%s,xvdc:cdrom,r'," % self.drive
params['otherdevs'] = "'script:file:%s,xvdc%s%s'," % (drive_path, type_mode, backend_domain)
else:
params['otherdevs'] = ''
return params

View File

@ -1,14 +1,26 @@
#!/bin/sh
trap "exit 1" USR1 TERM
export SHELL_PID=$$
(
echo "1"
if ! qvm-create-default-dvm --used-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
kill -USR1 $SHELL_PID
fi
echo 100
) | zenity --progress --pulsate --auto-close \
--text="Please wait (up to 120s) while the DispVM savefile is being updated. This only happens when you have updated the template, next time will be much faster." \
--title="Updating default DispVM savefile"
exit 0
ref=`kdialog --title="Updating default DispVM savefile" \
--progressbar \
"<center>
<font>
<b>Please wait (up to 120s) while the DispVM savefile is being updated.</b>
<br>
<i><small>
This only happens when you have updated the template.<br>
Next time will be much faster.
</small></i>
</font>
</center>" 0`;
trap "qdbus $ref close" EXIT
#qdbus $ref showCancelButton true;
ret=0
if ! qvm-create-default-dvm --used-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
ret=1
fi
exit $ret