You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/06/16 00:38:03 UTC

[40/51] [abbrv] git commit: VPC : introduce router_proxy.sh, resource should use this as a proxy to call scripts inside domr already did this for ipassoc and getDomRVersion

VPC : introduce router_proxy.sh, resource should use this as a proxy to call scripts inside domr
      already did this for ipassoc and getDomRVersion


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

Branch: refs/heads/vpc
Commit: 8c1700a3a4b511af433b72e7419ad6441ef14d42
Parents: 31b8f07
Author: anthony <an...@cloud.com>
Authored: Tue Jun 5 17:26:19 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Jun 15 14:22:49 2012 -0700

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java           |    8 +-
 scripts/network/domr/getDomRVersion.sh             |   42 -----------
 scripts/network/domr/ipassoc.sh                    |   52 --------------
 scripts/network/domr/router_proxy.sh               |   54 +++++++++++++++
 scripts/vm/hypervisor/xenserver/vmops              |   53 ++++++--------
 scripts/vm/hypervisor/xenserver/xenserver56/patch  |    3 +-
 .../vm/hypervisor/xenserver/xenserver56fp1/patch   |    3 +-
 scripts/vm/hypervisor/xenserver/xenserver60/patch  |    3 +-
 wscript                                            |    2 +-
 9 files changed, 84 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 4a61633..89b197d 100644
--- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -1359,8 +1359,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
     private GetDomRVersionAnswer execute(GetDomRVersionCmd cmd) {
         Connection conn = getConnection();
-        String args = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
-        String result = callHostPlugin(conn, "vmops", "getDomRVersion", "args", args);
+        String args = "get_template_version.sh " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+        String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
         if (result == null || result.isEmpty()) {
             return new GetDomRVersionAnswer(cmd, "getDomRVersionCmd failed");
         }
@@ -1732,7 +1732,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with.");
             }
 
-            String args = privateIpAddress;
+            String args = "ipassoc.sh " + privateIpAddress;
 
             if (add) {
                 args += " -A ";
@@ -1758,7 +1758,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             args += vlanGateway;
             
 
-            String result = callHostPlugin(conn, "vmops", "ipassoc", "args", args);
+            String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args);
             if (result == null || result.isEmpty()) {
                 throw new InternalErrorException("Xen plugin \"ipassoc\" failed.");
             }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/network/domr/getDomRVersion.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/getDomRVersion.sh b/scripts/network/domr/getDomRVersion.sh
