cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aprat...@apache.org
Subject git commit: updated refs/heads/master to 360eae3
Date Wed, 12 Jun 2013 05:47:42 GMT
Updated Branches:
  refs/heads/master 358f3edc5 -> 360eae368


Cloudstack-2854 [Multiple_IP_Ranges] Failed to create ip alias on VR while deploying guest
vm with ip address from new CIDR

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>


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

Branch: refs/heads/master
Commit: 360eae368767f374fe13d5ba2b8a9056d0ef8633
Parents: 358f3ed
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Wed Jun 5 21:52:57 2013 +0530
Committer: Abhinandan Prateek <aprateek@apache.org>
Committed: Wed Jun 12 11:15:47 2013 +0530

----------------------------------------------------------------------
 .../virtualnetwork/VirtualRoutingResource.java  | 50 ++++++++++++--------
 scripts/network/domr/call_dnsmasq.sh            | 29 ++++++++++++
 scripts/network/domr/createipAlias.sh           | 26 ++++++++++
 scripts/network/domr/deleteipAlias.sh           | 25 ++++++++++
 4 files changed, 109 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/360eae36/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 9e40eef..dae1c85 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -111,7 +111,7 @@ public class VirtualRoutingResource implements Manager {
     private String _routerProxyPath;
     private String _createIpAliasPath;
     private String _deleteIpAliasPath;
-    private String _configDhcpPath;
+    private String _callDnsMasqPath;
 
     private int _timeout;
     private int _startTimeout;
@@ -625,7 +625,8 @@ public class VirtualRoutingResource implements Manager {
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
         final Script command  = new Script(_createIpAliasPath, _timeout, s_logger);
         List<IpAliasTO> ipAliasTOs = cmd.getIpAliasList();
-        String args=routerIp+" ";
+        String args = "";
+        command.add(routerIp);
         for (IpAliasTO ipaliasto : ipAliasTOs) {
             args = args + ipaliasto.getAlias_count()+":"+ipaliasto.getRouterip()+":"+ipaliasto.getNetmask()+"-";
         }
@@ -637,7 +638,8 @@ public class VirtualRoutingResource implements Manager {
     protected Answer execute(final DeleteIpAliasCommand cmd) {
         final Script command  = new Script(_deleteIpAliasPath, _timeout, s_logger);
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
-        String args = "";
+        String args ="";
+        command.add(routerIp);
         List<IpAliasTO> revokedIpAliasTOs = cmd.getDeleteIpAliasTos();
         for (IpAliasTO ipAliasTO : revokedIpAliasTOs) {
             args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
@@ -653,32 +655,26 @@ public class VirtualRoutingResource implements Manager {
     }
 
     protected Answer execute(final DnsMasqConfigCommand cmd) {
-        final Script command  = new Script(_configDhcpPath, _timeout, s_logger);
+        final Script command  = new Script(_callDnsMasqPath, _timeout, s_logger);
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
         DnsMasqConfigurator configurator = new DnsMasqConfigurator();
         String [] config = configurator.generateConfiguration(cmd);
-        File tmpCfgFile = null;
+        String cfgFileName = routerIp.replace(".","-")+"dns.cgf";
+        String tmpCfgFileContents = "";
+        for (int i = 0; i < config.length; i++) {
+            tmpCfgFileContents += config[i];
+            tmpCfgFileContents += "\n";
+        }
+        File permKey = new File("/root/.ssh/id_rsa.cloud");
+        String cfgFilePath = "/tmp/"+cfgFileName;
         try {
-            String cfgFilePath = "";
-            if (routerIp != null) {
-                tmpCfgFile = File.createTempFile(routerIp.replace('.', '_'), "cfg");
-                final PrintWriter out
-                        = new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile)));
-                for (int i=0; i < config.length; i++) {
-                    out.println(config[i]);
-                }
-                out.close();
-                cfgFilePath = tmpCfgFile.getAbsolutePath();
-            }
+            SshHelper.scpTo(routerIp, 3922, "root", permKey, null, "/tmp/", tmpCfgFileContents.getBytes(),
cfgFileName, null);
+            command.add(routerIp);
             command.add(cfgFilePath);
             final String result = command.execute();
             return new Answer(cmd, result == null, result);
-        } catch (final IOException e) {
+        } catch (Exception e) {
             return new Answer(cmd, false, e.getMessage());
-        } finally {
-            if (tmpCfgFile != null) {
-                tmpCfgFile.delete();
-            }
         }
     }
 
@@ -1209,6 +1205,18 @@ public class VirtualRoutingResource implements Manager {
         if (_routerProxyPath == null) {
             throw new ConfigurationException("Unable to find router_proxy.sh");
         }
+        _createIpAliasPath = findScript("createipAlias.sh");
+        if (_createIpAliasPath == null) {
+            throw new ConfigurationException("unable to find createipAlias.sh");
+        }
+        _deleteIpAliasPath = findScript("deleteipAlias.sh");
+        if (_deleteIpAliasPath == null) {
+            throw  new ConfigurationException("unable to find deleteipAlias.sh");
+        }
+        _callDnsMasqPath = findScript("call_dnsmasq.sh");
+        if (_callDnsMasqPath == null) {
+            throw  new ConfigurationException("unable to find call_dnsmasq.sh");
+        }
         
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/360eae36/scripts/network/domr/call_dnsmasq.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/call_dnsmasq.sh b/scripts/network/domr/call_dnsmasq.sh
new file mode 100755
index 0000000..097e185
--- /dev/null
+++ b/scripts/network/domr/call_dnsmasq.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+usage() {
+  printf "Usage: %s:  <domR eth1 ip>  <path_to_new_config_file>\n" $(basename
$0) >&2
+}
+
+set -x
+
+cert="/root/.ssh/id_rsa.cloud"
+
+ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/dnsmasq.sh $2"	 
+exit $?
+      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/360eae36/scripts/network/domr/createipAlias.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/createipAlias.sh b/scripts/network/domr/createipAlias.sh
new file mode 100755
index 0000000..c35658e
--- /dev/null
+++ b/scripts/network/domr/createipAlias.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+usage() {
+  printf " %s  routerip  <alias_count:ip:netmask;alias_count2:ip2:netmask2;....> \n"
$(basename $0) >&2
+}
+
+set -x
+cert="/root/.ssh/id_rsa.cloud"
+ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/createIpAlias.sh $2"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/360eae36/scripts/network/domr/deleteipAlias.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/deleteipAlias.sh b/scripts/network/domr/deleteipAlias.sh
new file mode 100755
index 0000000..6816edd
--- /dev/null
+++ b/scripts/network/domr/deleteipAlias.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+usage() {
+  printf " %s  routerip  <alias_count:ip:netmask;alias_count2:ip2:netmask2;....> \n"
$(basename $0) >&2
+}
+
+set -x
+cert="/root/.ssh/id_rsa.cloud"
+ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/deleteIpAlias.sh $2 $3"


Mime
View raw message