cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [09/24] git commit: updated refs/heads/master to 81ff479
Date Thu, 26 Sep 2013 01:01:13 GMT
CLOUDSTACK-4436: in case of older kvm host, we'd better try serveral times to make sure we
passed cmdline parameters to system vms

Conflicts:

	core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dda1133f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dda1133f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dda1133f

Branch: refs/heads/master
Commit: dda1133f1210c25f8fc4ed4098be5e941d7a51d6
Parents: 9fa56e2
Author: Edison Su <sudison@gmail.com>
Authored: Wed Sep 25 16:10:57 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Sep 25 16:10:57 2013 -0700

----------------------------------------------------------------------
 .../virtualnetwork/VirtualRoutingResource.java  | 35 ++++++++++++++++++++
 .../kvm/resource/LibvirtComputingResource.java  | 17 ++++++----
 2 files changed, 45 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda1133f/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 0592a9b..479640a 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -1215,6 +1215,41 @@ public class VirtualRoutingResource implements Manager {
         return "Unable to connect";
     }
 
+    public boolean connect(final String ipAddress, int retry, int sleep) {
+        for (int i = 0; i <= retry; i++) {
+            SocketChannel sch = null;
+            try {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Trying to connect to " + ipAddress);
+                }
+                sch = SocketChannel.open();
+                sch.configureBlocking(true);
+
+                final InetSocketAddress addr = new InetSocketAddress(ipAddress, _port);
+                sch.connect(addr);
+                return true;
+            } catch (final IOException e) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Could not connect to " + ipAddress);
+                }
+            } finally {
+                if (sch != null) {
+                    try {
+                        sch.close();
+                    } catch (final IOException e) {}
+                }
+            }
+            try {
+                Thread.sleep(sleep);
+            } catch (final InterruptedException e) {
+            }
+        }
+
+        s_logger.debug("Unable to logon to " + ipAddress);
+
+        return false;
+    }
+
     @Override
     public String getName() {
         return _name;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dda1133f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 6a7a562..61fe71d 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3534,16 +3534,19 @@ ServerResource {
             if (vmSpec.getType() != VirtualMachine.Type.User) {
                 if ((_kernelVersion < 2006034) && (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();
+                        }
+                    }
                     for (int count = 0; count < 30; count ++) {
-                        boolean succeed = passCmdLine(vmName, vmSpec.getBootArgs());
-                        if (succeed) {
+                        passCmdLine(vmName, vmSpec.getBootArgs());
+                        //check router is up?
+                        boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
+                        if (result) {
                             break;
                         }
-                        try {
-                            Thread.sleep(5000);
-                        } catch (InterruptedException e) {
-                            s_logger.trace("Ignoring InterruptedException.", e);
-                        }
                     }
                 } else {
                     passCmdLine(vmName, vmSpec.getBootArgs() );


Mime
View raw message