Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/marmarek/core
This commit is contained in:
commit
23f4806c7d
32
dom0/pm-utils/01qubes-suspend-netvm
Executable file
32
dom0/pm-utils/01qubes-suspend-netvm
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. "${PM_FUNCTIONS}"
|
||||||
|
|
||||||
|
suspend_net()
|
||||||
|
{
|
||||||
|
NETVM=$(qvm-get-default-netvm)
|
||||||
|
if [ "X"$NETVM = "X""dom0" -o "X"$NETVM = "X" -o "X"$NETVM = "X""none"] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
qvm-run -u root --pass_io $NETVM "source /usr/lib64/pm-utils/pm-functions; run_hooks sleep suspend suspend"
|
||||||
|
# Ignore exit status from netvm...
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
resume_net()
|
||||||
|
{
|
||||||
|
NETVM=$(qvm-get-default-netvm)
|
||||||
|
if [ "X"$NETVM = "X""dom0" -o "X"$NETVM = "X" -o "X"$NETVM = "X""none"] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
qvm-run -u root --pass_io $NETVM "source /usr/lib64/pm-utils/pm-functions; run_hooks sleep resume suspend reverse"
|
||||||
|
# Ignore exit status from netvm...
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
resume) resume_net ;;
|
||||||
|
suspend) suspend_net ;;
|
||||||
|
*) exit 0 ;;
|
||||||
|
esac
|
@ -1,48 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. "${PM_FUNCTIONS}"
|
|
||||||
|
|
||||||
get_domain_pci_devs()
|
|
||||||
{
|
|
||||||
VM=$1
|
|
||||||
TMPFILE=$(mktemp -p /var/run/qubes/)
|
|
||||||
xm pci-list $VM > $TMPFILE
|
|
||||||
if grep -i -q vslt $TMPFILE ; then
|
|
||||||
slt=valid_identifier
|
|
||||||
else
|
|
||||||
slt=""
|
|
||||||
fi
|
|
||||||
cat $TMPFILE | grep -v domain | sed 's/0x//g'| \
|
|
||||||
while read $slt a b c d; do echo $a:$b:$c.$d ; done > /var/run/qubes/$VM.pcidevs
|
|
||||||
rm -f $TMPFILE
|
|
||||||
}
|
|
||||||
|
|
||||||
detach_pcis()
|
|
||||||
{
|
|
||||||
NETVM=$(qvm-get-default-netvm)
|
|
||||||
if [ "X"$NETVM = "X""dom0" -o "X"$NETVM = "X" -o "X"$NETVM = "X""none"] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
get_domain_pci_devs $NETVM
|
|
||||||
for dev in $(cat /var/run/qubes/$NETVM.pcidevs) ; do
|
|
||||||
xm pci-detach $NETVM $dev
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
attach_pcis()
|
|
||||||
{
|
|
||||||
NETVM=$(qvm-get-default-netvm)
|
|
||||||
if [ "X"$NETVM = "X""dom0" -o "X"$NETVM = "X" -o "X"$NETVM = "X""none"] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
for dev in $(cat /var/run/qubes/$NETVM.pcidevs) ; do
|
|
||||||
xm pci-attach $NETVM $dev
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
resume) attach_pcis ;;
|
|
||||||
suspend) detach_pcis ;;
|
|
||||||
*) exit 0 ;;
|
|
||||||
esac
|
|
@ -126,7 +126,7 @@ cp ../common/iptables $RPM_BUILD_ROOT/etc/sysconfig
|
|||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d
|
mkdir -p $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d
|
||||||
cp pm-utils/01qubes-sync-vms-clock $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
cp pm-utils/01qubes-sync-vms-clock $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
||||||
cp pm-utils/01qubes-swap-pci-devs $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
cp pm-utils/01qubes-suspend-netvm $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
||||||
cp pm-utils/02qubes-pause-vms $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
cp pm-utils/02qubes-pause-vms $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/log/qubes
|
mkdir -p $RPM_BUILD_ROOT/var/log/qubes
|
||||||
@ -306,7 +306,7 @@ fi
|
|||||||
/etc/NetworkManager/dispatcher.d/qubes_nmhook
|
/etc/NetworkManager/dispatcher.d/qubes_nmhook
|
||||||
/etc/sysconfig/iptables
|
/etc/sysconfig/iptables
|
||||||
/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock
|
/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock
|
||||||
/usr/lib64/pm-utils/sleep.d/01qubes-swap-pci-devs
|
/usr/lib64/pm-utils/sleep.d/01qubes-suspend-netvm
|
||||||
/usr/lib64/pm-utils/sleep.d/02qubes-pause-vms
|
/usr/lib64/pm-utils/sleep.d/02qubes-pause-vms
|
||||||
/usr/bin/xenstore-watch
|
/usr/bin/xenstore-watch
|
||||||
/usr/lib/qubes/qubes_restore
|
/usr/lib/qubes/qubes_restore
|
||||||
|
Loading…
Reference in New Issue
Block a user