-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KVM #438
base: master
Are you sure you want to change the base?
KVM #438
Conversation
Sorry for showing up unexpectedly. I just noticed the few things. I hope it's not too much bikeshading. I do a lot of Makefile programming and have also integrated the qubes build system in to my monorepo, and I often stumble about suboptimal Makefiles. |
local name="$1" | ||
local hypervisor | ||
|
||
if [[ $(cat /sys/hypervisor/type 2>/dev/null) == 'xen' ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [[ $(cat /sys/hypervisor/type 2>/dev/null) == 'xen' ]]; then | |
if hypervisor=$(cat /sys/hypervisor/type 2>/dev/null) && [[ "$hypervisor" = 'xen' ]]; then |
echo "$hypervisor" | ||
return 0 | ||
fi | ||
if [ "$name" == "$hypervisor" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [ "$name" == "$hypervisor" ]; then | |
if [ "$name" = "$hypervisor" ]; then |
@@ -1,14 +1,21 @@ | |||
#!/bin/sh | |||
#!/usr/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#!/usr/bin/sh | |
#!/usr/bin/bash -- | |
set -euo pipefail |
#### KVM: | ||
if hypervisor xen; then | ||
/usr/lib/qubes/fix-dir-perms.sh | ||
DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This runs into an xl
bug: xl
doesn’t check for write errors on stdout. The following helps but does not fix the problem:
DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') | |
DOM0_MAXMEM=$(/usr/sbin/xl list 0 | awk 'NR == 1 && NF > 3 && $3 ~ /^[0-9]+$/ { print $3 }') |
if hypervisor xen; then | ||
/usr/lib/qubes/fix-dir-perms.sh | ||
DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') | ||
xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ] | |
xenstore-write /local/domain/0/memory/static-max "$(( $DOM0_MAXMEM * 1024 ))" |
|
||
cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml | |
s=$(date +%F-%T) && cp /var/lib/qubes/qubes.xml "/var/lib/qubes/backup/qubes-$s.xml" |
QubesOS/qubes-issues#7051