CLOUDSTACK-2823: pass cmdline info to system vms for 30 times

This commit is contained in:
Wei Zhou 2014-12-08 15:45:29 +01:00
parent ca5c800f8d
commit 4eedfe53fc
2 changed files with 15 additions and 18 deletions

View File

@ -3834,24 +3834,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
// pass cmdline info to system vms // pass cmdline info to system vms
if (vmSpec.getType() != VirtualMachine.Type.User) { if (vmSpec.getType() != VirtualMachine.Type.User) {
if ((conn.getVersion() < 1001000)) { // CLOUDSTACK-2823: try passCmdLine some times if kernel < 2.6.34 and qemu < 1.1.0 on hypervisor (for instance, CentOS 6.4) //wait and try passCmdLine for 5 minutes at most for CLOUDSTACK-2823
//wait for 5 minutes at most String controlIp = null;
String controlIp = null; for (NicTO nic : nics) {
for (NicTO nic : nics) { if (nic.getType() == TrafficType.Control) {
if (nic.getType() == TrafficType.Control) { controlIp = nic.getIp();
controlIp = nic.getIp(); break;
}
} }
for (int count = 0; count < 30; count++) { }
passCmdLine(vmName, vmSpec.getBootArgs()); for (int count = 0; count < 30; count++) {
//check router is up?
boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
if (result) {
break;
}
}
} else {
passCmdLine(vmName, vmSpec.getBootArgs()); passCmdLine(vmName, vmSpec.getBootArgs());
//check router is up?
boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
if (result) {
break;
}
} }
} }

View File

@ -117,7 +117,7 @@ get_boot_params() {
if [ ! -e /dev/vport0p1 ]; then if [ ! -e /dev/vport0p1 ]; then
log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2 log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
fi fi
while [$cmd -eq ""]; do while [ -z "$cmd" ]; do
while read line; do while read line; do
if [[ $line == cmdline:* ]]; then if [[ $line == cmdline:* ]]; then
cmd=${line//cmdline:/} cmd=${line//cmdline:/}
@ -128,7 +128,7 @@ get_boot_params() {
echo $pubkey > /root/.ssh/authorized_keys echo $pubkey > /root/.ssh/authorized_keys
fi fi
done < /dev/vport0p1 done < /dev/vport0p1
done done
chmod go-rwx /root/.ssh/authorized_keys chmod go-rwx /root/.ssh/authorized_keys
;; ;;
vmware) vmware)