dispvm: use qubesdb instead of xenstore
This commit is contained in:
parent
457737b6cc
commit
ff2c925e18
@ -107,15 +107,6 @@ class QubesDisposableVm(QubesVm):
|
||||
def verify_files(self):
|
||||
return True
|
||||
|
||||
def create_xenstore_entries(self, xid):
|
||||
super(QubesDisposableVm, self).create_xenstore_entries(xid)
|
||||
|
||||
# TODO!
|
||||
domain_path = vmm.xs.get_domain_path(xid)
|
||||
|
||||
vmm.xs.write('', "{0}/qubes-restore-complete".format(domain_path),
|
||||
'True')
|
||||
|
||||
def get_config_params(self):
|
||||
attrs = super(QubesDisposableVm, self).get_config_params()
|
||||
attrs['privatedev'] = ''
|
||||
@ -160,11 +151,15 @@ class QubesDisposableVm(QubesVm):
|
||||
print >>sys.stderr, "time=%s, done" % (str(time.time()))
|
||||
self._libvirt_domain = None
|
||||
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Starting Qubes DB..."
|
||||
self.start_qubesdb()
|
||||
|
||||
self.services['qubes-dvm'] = True
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Setting Xen Store info for the VM..."
|
||||
print >> sys.stderr, "--> Setting Qubes DB info for the VM..."
|
||||
self.create_xenstore_entries(self.xid)
|
||||
print >>sys.stderr, "time=%s, done xenstore" % (str(time.time()))
|
||||
print >>sys.stderr, "time=%s, done qubesdb" % (str(time.time()))
|
||||
|
||||
# fire hooks
|
||||
for hook in self.hooks_start:
|
||||
|
@ -29,29 +29,26 @@ if ! qvm-start $1 --no-guid --dvm ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=`virsh -c xen:/// domid $1`
|
||||
if [ "$ID" = "" ] ; then
|
||||
echo "cannot get domain id" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Waiting for DVM domainid=$ID ..." >&2
|
||||
echo "Waiting for DVM $1 ..." >&2
|
||||
if [ -n "$ENCODED_SCRIPT" ] ; then
|
||||
xenstore-write /local/domain/$ID/qubes-save-script "$ENCODED_SCRIPT"
|
||||
qubesdb-write -d $1 /qubes-save-script "$ENCODED_SCRIPT"
|
||||
fi
|
||||
#set -x
|
||||
xenstore-write /local/domain/$ID/qubes-save-request 1
|
||||
xenstore-watch-qubes /local/domain/$ID/device/qubes-used-mem
|
||||
xenstore-read /local/domain/$ID/qubes-gateway | \
|
||||
qubesdb-write -d $1 /qubes-save-request 1
|
||||
qubesdb-watch -d $1 /qubes-used-mem
|
||||
qubesdb-read -d $1 /qubes-gateway | \
|
||||
cut -d . -f 3 | tr -d "\n" > $VMDIR/netvm-id.txt
|
||||
# FIXME: get connection URI from core scripts
|
||||
virsh -c xen:/// detach-disk $1 xvdb
|
||||
MEM=$(xenstore-read /local/domain/$ID/device/qubes-used-mem)
|
||||
MEM=$(qubesdb-read -d $1 /qubes-used-mem)
|
||||
echo "DVM boot complete, memory used=$MEM. Saving image..." >&2
|
||||
QMEMMAN_STOP=/var/run/qubes/do-not-membalance
|
||||
touch $QMEMMAN_STOP
|
||||
virsh -c xen:/// setmem $1 $MEM
|
||||
# Add some safety margin
|
||||
virsh -c xen:/// setmaxmem $1 $[ $MEM + 1024 ]
|
||||
# Stop qubesdb daemon now, so VM can restart it later
|
||||
kill `cat /var/run/qubes/qubesdb.$1.pid`
|
||||
sleep 1
|
||||
touch $2
|
||||
if ! virsh -c xen:/// save $1 $2; then
|
||||
|
Loading…
Reference in New Issue
Block a user