Quick VM restore support
This commit is contained in:
parent
b9e815120d
commit
0a11679afb
@ -8,7 +8,7 @@
|
||||
#
|
||||
/dev/mapper/dmroot / ext4 defaults,noatime 1 1
|
||||
/dev/mapper/dmswap swap swap defaults 0 0
|
||||
/dev/xvdb /rw ext4 defaults 0 0
|
||||
/dev/xvdb /rw ext4 noauto,defaults 0 0
|
||||
tmpfs /dev/shm tmpfs defaults 0 0
|
||||
devpts /dev/pts devpts gid=5,mode=620 0 0
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
|
@ -14,6 +14,20 @@ start()
|
||||
echo "ERROR: /usr/bin/xenstore-read not found!"
|
||||
exit 1
|
||||
fi
|
||||
if xenstore-read qubes_save_request ; then
|
||||
dmesg -c >/dev/null
|
||||
# echo 1 >/proc/sys/vm/drop_caches
|
||||
# free | grep buffers/cache |
|
||||
# (read a b c d ; xenstore-write device/qubes_used_mem $c)
|
||||
free | grep Mem: |
|
||||
(read a b c d ; xenstore-write device/qubes_used_mem $c)
|
||||
echo "Waiting for restore"
|
||||
while ! dmesg -c | grep "using vcpu" ; do usleep 10 ; done
|
||||
while ! xenstore-read qubes_vm_type 2>/dev/null ; do
|
||||
usleep 10
|
||||
done
|
||||
echo Back to life.
|
||||
fi
|
||||
|
||||
name=$(/usr/bin/xenstore-read name)
|
||||
hostname $name
|
||||
@ -29,30 +43,36 @@ start()
|
||||
echo "nameserver $secondary_dns" >> /etc/resolv.conf
|
||||
fi
|
||||
|
||||
if ! [ -d /rw/home ] ; then
|
||||
echo
|
||||
echo "--> Virgin boot of the VM: Linking /home to /rw/home"
|
||||
mv /home /home.orig
|
||||
mkdir -p /rw/config
|
||||
mkdir -p /rw/home
|
||||
ln -s /rw/home/ /home
|
||||
cp -a /home.orig/user /home
|
||||
touch /rw/config/rc.local
|
||||
rm -fr /home.orig
|
||||
touch /var/lib/qubes/first_boot_completed
|
||||
fi
|
||||
if [ -e /dev/xvdb ] ; then
|
||||
mount /rw
|
||||
|
||||
if ! [ -L /home ] ; then
|
||||
mv /home /home.orig
|
||||
ln -s /rw/home /home
|
||||
fi
|
||||
if ! [ -L /usr/local ] ; then
|
||||
mv /usr/local /usr/local.orig
|
||||
ln -s /rw/usrlocal /usr/local
|
||||
fi
|
||||
if ! [ -d /rw/home ] ; then
|
||||
echo
|
||||
echo "--> Virgin boot of the VM: Linking /home to /rw/home"
|
||||
mv /home /home.orig
|
||||
mkdir -p /rw/config
|
||||
mkdir -p /rw/home
|
||||
ln -s /rw/home/ /home
|
||||
cp -a /home.orig/user /home
|
||||
touch /rw/config/rc.local
|
||||
rm -fr /home.orig
|
||||
touch /var/lib/qubes/first_boot_completed
|
||||
fi
|
||||
|
||||
if ! [ -L /home ] ; then
|
||||
mv /home /home.orig
|
||||
ln -s /rw/home /home
|
||||
fi
|
||||
if ! [ -L /usr/local ] ; then
|
||||
mv /usr/local /usr/local.orig
|
||||
ln -s /rw/usrlocal /usr/local
|
||||
fi
|
||||
#make it last, we want all above to work without /rw mounted
|
||||
if ! [ -d /rw/usrlocal ] ; then
|
||||
cp -a /usr/local.orig /rw/usrlocal
|
||||
if ! [ -d /rw/usrlocal ] ; then
|
||||
cp -a /usr/local.orig /rw/usrlocal
|
||||
fi
|
||||
else
|
||||
ln -sf /home_volatile /home
|
||||
fi
|
||||
|
||||
[ -x /rw/config/rc.local ] && /rw/config/rc.local
|
||||
|
2
appvm/qubes_timestamp
Executable file
2
appvm/qubes_timestamp
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec xenstore-write device/qubes_timestamp $(date +%s.%N)
|
@ -60,7 +60,7 @@ mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||
cp qubes_core $RPM_BUILD_ROOT/etc/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
cp qubes_add_pendrive_script qubes_penctl qvm-copy-to-vm qvm-copy-to-vm.kde $RPM_BUILD_ROOT/usr/bin
|
||||
cp qubes_timestamp qubes_add_pendrive_script qubes_penctl qvm-copy-to-vm qvm-copy-to-vm.kde $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/%{kde_service_dir}
|
||||
cp qvm-copy.desktop $RPM_BUILD_ROOT/%{kde_service_dir}
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d
|
||||
@ -77,6 +77,9 @@ cp ../common/qubes_serial_login $RPM_BUILD_ROOT/sbin
|
||||
mkdir -p $RPM_BUILD_ROOT/etc
|
||||
cp ../common/serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/home_volatile/user
|
||||
chown 500:500 $RPM_BUILD_ROOT/home_volatile/user
|
||||
|
||||
%triggerin -- initscripts
|
||||
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
|
||||
|
||||
@ -186,3 +189,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /mnt/removable
|
||||
/etc/yum.repos.d/qubes.repo
|
||||
/sbin/qubes_serial_login
|
||||
/usr/bin/qubes_timestamp
|
||||
%dir /home_volatile
|
||||
%attr(700,user,user) /home_volatile/user
|
||||
|
Loading…
Reference in New Issue
Block a user