You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by tu...@apache.org on 2013/12/09 17:52:40 UTC
[14/21] git commit: updated refs/heads/master to 267ff79
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/79a7ce87
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79a7ce87
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79a7ce87
Branch: refs/heads/master
Commit: 79a7ce871eb69531d45ec7ef2137e460fd592956
Parents: 587f587
Author: tuna <ng...@gmail.com>
Authored: Wed Jul 10 22:18:18 2013 +0700
Committer: tuna <ng...@gmail.com>
Committed: Mon Dec 9 23:33:14 2013 +0700
----------------------------------------------------------------------
framework/rest/.gitignore | 1 +
.../xen/resource/CitrixResourceBase.java | 35 +++++++++++---
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 ++
7 files changed, 84 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79a7ce87/framework/rest/.gitignore
----------------------------------------------------------------------
diff --git a/framework/rest/.gitignore b/framework/rest/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/framework/rest/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79a7ce87/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 6bc8326..4845969 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
@@ -936,8 +936,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;
@@ -971,7 +971,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();
@@ -1007,10 +1008,12 @@ 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);
- String result =
- callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge", "bridge", bridge, "key", String.valueOf(key), "xs_nw_uuid", nw.getUuid(conn), "cs_host_id",
- ((Long)hostId).toString());
+ 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),
+ "cs_host_id", ((Long)hostId).toString());
//Note down the fact that the ovs bridge has been setup
String[] res = result.split(":");
if (res.length != 2 || !res[0].equalsIgnoreCase("SUCCESS")) {
@@ -5864,6 +5867,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 {
@@ -8734,4 +8741,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/79a7ce87/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/79a7ce87/scripts/vm/hypervisor/xenserver/xcposs/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/patch b/scripts/vm/hypervisor/xenserver/xcposs/patch
index aa551de..efb4a18 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/patch
+++ b/scripts/vm/hypervisor/xenserver/xcposs/patch
@@ -66,3 +66,7 @@ getDomRVersion.sh=../../../../network/domr/,0755,/opt/cloud/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/cloud/bin
createipAlias.sh=..,0755,/opt/cloud/bin
deleteipAlias.sh=..,0755,/opt/cloud/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/79a7ce87/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index 478807f..45ff59d 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -64,3 +64,7 @@ getRouterStatus.sh=../../../../network/domr/,0755,/opt/cloud/bin
bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloud/bin
getDomRVersion.sh=../../../../network/domr/,0755,/opt/cloud/bin
add_to_vcpus_params_live.sh=..,0755,/opt/cloud/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/79a7ce87/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index e593a5c..602cb99 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -66,3 +66,6 @@ swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/cloud/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/79a7ce87/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index b210a88..8e72c00 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -65,3 +65,7 @@ swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/cloud/bin
+###add cloudstack plugin script for XCP
+cloudstack_plugins.conf=..,0644,/etc/xensource
+cloudstack_pluginlib.py=..,0755,/etc/xapi.d/plugins
+