mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
VPC : use routerProxy to call networkUsage.sh
Conflicts: core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
This commit is contained in:
parent
251a91f5b3
commit
c75fe80125
@ -239,7 +239,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
private String _createTmplPath;
|
private String _createTmplPath;
|
||||||
private String _heartBeatPath;
|
private String _heartBeatPath;
|
||||||
private String _securityGroupPath;
|
private String _securityGroupPath;
|
||||||
private String _networkUsagePath;
|
private String _routerProxyPath;
|
||||||
private String _host;
|
private String _host;
|
||||||
private String _dcId;
|
private String _dcId;
|
||||||
private String _pod;
|
private String _pod;
|
||||||
@ -543,11 +543,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
"Unable to find the security_group.py");
|
"Unable to find the security_group.py");
|
||||||
}
|
}
|
||||||
|
|
||||||
_networkUsagePath = Script.findScript("scripts/network/domr/",
|
_routerProxyPath = Script.findScript("scripts/network/domr/",
|
||||||
"networkUsage.sh");
|
"routerProxy.sh");
|
||||||
if (_networkUsagePath == null) {
|
if (_routerProxyPath == null) {
|
||||||
throw new ConfigurationException(
|
throw new ConfigurationException(
|
||||||
"Unable to find the networkUsage.sh");
|
"Unable to find the routerProxy.sh");
|
||||||
}
|
}
|
||||||
|
|
||||||
String value = (String) params.get("developer");
|
String value = (String) params.get("developer");
|
||||||
@ -2181,7 +2181,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
|
|
||||||
protected String networkUsage(final String privateIpAddress,
|
protected String networkUsage(final String privateIpAddress,
|
||||||
final String option, final String vif) {
|
final String option, final String vif) {
|
||||||
Script getUsage = new Script(_networkUsagePath, s_logger);
|
Script getUsage = new Script(_routerProxyPath, s_logger);
|
||||||
|
getUsage.add("netusage.sh");
|
||||||
|
getUsage.add(privateIpAddress);
|
||||||
if (option.equals("get")) {
|
if (option.equals("get")) {
|
||||||
getUsage.add("-g");
|
getUsage.add("-g");
|
||||||
} else if (option.equals("create")) {
|
} else if (option.equals("create")) {
|
||||||
@ -2194,7 +2196,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
|||||||
getUsage.add("-d", vif);
|
getUsage.add("-d", vif);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUsage.add("-i", privateIpAddress);
|
|
||||||
final OutputInterpreter.OneLineParser usageParser = new OutputInterpreter.OneLineParser();
|
final OutputInterpreter.OneLineParser usageParser = new OutputInterpreter.OneLineParser();
|
||||||
String result = getUsage.execute(usageParser);
|
String result = getUsage.execute(usageParser);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -1022,7 +1022,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
protected Answer execute(CheckRouterCommand cmd) {
|
protected Answer execute(CheckRouterCommand cmd) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Executing resource CheckRouterCommand: " + _gson.toJson(cmd));
|
s_logger.debug("Executing resource CheckRouterCommand: " + _gson.toJson(cmd));
|
||||||
s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/checkrouter.sh ");
|
s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/checkrouter.sh ");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Boolean, String> result;
|
Pair<Boolean, String> result;
|
||||||
|
|||||||
@ -142,7 +142,7 @@ public class XenServer56Resource extends CitrixResourceBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String networkUsage(Connection conn, final String privateIpAddress, final String option, final String vif) {
|
protected String networkUsage(Connection conn, final String privateIpAddress, final String option, final String vif) {
|
||||||
String args = null;
|
String args = "netusage.sh " + privateIpAddress + " ";
|
||||||
if (option.equals("get")) {
|
if (option.equals("get")) {
|
||||||
args = "-g";
|
args = "-g";
|
||||||
} else if (option.equals("create")) {
|
} else if (option.equals("create")) {
|
||||||
@ -157,9 +157,7 @@ public class XenServer56Resource extends CitrixResourceBase {
|
|||||||
args += vif;
|
args += vif;
|
||||||
}
|
}
|
||||||
|
|
||||||
args += " -i ";
|
return callHostPlugin(conn, "vmops", "routerProxy", "args", args);
|
||||||
args += privateIpAddress;
|
|
||||||
return callHostPlugin(conn, "vmops", "networkUsage", "args", args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
|
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
|
||||||
|
|||||||
0
patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
Normal file → Executable file
0
patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh
Normal file → Executable file
0
patches/systemvm/debian/config/root/netusage.sh → patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
Normal file → Executable file
0
patches/systemvm/debian/config/root/netusage.sh → patches/systemvm/debian/config/opt/cloud/bin/netusage.sh
Normal file → Executable file
@ -1,53 +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: networkUsage.sh 9879 2010-06-24 02:41:46Z anthony $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/vm/hypervisor/xenserver/networkUsage.sh $
|
|
||||||
# networkUsage.sh -- create iptable rules to gather network stats
|
|
||||||
usage() {
|
|
||||||
printf "Usage: %s -[c|g|r] -i <domR eth1 ip> [-[a|d] <public interface>]\n" $(basename $0) >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
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 $?;
|
|
||||||
}
|
|
||||||
|
|
||||||
cert="/root/.ssh/id_rsa.cloud"
|
|
||||||
|
|
||||||
while getopts 'cgri:a:d:' OPTION
|
|
||||||
do
|
|
||||||
case $OPTION in
|
|
||||||
i) iflag=1
|
|
||||||
domRIp="$OPTARG"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! check_gw "$domRIp"
|
|
||||||
then
|
|
||||||
printf "Unable to ping the routing domain, exiting\n" >&2
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/netusage.sh $*"
|
|
||||||
exit $?
|
|
||||||
@ -372,19 +372,6 @@ def deleteFile(session, args):
|
|||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
|
||||||
@echo
|
|
||||||
def networkUsage(session, args):
|
|
||||||
sargs = args['args']
|
|
||||||
cmd = sargs.split(' ')
|
|
||||||
cmd.insert(0, "/opt/xensource/bin/networkUsage.sh")
|
|
||||||
cmd.insert(0, "/bin/bash")
|
|
||||||
try:
|
|
||||||
txt = util.pread2(cmd)
|
|
||||||
except:
|
|
||||||
util.SMlog(" network usage error " )
|
|
||||||
txt = ''
|
|
||||||
|
|
||||||
return txt
|
|
||||||
|
|
||||||
def get_private_nic(session, args):
|
def get_private_nic(session, args):
|
||||||
vms = session.xenapi.VM.get_all()
|
vms = session.xenapi.VM.get_all()
|
||||||
@ -1442,7 +1429,7 @@ if __name__ == "__main__":
|
|||||||
"vm_data": vm_data, "savePassword": savePassword,
|
"vm_data": vm_data, "savePassword": savePassword,
|
||||||
"saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "routerProxy": routerProxy,
|
"saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "routerProxy": routerProxy,
|
||||||
"setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile,
|
"setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile,
|
||||||
"networkUsage": networkUsage, "network_rules":network_rules,
|
"network_rules":network_rules,
|
||||||
"can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
|
"can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
|
||||||
"destroy_network_rules_for_vm":destroy_network_rules_for_vm,
|
"destroy_network_rules_for_vm":destroy_network_rules_for_vm,
|
||||||
"default_network_rules_systemvm":default_network_rules_systemvm,
|
"default_network_rules_systemvm":default_network_rules_systemvm,
|
||||||
|
|||||||
@ -26,7 +26,6 @@ dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
|||||||
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
vm_data.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
|
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_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
|
|||||||
@ -24,7 +24,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
|
|||||||
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
vm_data.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
|
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_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
call_loadbalancer.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
|
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
|
|||||||
@ -23,7 +23,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
|
|||||||
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
vm_data.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
|
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_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
call_loadbalancer.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
|
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
|
|||||||
@ -28,7 +28,6 @@ pingtest.sh=../../..,0755,/opt/xensource/bin
|
|||||||
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
vm_data.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
|
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_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
call_loadbalancer.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
|
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
|
||||||
|
|||||||
2
wscript
2
wscript
@ -4,7 +4,7 @@
|
|||||||
# the following two variables are used by the target "waf dist"
|
# 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
|
# 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-06T21:28:42Z'
|
VERSION = '3.0.3.2012-06-06T23:35:14Z'
|
||||||
APPNAME = 'cloud'
|
APPNAME = 'cloud'
|
||||||
|
|
||||||
import shutil,os
|
import shutil,os
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user