deleted file mode 100755
index e11e052..0000000
--- a/scripts/network/domr/getDomRVersion.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-usage() {
-  printf "Usage:\n %s <domR eth1 ip> \n" $(basename $0) >&2
-  printf " %s <domR eth1 ip> \n" $(basename $0) >&2
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-domRIp=$1
-shift
-
-check_gw() {
-  ping -c 1 -n -q $1 > /dev/null
-  if [ $? -gt 0 ]
-  then
-    sleep 1
-    ping -c 1 -n -q $1 > /dev/null
-  fi
-  return $?;
-}
-
-
-check_gw "$domRIp"
-if [ $? -gt 0 ]
-then
-  exit 1
-fi
-
-ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/opt/cloud/bin/get_template_version.sh"
-exit $?

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/network/domr/ipassoc.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/ipassoc.sh b/scripts/network/domr/ipassoc.sh
deleted file mode 100755
index 592b56c..0000000
--- a/scripts/network/domr/ipassoc.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License.  Citrix Systems, Inc.
-# reserves all rights not expressly granted by 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.
-# 
-# Automatically generated by addcopyright.py at 04/03/2012
-
-
-
- 
-
-# $Id: ipassoc.sh 9804 2010-06-22 18:36:49Z alex $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/network/domr/ipassoc.sh $
-# ipassoc.sh -- associate/disassociate a public ip with an instance
-# 2.1.4
-usage() {
-  printf "Usage:\n %s -A  -i <domR eth1 ip>  -l <public-ip-address>  -r <domr name> [-f] \n" $(basename $0) >&2
-  printf " %s -D -i <domR eth1 ip> -l <public-ip-address> -r <domr name> [-f] \n" $(basename $0) >&2
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-domRIp=$1
-shift
-
-
-check_gw() {
-  ping -c 1 -n -q $1 > /dev/null
-  if [ $? -gt 0 ]
-  then
-    sleep 1
-    ping -c 1 -n -q $1 > /dev/null
-  fi
-  return $?;
-}
-
-
-check_gw "$domRIp"
-if [ $? -gt 0 ]
-then
-  exit 1
-fi
-
-
-ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/ipassoc.sh $*"
-exit $?
-

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/network/domr/router_proxy.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/router_proxy.sh b/scripts/network/domr/router_proxy.sh
new file mode 100755
index 0000000..175cb6b
--- /dev/null
+++ b/scripts/network/domr/router_proxy.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Copyright 2012 Citrix Systems, Inc. Licensed under the
+# Apache License, Version 2.0 (the "License"); you may not use this
+# file except in compliance with the License.  Citrix Systems, Inc.
+# reserves all rights not expressly granted by 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.
+# 
+# Automatically generated by addcopyright.py at 04/03/2012
+
+
+
+# used as a proxy to call script inside virtual router 
+
+#set -x
+
+check_gw() {
+  ping -c 1 -n -q $1 > /dev/null
+  if [ $? -gt 0 ]
+  then
+    sleep 1
+    ping -c 1 -n -q $1 > /dev/null
+  fi
+  if [ $? -gt 0 ]
+  then
+    exit 1
+  fi
+}
+
+cert="/root/.ssh/id_rsa.cloud"
+
+script=$1
+shift
+
+domRIp=$1
+shift
+
+check_gw "$domRIp"
+
+ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/$script $*"
+exit $?
+
+
+
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 0872edb..b99b766 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -140,21 +140,6 @@ def pingxenserver(session, args):
     return txt
 
 @echo
-def ipassoc(session, args):
-    sargs = args['args']
-    cmd = sargs.split(' ')
-    cmd.insert(0, "/opt/xensource/bin/ipassoc.sh")
-    cmd.insert(0, "/bin/bash")
-    try:
-        txt = util.pread2(cmd)
-        txt = 'success'
-    except:
-        util.SMlog("  ip associate failed "  )
-        txt = '' 
-
-    return txt
-
-@echo
 def vm_data(session, args):
     router_ip = args.pop('routerIP')
     vm_ip = args.pop('vmIP')
@@ -306,6 +291,8 @@ def setLinkLocalIP(session, args):
         txt = '' 
     txt = 'success'
     return txt
+
+
     
 @echo
 def setFirewallRule(session, args):
@@ -321,6 +308,23 @@ def setFirewallRule(session, args):
         txt = '' 
 
     return txt
+    
+@echo
+def routerProxy(session, args):
+    sargs = args['args']
+    cmd = sargs.split(' ')
+    cmd.insert(0, "/opt/xensource/bin/router_proxy.sh")
+    cmd.insert(0, "/bin/bash")
+    try:
+        txt = util.pread2(cmd)
+        txt = 'success'
+    except:
+        util.SMlog("routerProxy command " + sargs + " failed "  )
+        txt = '' 
+
+    return txt
+
+
 
 @echo
 def setLoadBalancerRule(session, args):
@@ -1444,26 +1448,13 @@ def bumpUpPriority(session, args):
 
     return txt
 
-@echo
-def getDomRVersion(session, args):
-    sargs = args['args']
-    cmd = sargs.split(' ')
-    cmd.insert(0, "/opt/xensource/bin/getDomRVersion.sh")
-    cmd.insert(0, "/bin/bash")
-    try:
-        txt = util.pread2(cmd)
-    except:
-        util.SMlog("  get domR version fail! ")
-        txt = '' 
-
-    return txt
 
 if __name__ == "__main__":
      XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, 
                             "getvncport": getvncport, "getgateway": getgateway, "preparemigration": preparemigration, 
                             "setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,  
-                            "ipassoc": ipassoc, "vm_data": vm_data, "savePassword": savePassword, 
-                            "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, 
+                            "vm_data": vm_data, "savePassword": savePassword, 
+                            "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "routerProxy": routerProxy, 
                             "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, 
                             "networkUsage": networkUsage, "network_rules":network_rules, 
                             "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
@@ -1472,5 +1463,5 @@ if __name__ == "__main__":
                             "get_rule_logs_for_vms":get_rule_logs_for_vms, 
                             "setLinkLocalIP":setLinkLocalIP, "lt2p_vpn":lt2p_vpn,
                             "cleanup_rules":cleanup_rules, "checkRouter":checkRouter,
-                            "bumpUpPriority":bumpUpPriority, "getDomRVersion":getDomRVersion,
+                            "bumpUpPriority":bumpUpPriority,
                             "kill_copy_process":kill_copy_process})

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index b06f0ea..a7dac08 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -22,12 +22,12 @@ setup_iscsi.sh=..,0755,/opt/xensource/bin
 cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
 pingtest.sh=../../..,0755,/opt/xensource/bin
 dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-ipassoc.sh=../../../../network/domr/,0755,/opt/xensource/bin
 vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
 save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
 networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
 l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
 copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
 copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
@@ -46,6 +46,5 @@ cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
 cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
 getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin
 bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
 swift=..,0755,/opt/xensource/bin
 swiftxen=..,0755,/etc/xapi.d/plugins

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index dbc6581..9d4554d 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -21,12 +21,12 @@ make_migratable.sh=..,0755,/opt/xensource/bin
 setup_iscsi.sh=..,0755,/opt/xensource/bin
 pingtest.sh=../../..,0755,/opt/xensource/bin
 dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-ipassoc.sh=../../../../network/domr/,0755,/opt/xensource/bin
 vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
 save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
 networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
 l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
 cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
 copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
@@ -45,6 +45,5 @@ cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
 cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
 getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin
 bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
 swift=..,0755,/opt/xensource/bin
 swiftxen=..,0755,/etc/xapi.d/plugins

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/scripts/vm/hypervisor/xenserver/xenserver60/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch b/scripts/vm/hypervisor/xenserver/xenserver60/patch
index 88d33c8..f087c3a 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver60/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch
@@ -27,12 +27,12 @@ make_migratable.sh=..,0755,/opt/xensource/bin
 setup_iscsi.sh=..,0755,/opt/xensource/bin
 pingtest.sh=../../..,0755,/opt/xensource/bin
 dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-ipassoc.sh=../../../../network/domr/,0755,/opt/xensource/bin
 vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
 save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
 networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
 call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
+router_proxy=../../../../network/domr/,0755,/opt/xensource/bin
 l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
 cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
 copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
@@ -51,6 +51,5 @@ cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
 cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
 getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin
 bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
 swift=..,0755,/opt/xensource/bin
 swiftxen=..,0755,/etc/xapi.d/plugins

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c1700a3/wscript
----------------------------------------------------------------------
diff --git a/wscript b/wscript
index f1c27f7..5708656 100644
--- a/wscript
+++ b/wscript
@@ -4,7 +4,7 @@
 # the following two variables are used by the target "waf dist"
 # if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog
 
-VERSION = '3.0.3.2012-06-05T23:07:27Z'
+VERSION = '3.0.3.2012-06-06T00:22:14Z'
 APPNAME = 'cloud'
 
 import shutil,os