aboutsummaryrefslogtreecommitdiffstats
path: root/virtualenv
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-05-08 17:27:13 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 04:28:19 +0200
commit6cec4d6a9bc6a6087e47dd0665f35d5dbe9b15e7 (patch)
tree183a73d6ce7db2caab3067c27cd248d4dcca427b /virtualenv
parentcdec2e76b4b1af00e10ce3bb72ee74e33d52083b (diff)
Use better defaults for VMs.
Diffstat (limited to 'virtualenv')
-rwxr-xr-xvirtualenv/virt52
1 files changed, 16 insertions, 36 deletions
diff --git a/virtualenv/virt b/virtualenv/virt
index bc7b155..9d298b0 100755
--- a/virtualenv/virt
+++ b/virtualenv/virt
@@ -60,7 +60,7 @@ isActive() {
install() {
[ $# -eq 1 -o $# -eq 2 ] || usage
local name=$1
- local disk=${2:-$root/images/${name}.qcow2}
+ local disk=${2:-$root/images/${name}.img}
[ -d "$root/images" ] || mkdir "$root/images"
local darch
@@ -92,23 +92,23 @@ install() {
grep -q '^kvm\s' /proc/modules || echo 'WARN: KVM not available!' >&2
- if [ ! -f "$disk" ]; then
- local size=12G
- echo "Creating (sparse) $size disk image '$disk'" >&2
- qemu-img create -f "${disk##*.}" -o size="$size",preallocation=metadata "$disk"
- fi
-
# TODO: the bus should be chosen at random among sata,ide,scsi,usb
# TODO: test EFI: http://www.linux-kvm.org/page/OVMF
local network=default ip mac
virt-install -q \
- --name "$name" \
- --arch "$ARCH" \
- --ram 128 \
- --cdrom "$cdrom" \
- --disk "$disk",cache=writeback,bus=sata \
- --network network="$network" \
- --graphics spice
+ --name "$name" \
+ --os-variant debianwheezy \
+ --arch "$ARCH" \
+ --virt-type kvm \
+ --cpu host,-invtsc \
+ --vcpu 2 \
+ --memory 512 \
+ --memballoon virtio \
+ --cdrom "$cdrom" \
+ --disk "$disk",size=12,format=raw,bus=virtio,cache=none,io=native \
+ --network network="$network",model=virtio \
+ --graphics spice \
+ --noautoconsole
# --import \
# --disk path=/dev/sdc,bus=usb,perms=ro \
@@ -138,28 +138,8 @@ install() {
view(){
[ $# -eq 1 ] || usage
- local domain="$1"
-
- if ! doesExist "$domain"; then
- cat >&2 <<- EOF
- Error: Domain $domain does not exist. To create it, run
-
- $0 install $domain
- EOF
- exit 1
- elif ! isActive "$domain"; then
- echo "Error: Domain $domain is not active" >&2
- exit 1
- fi
-
- local type=$(getXMLattr "$domain" devices/graphics type)
- local port=$(getXMLattr "$domain" devices/graphics port) || true
-
- if ! [ "$type" = spice -a "$port" ]; then
- echo "Error: Could not find a valid Spice server on domain '$domain'." >&2
- exit 1
- fi
- spicec -h 127.0.0.1 -p $port
+ virt-viewer -c "qemu+ssh://odin.guilhem.org/system" "$1"
+ # Or remotely virt-viewer -c "qemu+ssh://$username@$hostname/system" "$1"
}
[ $# -gt 0 ] || usage