You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by se...@apache.org on 2013/07/12 09:51:45 UTC
[50/50] git commit: updated refs/heads/sdnextensions to bcfb4e6
make SDN GRE work with XCP 1.6
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bcfb4e67
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bcfb4e67
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bcfb4e67
Branch: refs/heads/sdnextensions
Commit: bcfb4e67cb8c15102cdebae470c5684d585e619a
Parents: bdc7e4c
Author: tuna <ng...@gmail.com>
Authored: Wed Jul 10 22:18:18 2013 +0700
Committer: Sebastien Goasguen <ru...@gmail.com>
Committed: Fri Jul 12 03:50:28 2013 -0400
----------------------------------------------------------------------
.../xen/resource/CitrixResourceBase.java | 28 +++++++++--
scripts/vm/hypervisor/xenserver/ovstunnel | 49 ++++++++++++++++----
scripts/vm/hypervisor/xenserver/xcposs/patch | 4 ++
scripts/vm/hypervisor/xenserver/xcpserver/patch | 4 ++
.../vm/hypervisor/xenserver/xenserver56/patch | 3 ++
.../hypervisor/xenserver/xenserver56fp1/patch | 4 ++
6 files changed, 79 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index d6d0523..cda5711 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -925,8 +925,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
} else {
vswitchNw = networks.iterator().next();
}
-
- enableXenServerNetwork(conn, vswitchNw, "vswitch", "vswitch network");
+ if (!is_xcp())
+ enableXenServerNetwork(conn, vswitchNw, "vswitch", "vswitch network");
_host.vswitchNetwork = vswitchNw;
}
return _host.vswitchNetwork;
@@ -960,7 +960,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
rec.otherConfig = otherConfig;
nw = Network.create(conn, rec);
// Plug dom0 vif only when creating network
- enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
+ if (!is_xcp())
+ enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
s_logger.debug("### Xen Server network for tunnels created:" + nwName);
} else {
nw = networks.iterator().next();
@@ -996,7 +997,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
if (!configured) {
// Plug dom0 vif only if not done before for network and host
- enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
+ if (!is_xcp())
+ enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
String result = callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge", "bridge", bridge,
"key", String.valueOf(key),
"xs_nw_uuid", nw.getUuid(conn),
@@ -5786,6 +5788,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
private OvsFetchInterfaceAnswer execute(OvsFetchInterfaceCommand cmd) {
String label = cmd.getLabel();
+ //FIXME: this is a tricky to pass the network checking in XCP. I temporary get default label from Host.
+ if (is_xcp()) {
+ label = getLabel();
+ }
s_logger.debug("Will look for network with name-label:" + label + " on host " + _host.ip);
Connection conn = getConnection();
try {
@@ -8599,4 +8605,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
@Override
public void setRunLevel(int level) {
}
+
+ private boolean is_xcp() {
+ Connection conn = getConnection();
+ String result = callHostPlugin(conn, "ovstunnel", "is_xcp");
+ if (result.equals("XCP"))
+ return true;
+ return false;
+ }
+
+ private String getLabel() {
+ Connection conn = getConnection();
+ String result = callHostPlugin(conn, "ovstunnel", "getLabel");
+ return result;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/scripts/vm/hypervisor/xenserver/ovstunnel
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/ovstunnel b/scripts/vm/hypervisor/xenserver/ovstunnel
index ddcaa5b..9a89630 100755
--- a/scripts/vm/hypervisor/xenserver/ovstunnel
+++ b/scripts/vm/hypervisor/xenserver/ovstunnel
@@ -22,6 +22,7 @@
import cloudstack_pluginlib as lib
import logging
+import commands
import os
import sys
import subprocess
@@ -107,14 +108,15 @@ def setup_ovs_bridge(session, args):
"other-config:ovs-host-setup=%s" % conf_hosts])
# BLOCK IPv6 - Flow spec changes with ovs version
- host_list_cmd = [lib.XE_PATH, 'host-list', '--minimal']
- host_list_str = lib.do_cmd(host_list_cmd)
- host_uuid = host_list_str.split(',')[0].strip()
- version_cmd = [lib.XE_PATH, 'host-param-get', 'uuid=%s' % host_uuid,
- 'param-name=software-version',
- 'param-key=product_version']
- version = lib.do_cmd(version_cmd).split('.')[0]
- block_ipv6_handlers[version](bridge)
+ # Temporarily no need BLOCK IPv6
+# host_list_cmd = [lib.XE_PATH, 'host-list', '--minimal']
+# host_list_str = lib.do_cmd(host_list_cmd)
+# host_uuid = host_list_str.split(',')[0].strip()
+# version_cmd = [lib.XE_PATH, 'host-param-get', 'uuid=%s' % host_uuid,
+# 'param-name=software-version',
+# 'param-key=product_version']
+# version = lib.do_cmd(version_cmd).split('.')[0]
+# block_ipv6_handlers[version](bridge)
logging.debug("Setup_ovs_bridge completed with result:%s" % result)
return result
@@ -253,9 +255,38 @@ def get_field_of_interface(iface_name, field):
res = lib.do_cmd(get_iface_cmd)
return res
+def is_xcp(session, args):
+ host_list_cmd = [lib.XE_PATH, 'host-list', '--minimal']
+ host_list_str = lib.do_cmd(host_list_cmd)
+ host_uuid = host_list_str.split(',')[0].strip()
+
+ status, output = commands.getstatusoutput("xe host-param-list uuid="+host_uuid+" | grep platform_name")
+ if (status != 0):
+ return "FALSE"
+
+ platform_cmd = [lib.XE_PATH, 'host-param-get', 'uuid=%s' % host_uuid,
+ 'param-name=software-version',
+ 'param-key=platform_name']
+ platform = lib.do_cmd(platform_cmd).split('.')[0]
+ return platform
+
+def getLabel(session, args):
+ pif_list_cmd = [lib.XE_PATH, 'pif-list', '--minimal']
+ pif_list_str = lib.do_cmd(pif_list_cmd)
+ pif_uuid = pif_list_str.split(',')[0].strip()
+ network_cmd = [lib.XE_PATH, 'pif-param-get', 'uuid=%s' % pif_uuid,
+ 'param-name=network-uuid']
+ network_uuid = lib.do_cmd(network_cmd).split('.')[0]
+
+ label_cmd = [lib.XE_PATH, 'network-param-get', 'uuid=%s' % network_uuid,
+ 'param-name=name-label']
+ label = lib.do_cmd(label_cmd).split('.')[0]
+ return label
if __name__ == "__main__":
XenAPIPlugin.dispatch({"create_tunnel": create_tunnel,
"destroy_tunnel": destroy_tunnel,
"setup_ovs_bridge": setup_ovs_bridge,
- "destroy_ovs_bridge": destroy_ovs_bridge})
+ "destroy_ovs_bridge": destroy_ovs_bridge,
+ "is_xcp": is_xcp,
+ "getLabel": getLabel})
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/scripts/vm/hypervisor/xenserver/xcposs/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/patch b/scripts/vm/hypervisor/xenserver/xcposs/patch
index 4d07c76..4c9eb4f 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/patch
+++ b/scripts/vm/hypervisor/xenserver/xcposs/patch
@@ -67,3 +67,7 @@ getDomRVersion.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
router_proxy.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
createipAlias.sh=..,0755,/usr/lib/xcp/bin
deleteipAlias.sh=..,0755,/usr/lib/xcp/bin
+
+###add cloudstack plugin script for XCP
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index 7e92d5a..1b1b00a 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -65,3 +65,7 @@ getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin
bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+
+###add cloudstack plugin script for XCP
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index 8abd6b2..ee8cd13 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -67,3 +67,6 @@ swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+###add cloudstack plugin script for XCP
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfb4e67/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index 901f6de..588a2a3 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -66,3 +66,7 @@ swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+###add cloudstack plugin script for XCP
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
+