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

This commit is contained in:
Joanna Rutkowska 2012-04-30 13:27:53 +02:00
commit 11b952ffc5
6 changed files with 38 additions and 15 deletions

View File

@ -13,7 +13,7 @@ echo $$ > $PIDFILE
trap "rm $PIDFILE" EXIT
# If no updates available - exit here
qvm-dom0-updates --check-only && exit
qubes-dom0-updates --check-only && exit
RETCODE=$?
if [ "$RETCODE" -ne 100 ]; then
@ -32,4 +32,4 @@ zenity --notification --window-icon=$NOTIFY_ICON --text="Qubes dom0 updates avai
zenity --question --title="Qubes Dom0 updates" \
--text="There are updates for dom0 available, do you want to download them now?" || exit 0
su -c "DISPLAY=:0 qvm-dom0-update --gui" $LOCAL_USER
su -c "DISPLAY=:0 qubes-dom0-update --gui" $LOCAL_USER

View File

@ -32,7 +32,7 @@ if [ -e /sys/bus/pci/drivers/pciback/$BDF ]; then
# Check if device not assigned to any RUNNING VM
XS_PATH=/local/domain/0/backend/pci
GREP_RE="^$XS_PATH/[0-9]*/[0-9]*/dev-[0-9]* = \"$BDF\""
if xenstore-ls -f $XS_PATH | grep -q "$GREP_RE"; then
if xenstore-ls -f $XS_PATH 2> /dev/null | grep -q "$GREP_RE"; then
DOMID=`xenstore-ls -f $XS_PATH | grep "$GREP_RE"|cut -d/ -f7`
echo "ERROR: Device already attached to the running VM '`xl domname $DOMID`'" >&2
exit 1

View File

@ -60,7 +60,6 @@ qubes_servicevms_dir = qubes_base_dir + "/servicevms"
qubes_store_filename = qubes_base_dir + "/qubes.xml"
qubes_kernels_base_dir = qubes_base_dir + "/vm-kernels"
qubes_max_xid = 1024
qubes_max_qid = 254
qubes_max_netid = 254
vm_default_netmask = "255.255.255.0"
@ -142,7 +141,7 @@ class QubesHost(object):
if previous is None:
previous_time = time.time()
previous = {}
info = xc.domain_getinfo(0, qubes_max_xid)
info = xc.domain_getinfo(0, qubes_max_qid)
for vm in info:
previous[vm['domid']] = {}
previous[vm['domid']]['cpu_time'] = vm['cpu_time']/vm['online_vcpus']
@ -151,7 +150,7 @@ class QubesHost(object):
current_time = time.time()
current = {}
info = xc.domain_getinfo(0, qubes_max_xid)
info = xc.domain_getinfo(0, qubes_max_qid)
for vm in info:
current[vm['domid']] = {}
current[vm['domid']]['cpu_time'] = vm['cpu_time']/max(vm['online_vcpus'],1)
@ -553,7 +552,7 @@ class QubesVm(object):
if start_xid < 0:
start_xid = 0
try:
domains = xc.domain_getinfo(start_xid, qubes_max_xid-start_xid)
domains = xc.domain_getinfo(start_xid, qubes_max_qid)
except xen.lowlevel.xc.Error:
return None
@ -2376,6 +2375,14 @@ class QubesHVm(QubesVm):
xc.domain_unpause(self.stubdom_xid)
super(QubesHVm, self).unpause()
def is_fully_usable(self):
xid = self.stubdom_xid
if xid < 0:
return False
if not os.path.exists('/var/run/qubes/guid_running.%d' % xid):
return False
return True
class QubesVmCollection(dict):
"""
A collection of Qubes VMs indexed by Qubes id (qid)

View File

@ -174,7 +174,10 @@ def main():
for vm in vms_to_display:
data_row = {}
for f in fields_to_display:
data_row[f] = str(eval(fields[f]["func"]))
if vm.qid == 0 and (f.startswith('priv-') or f.startswith('root-') or f == 'disk'):
data_row[f] = 'n/a'
else:
data_row[f] = str(eval(fields[f]["func"]))
l = len(data_row[f])
if l > fields[f]["max_width"]:
fields[f]["max_width"] = l

View File

@ -14,7 +14,9 @@ fi
shopt -s nullglob
HOTPLUG_STORE="/var/run/xen-hotplug/${XENBUS_PATH//\//-}"
if [ -n "$XENBUS_PATH" ]; then
HOTPLUG_STORE="/var/run/xen-hotplug/${XENBUS_PATH//\//-}"
fi
get_dev() {
dev=$1
@ -102,7 +104,10 @@ case "$command" in
add)
case $t in
snapshot|origin)
p=$(xenstore_read "$XENBUS_PATH/params")
p=$(xenstore_read_default "$XENBUS_PATH/params" 'MISSING')
if [ "$p" == "MISSING" ]; then
fatal "Missing device parameters ($t $XENBUS_PATH/params)"
fi
base=${p/:*/}
cow=${p/*:/}
@ -191,18 +196,20 @@ case "$command" in
if [ "$command" = "cleanup" ]; then
t=$2
else
t=$(cat $HOTPLUG_STORE-type)
t=$(cat $HOTPLUG_STORE-type 2>/dev/null || echo 'MISSING')
fi
case $t in
case "$t" in
snapshot|origin)
if [ "$command" = "cleanup" ]; then
node=$3
else
node=$(cat "$HOTPLUG_STORE-node")
node=$(cat "$HOTPLUG_STORE-node" 2> /dev/null)
fi
if [ -z "$node" ]; then
fatal "No device node to remove"
#fatal "No device node to remove"
#Most likely already removed
exit 0
fi
if [ ! -e "$node" ]; then
@ -258,10 +265,13 @@ case "$command" in
for dev in $deps; do
if [ -b "$dev" ]; then
log debug "Removing $dev"
losetup -d $dev || true 2> /dev/null
losetup -d $dev 2> /dev/null || true
fi
done
if [ -n "$HOTPLUG_STORE" ]; then
rm $HOTPLUG_STORE-*
fi
release_lock "block"
exit 0

View File

@ -57,6 +57,9 @@ fi
if [ -z "$PKGLIST" ]; then
# No new updates
if [ "$GUI" = 1 ]; then
zenity --info --text="No new updates available"
fi
exit 0
fi