Skip to content

Commit 0b56897

Browse files
author
chaoseternal
committed
minor bug of startvde
1 parent 3a5c9c2 commit 0b56897

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

bin/createkvm

+18-5
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,33 @@ do
4343
if [ -e "$VMNAME" -o -z "$VMNAME" ]
4444
then
4545
$DIALOG --title "VMNAME:ERROR" --msgbox "ERROR! The name already exists, or the input is null!" 10 30
46+
if [ -d "$VMNAME" -a -e "$VMNAME"/startvm ]
47+
then
48+
$DIALOG --title "Update" --yesno "Update existing VM settings?" 10 30
49+
if [ $? == 0 ]
50+
then
51+
UPDATEVM=1
52+
break
53+
fi
54+
fi
4655
else
4756
break
4857
fi
4958
done
5059

51-
if mkdir $VMNAME&&cd $VMNAME
60+
if [ ! x$UPDATEVM = x1 ]
5261
then
53-
$DIALOG --title "CreateKVM" --msgbox "VM dir create OK!" 10 30
62+
if mkdir $VMNAME&&cd $VMNAME
63+
then
64+
$DIALOG --title "CreateKVM" --msgbox "VM dir create OK!" 10 30
65+
else
66+
$DIALOG --title "FATAL" --msgbox "Can't create the VM dir, exiting" 10 30
67+
exit
68+
fi
5469
else
55-
$DIALOG --title "FATAL" --msgbox "Can't create the VM dir, exiting" 10 30
56-
exit
70+
cd $VMNAME
5771
fi
5872

59-
6073
VMMEMFILE=`mktemp`
6174
$DIALOG --title Memsize --inputbox "Input size of memory of the new vm, in M" 10 40 256M 2>$VMMEMFILE
6275
VMMEM=`cat $VMMEMFILE`

bin/startvde

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LOCK_F="./vdeswitch.lck"
66
CTSOCK=`readlink -f ./vde1`
77
PIDFILE="`pwd`/nic1.pid"
88
MGMTFILE="`pwd`/nic1.mgmt"
9+
USERNAME=${USERNAME-$USER}
910
HOSTTAP=hst-$USERNAME
1011
HOSTADDR=172.17.10.254
1112
HOSTMASK=255.255.255.0
@@ -28,5 +29,5 @@ NATTAP=nat-$USERNAME
2829

2930
vde_switch -s $CTSOCK -n 4 -p "$PIDFILE" -daemon -M "$MGMTFILE"
3031
sudo vde_tunctl -u $USERNAME -t "$HOSTTAP"
31-
sudo ifconfig "$HOSTTAP" "$HOSTADDR" "$HOSTMASK" up
32+
sudo /sbin/ifconfig "$HOSTTAP" "$HOSTADDR" netmask "$HOSTMASK" up
3233
vde_plug2tap -d -s $CTSOCK "$HOSTTAP"

0 commit comments

Comments
 (0)