Changeset 195 for drbl-virt/sbin
- Timestamp:
- Aug 29, 2010, 2:48:03 PM (14 years ago)
- Location:
- drbl-virt/sbin
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
drbl-virt/sbin/drbl_PXE_PV-VM_create.sh
r193 r195 11 11 # [Source] 12 12 source /opt/drbl-virt/conf/drbl-virt.conf 13 #source $Work_Path/functions_drbl_PXE_PV-VM_create 14 source ./functions_drbl_PXE_PV-VM_create13 source $Work_Path/functions_drbl_virt 14 #source ./functions_drbl_PXE_PV-VM_create 15 15 16 16 … … 28 28 echo "Usage: drbl_PXE_PV-VM_create.sh options" 29 29 echo "Options: " 30 echo "-v vm name"31 echo "-c cpu number"32 echo "-r ram size"33 echo "-h deploy vm to which host"30 echo "-v|--vm vm name" 31 echo "-c|--cpu cpu number" 32 echo "-r|--ram ram size" 33 echo "-h|--host deploy vm to which host" 34 34 echo "Examples: " 35 35 echo "drbl_PXE_PV-VM_create.sh options -v drbl110 -c 2 -r 512 -h drbl101" … … 46 46 while [ $# -gt 0 ]; do 47 47 case "$1" in 48 -v )48 -v|--vm) 49 49 shift 50 50 if [ -z "$(echo $1 |grep ^-.)" ]; then … … 58 58 fi 59 59 ;; 60 -c )60 -c|--cpu) 61 61 shift 62 62 if [ -z "$(echo $1 |grep ^-.)" ]; then … … 70 70 fi 71 71 ;; 72 -r )72 -r|--ram) 73 73 shift 74 74 if [ -z "$(echo $1 |grep ^-.)" ]; then … … 82 82 fi 83 83 ;; 84 -h )84 -h|--host) 85 85 shift 86 86 if [ -z "$(echo $1 |grep ^-.)" ]; then … … 138 138 fi 139 139 140 vm_cfg=${vm_dir}/${vm_name} .cfg140 vm_cfg=${vm_dir}/${vm_name}_PXE_PV-VM.cfg 141 141 142 142 if [ -e $vm_cfg ]; then -
drbl-virt/sbin/drbl_xen_repush.sh
r190 r195 30 30 cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 31 31 cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /etc/drbl/IP_HOST_TABLE 32 cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /opt/drbl-virt/etc/IP_HOST_TABLE 32 33 else 33 34 cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.drbl-virt_bak 35 cp /etc/drbl/IP_HOST_TABLE /opt/drbl-virt/etc/IP_HOST_TABLE 34 36 fi 35 37 -
drbl-virt/sbin/functions_drbl_virt
r190 r195 16 16 VMM_select="" 17 17 18 18 19 # [Check Root] 19 20 function check_root(){ … … 24 25 } 25 26 27 # [Change root to run] 26 28 function check_root_run(){ 27 29 if [ $USER != "root" ]; then … … 41 43 } 42 44 45 43 46 # [Check System Version] 44 47 function check_systemInfo(){ … … 47 50 Linux_Version=$(lsb_release -r | awk '{print $2}') 48 51 } 52 49 53 50 54 # [Select Hypervisior(Xen/KVM)] … … 70 74 } 71 75 76 72 77 # [Check Hypervisior] 73 78 function check_hypervisior(){ … … 140 145 141 146 147 # [Tunning Debain env for Xen] 142 148 function debain-lenny_xen_patch(){ 143 149 echo xen.independent_wallclock=1 >> /etc/sysctl.conf … … 148 154 149 155 156 # [Get ethX for DRBL environment usage ] 150 157 function get_DRBL_eth(){ 151 158 eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt$ | cut -d "-" -f2 | cut -d "." -f1) … … 160 167 } 161 168 169 170 # [Get DRBL client IP range] 162 171 function get_Host_IP_range(){ 163 172 if [ ! -e /usr/bin/ipcalc ] || [ ! -e /opt/drbl/bin/drbl-get-network ] || [ ! -e /opt/drbl/bin/drbl-get-ipadd ]; then … … 175 184 } 176 185 186 187 # [Input VM IP range] 177 188 function get_VM_IP_range_and_prefix_name(){ 178 179 189 echo "" 180 190 echo "DRBL client IP range -> $eth: [$Host_first_IP ~ $Host_last_IP]" … … 213 223 214 224 225 # [Get VM prefix name] 215 226 #function get_VM_prefix_name(){ 216 227 #jude="no" … … 224 235 #} 225 236 237 238 # [Create VM IP table] 226 239 function create_VM_IP_table(){ 227 240 #/etc/drbl-virt/etc/IP_VM_eth … … 271 284 } 272 285 286 287 # [Creat VM Mac table] 273 288 function generate_Xen_MAC_address(){ 274 289 #echo "eth $eth" … … 312 327 } 313 328 329 314 330 #function add_VM_dhcpd_conf(){ 315 331 ## backup dhcpd.conf … … 353 369 } 354 370 371 372 # [create ssh key amd cpoy to client] 373 function drbl_sshkey(){ 374 # The reasone we do not to use $HOME is that sudo will not change 375 # environmental variable $HOME, but it will change the $USER 376 # we need to know who is really running this after applying sudo. 377 # say, sudo echo "$HOME", it will show user's home, instead of root's home, 378 REALHOME=$(LC_ALL=C grep -Ew "^$USER" /etc/passwd | cut -d":" -f6) 379 drblroot="/tftpboot/nodes" 380 381 if [ ! -f $REALHOME/.ssh/id_rsa ]; then 382 ssh-keygen -t rsa -q -f $REALHOME/.ssh/id_rsa -N "" 383 fi 384 385 # Put authorized_keys for the user. 2 cases: 386 # (1). It is root running drbl-doit. 387 # (2). It is normal user running drbl-doit. 388 # For root, we will NOT copy authorized_keys in server, since the root in the client should not share the same authorized_keys with that in server. We only put them in the client. (Note! Every client has its own root directory in $ihost/root/) 389 # For normal user, we let user can ssh login back to server and other machine without password (Note! This is NFS-based home, so we just have to copy id_rsa.pub as authorized_keys in user's home, then no matter which machine user logins, it will use this key). 390 if [ "$UID" = "0" ]; then 391 # for root, copy id_rsa.pub as authorized_keys in clients. 392 for ihost in $drblroot/*; do 393 if [ -f "$REALHOME/.ssh/id_rsa.pub" ]; then 394 mkdir -p $ihost/root/.ssh 395 cp -af $REALHOME/.ssh/id_rsa.pub $ihost/root/.ssh/authorized_keys 396 fi 397 done 398 else 399 if [ -f "$REALHOME/.ssh/id_rsa.pub" ]; then 400 cp -af $REALHOME/.ssh/id_rsa.pub $REALHOME/.ssh/authorized_keys 401 fi 402 fi 403 404 }
Note: See TracChangeset
for help on using the changeset viewer.