mirror of https://github.com/apache/cloudstack.git
make SDN GRE work with XCP 1.6
This commit is contained in:
parent
587f587621
commit
79a7ce871e
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue