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

(cherry picked from commit 4eedfe53fcbab1d47b09eacaca1d803b67b6c4d2)
This commit is contained in:
Wei Zhou 2014-12-08 15:45:29 +01:00
parent e59dac201d
commit 9bfb8e5719
2 changed files with 15 additions and 18 deletions

View File

@ -3831,24 +3831,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
// pass cmdline info to system vms
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 for 5 minutes at most
String controlIp = null;
for (NicTO nic : nics) {
if (nic.getType() == TrafficType.Control) {
controlIp = nic.getIp();
}
//wait and try passCmdLine for 5 minutes at most for CLOUDSTACK-2823
String controlIp = null;
for (NicTO nic : nics) {
if (nic.getType() == TrafficType.Control) {
controlIp = nic.getIp();
break;
}
for (int count = 0; count < 30; count++) {
passCmdLine(vmName, vmSpec.getBootArgs());
//check router is up?
boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
if (result) {
break;
}
}
} else {
}
for (int count = 0; count < 30; count++) {
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
log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
fi
while [$cmd -eq ""]; do
while [ -z "$cmd" ]; do
while read line; do
if [[ $line == cmdline:* ]]; then
cmd=${line//cmdline:/}
@ -128,7 +128,7 @@ get_boot_params() {
echo $pubkey > /root/.ssh/authorized_keys
fi
done < /dev/vport0p1
done
done
chmod go-rwx /root/.ssh/authorized_keys
;;
vmware)