Changeset 195 for drbl-virt/sbin/functions_drbl_virt
- Timestamp:
- Aug 29, 2010, 2:48:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.