]> gitweb.fluxo.info Git - kvm-manager.git/commitdiff
Make coding style more uniform
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 5 Jun 2016 23:49:24 +0000 (20:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 5 Jun 2016 23:49:24 +0000 (20:49 -0300)
TODO
di-maker
kvm-creator
kvm-manager
kvm-status

diff --git a/TODO b/TODO
index f10242a768c2e0d051cc98bb67a99c4036645d45..e4b2a0abcc20f075822354a2b4ce49d82e0666f9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -25,7 +25,7 @@ TODO for KVM-Manager
  * can we separate the privileges for the monitor from the privs for
    the console?
 
* can we start up the console screen first, listening on a UNIX
+ * can we start up the console screen first, listening on a UNIX
    socket, and then launch kvm with the console as a client instead
    (so that it works the other way around)?
 
index e24df356ca65ef962a2386d24b7928f5897d7cf3..c60c9a672b666c91e488b8b27cee092e96247d3f 100755 (executable)
--- a/di-maker
+++ b/di-maker
@@ -1,19 +1,17 @@
 #!/bin/bash
-
+#
 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 # Date: 2009-10-08
 # License: GPL v3+
-
+#
+# depends on grub2
 # usage:
 #  di-maker ISOFILE [FILE ...]
 #  make a new debian installer ISO, packing any additionally-supplied files into the initramfs directly
 
 set -e
 
-# depends on grub2
-
 # specify the first argument as the new installer image:
-
 output="$1"
 
 SUITE=${SUITE:-stable}
@@ -95,7 +93,6 @@ fi
 
 mkdir -p "$WORKDIR/boot/grub"
 
-
 cat > "$WORKDIR/boot/grub/grub.cfg" <<EOF
 serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
 terminal_output serial
@@ -111,4 +108,4 @@ absoutput="$(readlink -f "$output")"
 ## no longer using genisoimage with grub2:
 # genisoimage -R -input-charset utf-8 -b boot/grub/stage2_eltorito -no-emul-boot --boot-load-size 4 -boot-info-table "$WORKDIR"
 
-(cd "$WORKDIR" && grub-mkrescue --output="$absoutput" .)
+( cd "$WORKDIR" && grub-mkrescue --output="$absoutput" . )
index 0864ebed41b79eeedda4a5759b944e1c1d347919..ffd2e8963ed4ffdb2a4d036d29802008c216820e 100755 (executable)
@@ -1,10 +1,11 @@
 #!/bin/bash
-#set -x
-
+#
 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 # Date: 2009-10-08
 # License: GPL v3+
 
+#set -x
+
 CMD="$1"
 shift
 
@@ -28,32 +29,25 @@ UDEV_RULES_FILE="/etc/udev/rules.d/92-kvm_creator-%s.rules"
 [ "$CMD" == "create" ] && mkdir -p /etc/sv/kvm
 
 usage() {
-
        die "USAGE: kvm-creator create|destroy|demo guestname [volumegroup [disksize [ram] ] ]"
-
 }
 
 die() {
-
   echo "$1"
   exit_code=1
   [ -n "$2" ] && exit_code="$2"
   exit $exit_code
-
 }
 
 destroy() {
-
     update-service --remove "/etc/sv/kvm/$NAME"
     rm -rf "/etc/sv/kvm/$NAME"
     deluser --remove-home "$NAME"
     lvremove "$VG/$NAME"
     rm -f "$(udevrulename "$NAME")"
-
 }
 
 validate() {
-
   errors=""
 
   # Make sure none of the pieces already exist.
@@ -70,7 +64,6 @@ validate() {
   [ -e "$(udevrulename "$NAME")" ] && errors=$(printf "%s\n%s" "The udev rules file '$(udevrulename "$NAME")' already exists.") || :
 
   [ -z "$errors" ] || die "$errors"
-
 }
 
 udevrule() {
@@ -95,7 +88,6 @@ udevrulename() {
 }
 
 create() {
-
     set -e
     validate
     if [ "$CREATE_USER" = "yes" ]; then
@@ -139,16 +131,13 @@ EOF
     echo "$NAME" > "/etc/sv/kvm/$NAME/env/VMNAME"
     echo "$RAM" > "/etc/sv/kvm/$NAME/env/RAM"
     echo "$DISK" > "/etc/sv/kvm/$NAME/env/HDA"
-
 }
 
 demo() {
-
     validate
     for foo in NAME VG SIZE RAM DISK ; do
       echo "$foo : ${!foo}"
     done
-
 }
 
 [ "$CMD" != "create" ] && [ "$CMD" != "destroy" ] && [ "$CMD" != "demo" ] && usage
index 45c7d6607665c0cb2b694c3fe12be077802248ed..e14df40f698f2271e36960bd409f2505e8699e32 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/bash
-
-set -e
-
+#
 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 # Date: 2011-01-26
 # License: GPL v3+
@@ -13,6 +11,8 @@ set -e
 # SMP=2 # optional, specify number of CPUs
 # HDA..HDZ=/path/to/disk # optional
 
+set -e
+
 if [ -z "$VMNAME" ] ; then
     exit 1
 fi
@@ -45,14 +45,14 @@ up() {
     BOOTCHOICE=c
 
     if [ -e "$KERNEL" -a -e "$INITRD" ] ; then
-       KVMARGS="-kernel $KERNEL -initrd $INITRD"
+             KVMARGS="-kernel $KERNEL -initrd $INITRD"
         if [ "$CMDLINE" ]; then
             KERNEL_CMDLINE="$CMDLINE"
         fi
     elif [ -e "$NETBOOT" ] ; then
-       BOOTCHOICE=n
+        BOOTCHOICE=n
     elif [ -e "$CDISO" ] && [ -e $(readlink -f "$CDISO") ] ; then
-       KVMARGS="-cdrom $CDISO"
+             KVMARGS="-cdrom $CDISO"
         BOOTCHOICE=d
     fi
 
@@ -76,8 +76,8 @@ up() {
     [ -z "$HDA" ] || KVMARGS="$KVMARGS -drive file=$HDA,if=virtio,cache=none,index=$index,format=raw$first_disk_extra_args"
     # loop here on everything after HDA:
     for disk in HD{B..Z}; do
-       index=$(( $index + 1 ))
-       [ \! -b "${!disk}" ] || KVMARGS="$KVMARGS -drive file=${!disk},if=virtio,cache=none,index=$index,format=raw"
+             index=$(( $index + 1 ))
+             [ \! -b "${!disk}" ] || KVMARGS="$KVMARGS -drive file=${!disk},if=virtio,cache=none,index=$index,format=raw"
     done
 
     if [ -e /usr/share/qemu/sgabios.bin ]; then
@@ -87,7 +87,7 @@ up() {
     LOGNAME="$OWNERHOME/vms/$VMNAME/console"
     ln -sfT "$LOGNAME" ./servicelog
     if [ -e "$LOGNAME" ] ; then
-       chpst -u "$OWNER" mv "$LOGNAME" "$LOGNAME".$(date +%F_%T%z|tr : .)
+             chpst -u "$OWNER" mv "$LOGNAME" "$LOGNAME".$(date +%F_%T%z|tr : .)
     fi
     
     MONITORNAME="$OWNERHOME/vms/$VMNAME/monitor.socket"
@@ -102,7 +102,7 @@ EOF
     chpst -u "$OWNER:$OWNERGROUP:kvm" \
         /usr/bin/kvm $KVMARGS \
         -M "${MACHINE:-pc}" \
-       ${KERNEL_CMDLINE:+-append "$KERNEL_CMDLINE"} \
+             ${KERNEL_CMDLINE:+-append "$KERNEL_CMDLINE"} \
         -enable-kvm \
         -nodefaults \
         -nographic \
@@ -127,22 +127,21 @@ EOF
     trap 'kvmsend system_powerdown; wait %1' TERM
     trap 'kvmsend cont; wait %1' CONT
     trap 'kill -s TERM %1' QUIT
- # use SIGINT instead of SIGSTOP for freezing the guest because
- # trapping SIGSTOP is undefined:
- # http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_28
   # use SIGINT instead of SIGSTOP for freezing the guest because
   # trapping SIGSTOP is undefined:
   # http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_28
     trap 'kvmsend stop; wait %1' INT
     trap 'kill %1 ; kill %2' EXIT
 
     wait %1
 }
 
-
 down() {
     brctl delif "$BRIDGE" "$TAP"
     ip link set "$TAP" down
     ip tuntap del mode tap dev "$TAP"
-# no need to lock up the block device as well, since the owner might
-# prefer to manipulate the disk directly.
+    # no need to lock up the block device as well, since the owner might
+    # prefer to manipulate the disk directly.
 }
 
 log() {
index 9a2c6fc2c7371019a0abc75a06a0bc766ec73a3d..a715e8c8a450e7894bb4d4ab3479e445d9a0fd4d 100755 (executable)
@@ -18,10 +18,10 @@ function convert_ram {
   echo "SERVER RAM"
   total_ram=0
   for foo in $(ls $dir); do
-      ram=$(cat $dir/$foo/env/RAM)
-      convert_ram "$ram"
-      echo "$foo $display_ram"
-      total_ram=$(( $total_ram + $display_ram ))
+    ram=$(cat $dir/$foo/env/RAM)
+    convert_ram "$ram"
+    echo "$foo $display_ram"
+    total_ram=$(( $total_ram + $display_ram ))
   done 
   echo "TOTAL $total_ram"
 } | column -t