Skip to content

Commit

Permalink
rework vm configuration abit
Browse files Browse the repository at this point in the history
  • Loading branch information
cHolzberger committed Dec 26, 2018
1 parent 01eca7d commit b915426
Show file tree
Hide file tree
Showing 51 changed files with 814 additions and 127 deletions.
Empty file modified bin/bcache-destroy
100644 → 100755
Empty file.
12 changes: 10 additions & 2 deletions bin/boot.real
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,26 @@ source kvm/common-$OS.sh
source kvm/bios-$BIOS.sh
source kvm/cpu-$CPU_MODEL.sh

source kvm/mon.sh

source kvm/usb-$USB_MODE.sh
source kvm/gfx-$GFX_MODE.sh
source kvm/hdd-$HDD_MODE.sh
if [ "$USE_HUGEPAGES" = "1" ]; then
source kvm/hugepages.sh
fi

source kvm/net-$NET_MODE.sh

[[ ! -z "$NET_MODE" ]] && source kvm/net-$NET_MODE.sh

if [[ ! -z "$NET1_MODE" ]] || [[ ! -z "$NET2_MODE" ]]; then
echo "NET_MODE: $NET1_MODE $NET2_MODE"
source kvm/net-uni.sh
fi

if [ "x$SOUND_MODE" != "x" ]; then
source kvm/sound-$SOUND_MODE.sh
fi
source kvm/mon.sh

echo "OPTS: $(echo $QEMU_OPTS[@] | sed -e "s/-/-\n/g")"
source kvm/run-clover.sh
Expand Down
11 changes: 9 additions & 2 deletions bin/config-machine
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ if [ "x$USE_CPUS" = "x" ]; then
for i in $(seq $START $END); do
USE_CPUS+=($i)
done
echo "Using CPUs: ${USE_CPUS[@]}"
fi

if [ "x$IO_CPUS_RANGE" = "x" ]; then
IO_CPUS_RANGE=$USE_CPUS_RANGE
IO_CPUS=${USE_CPUS[@]}
fi

if [ "x$IO_CPUS" = "x" ]; then
echo "Generating IO_CPUS from IO_CPUS_RANGE ($IO_CPUS_RANGE)"
START=$(echo $IO_CPUS_RANGE | cut -d"-" -f1)
Expand All @@ -51,8 +56,10 @@ if [ "x$IO_CPUS" = "x" ]; then
for i in $(seq $START $END); do
IO_CPUS+=($i)
done
echo "Using IO CPUs: ${IO_CPUS[@]}"
fi

echo "Using CPUs: ${USE_CPUS[@]}"
echo "Using IO CPUs: ${IO_CPUS[@]}"

#LOADING SEAT

Expand Down
Empty file modified bin/cpu-show-irq.sh
100644 → 100755
Empty file.
48 changes: 48 additions & 0 deletions bin/machine-shutdown-running
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

for MACHINE_PATH in /srv/kvm/vms/*; do

if [ -e $MACHINE_PATH/var/pid ]; then
p=$(cat $MACHINE_PATH/var/pid)
if [ -e "/proc/$p" ]; then
vm=$(basename $MACHINE_PATH)
echo "Shutting Down: $vm"
/srv/kvm/OSX-KVM/bin/shutdown-ga $vm &
sleep 2
fi

fi
done

sleep 10

for MACHINE_PATH in /srv/kvm/vms/*; do


if [ -e $MACHINE_PATH/var/pid ]; then
p=$(cat $MACHINE_PATH/var/pid)
if [ -e "/proc/$p" ]; then
vm=$(basename $MACHINE_PATH)
echo "Shutting Down: $vm"
/srv/kvm/OSX-KVM/bin/shutdown-acpi $vm &
sleep 2
fi

fi

done
sleep 20
echo "Killing remaining vms"
for MACHINE_PATH in /srv/kvm/vms/*; do

if [ -e $MACHINE_PATH/var/pid ]; then
p=$(cat $MACHINE_PATH/var/pid)
if [ -e "/proc/$p" ]; then
vm=$(basename $MACHINE_PATH)
echo "Shutting Down: $vm"
/srv/kvm/OSX-KVM/bin/shutdown-hard $vm
fi

fi

done
File renamed without changes.
File renamed without changes.
File renamed without changes.
89 changes: 89 additions & 0 deletions bin/ssl-generate-cert-full
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

SCRIPT_DIR=$(dirname $(readlink -f $0))
source $SCRIPT_DIR/config-common

WANT_SEAT=$(echo $1 | cut -d":" -f 2)
WANT_MACHINE=$(echo $1 | cut -d":" -f 1)

MACHINE=${WANT_MACHINE:-"default"}
SEAT=${WANT_SEAT:-"$MACHINE"}

MACHINE_PATH="$VM_PREFIX/$MACHINE"
MACHINE_DISKS="$VM_PREFIX/$MACHINE/disks"

if [ "x$MACHINE" == "x" ]; then
echo "Usage:"
echo "$0 [machine-name]"
exit 3
fi

if [ ! -d "$MACHINE_PATH" ]; then
echo "Machine $MACHINE does not exists"
echo "Reason: $MACHINE_PATH does not exist"
exit 1
fi

if [ ! -e "$MACHINE_PATH/config" ]; then
echo "Can't load $MACHINE"
echo "Reason: 'config' does not exist in $MACHINE_PATH"
exit 2
fi

#LOADING MACHINE CONFIG
source $MACHINE_PATH/config
#====================================

mkdir $MACHINE_PATH/cert || true

CA_KEY=$MACHINE_PATH/cert/ca-key.pem
CA_CERT=$MACHINE_PATH/cert/ca-cert.pem
CA_INFO=$MACHINE_PATH/cert/ca.info
SERVER_KEY=$MACHINE_PATH/cert/server-key.pem
SERVER_CSR=$MACHINE_PATH/cert/server-key.csr
SERVER_CERT=$MACHINE_PATH/cert/server-cert.pem
SERVER_INFO=$MACHINE_PATH/cert/server.info



cd $MACHINE_PATH/cert
cat > $CA_INFO <<EOF
cn = MOSAIK Software VNC
ca
cert_signing_key
EOF

echo "GENERATING SERVER CERT"
cat > $SERVER_INFO <<EOF
organization = MOSAIK Software VNC
cn = kvm-ch.ad.mosaiksoftware.de
tls_www_server
encryption_key
signing_key
ip_address = "192.168.254.31"
EOF

echo "Generating PRIVKEY"

certtool --generate-privkey > $CA_KEY

echo "Generating CA CERT"
certtool --generate-self-signed \
--load-privkey $CA_KEY \
--template $CA_INFO \
--outfile $CA_CERT


echo "Generating SERVER KEY"
certtool --generate-privkey > $SERVER_KEY

echo "Generating SERVER CERT"
certtool --generate-certificate \
--load-ca-certificate $CA_CERT \
--load-ca-privkey $CA_KEY \
--load-privkey $SERVER_KEY \
--template $SERVER_INFO \
--outfile $SERVER_CERT



12 changes: 12 additions & 0 deletions cfg/i440base.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[machine]
type = "pc"
accel = "kvm"

[device "pcie.8"] # VFIO GPU
# driver = "pcie-root-port"
driver = "ioh3420"
bus = "pci.0"
addr = "1c"
port = "8"
chassis = "8"

9 changes: 9 additions & 0 deletions cfg/i440rng.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[device]
driver = "virtio-rng-pci"
rng = "rng0"
addr = "0x3"

[object "rng0"]
qom-type = "rng-random"
filename = "/dev/urandom"

Loading

0 comments on commit b915426

Please sign in to comment.