You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/11/13 02:57:12 UTC
[1/3] git commit: updated refs/heads/4.2-workplace to ed5aaea
Updated Branches:
refs/heads/4.2-workplace [created] ed5aaea41
Create a seperate directory in XS host to save scripts from CS
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3d93563d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3d93563d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3d93563d
Branch: refs/heads/4.2-workplace
Commit: 3d93563d5b75a37e72bda1a05c4146579a2dab7f
Parents: 4cb3115
Author: Anthony Xu <an...@citrix.com>
Authored: Mon Nov 11 16:24:16 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Tue Nov 12 11:20:35 2013 -0800
----------------------------------------------------------------------
.../xen/resource/CitrixResourceBase.java | 6 ++
.../create_privatetemplate_from_snapshot.sh | 2 +-
scripts/vm/hypervisor/xenserver/launch_hb.sh | 4 +-
scripts/vm/hypervisor/xenserver/ovs-pvlan | 13 ++--
.../xenserver/setup_heartbeat_file.sh | 2 +-
.../vm/hypervisor/xenserver/setupxenserver.sh | 2 +-
scripts/vm/hypervisor/xenserver/swiftxen | 2 +-
.../vm/hypervisor/xenserver/upgrade_snapshot.sh | 2 +-
scripts/vm/hypervisor/xenserver/vmops | 32 ++++-----
scripts/vm/hypervisor/xenserver/vmopsSnapshot | 2 +-
scripts/vm/hypervisor/xenserver/vmopspremium | 18 +++---
scripts/vm/hypervisor/xenserver/xcpserver/patch | 58 ++++++++---------
scripts/vm/hypervisor/xenserver/xenheartbeat.sh | 2 +-
.../vm/hypervisor/xenserver/xenserver56/patch | 58 ++++++++---------
.../hypervisor/xenserver/xenserver56fp1/patch | 58 ++++++++---------
.../vm/hypervisor/xenserver/xenserver60/patch | 68 ++++++++++----------
16 files changed, 171 insertions(+), 158 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/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 e3dbdd8..31c336b 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
@@ -295,6 +295,7 @@ import com.cloud.utils.StringUtils;
import com.cloud.utils.Ternary;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
+import com.cloud.utils.ssh.SSHCmdHelper;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
@@ -5196,6 +5197,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
com.trilead.ssh2.Session session = sshConnection.openSession();
+
+ String cmd = "mkdir -p /opt/cloudstack/bin";
+ if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) {
+ throw new CloudRuntimeException("Cannot create directory /opt/cloudstack/bin on XenServer hosts");
+ }
SCPClient scp = new SCPClient(sshConnection);
List<File> files = getPatchFiles();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh b/scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh
index 93b8705..f170f69 100755
--- a/scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh
+++ b/scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh
@@ -96,7 +96,7 @@ if [ $? -ne 0 ]; then
exit 0
fi
-VHDUTIL="/opt/xensource/bin/vhd-util"
+VHDUTIL="/opt/cloudstack/bin/vhd-util"
copyvhd()
{
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/launch_hb.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/launch_hb.sh b/scripts/vm/hypervisor/xenserver/launch_hb.sh
index b8a36a0..bde7fca 100755
--- a/scripts/vm/hypervisor/xenserver/launch_hb.sh
+++ b/scripts/vm/hypervisor/xenserver/launch_hb.sh
@@ -33,7 +33,7 @@ if [ -z $2 ]; then
exit 3
fi
-if [ ! -f /opt/xensource/bin/xenheartbeat.sh ]; then
+if [ ! -f /opt/cloudstack/bin/xenheartbeat.sh ]; then
printf "Error: Unable to find xenheartbeat.sh to launch\n"
exit 4
fi
@@ -42,5 +42,5 @@ for psid in `ps -ef | grep xenheartbeat | grep -v grep | awk '{print $2}'`; do
kill $psid
done
-nohup /opt/xensource/bin/xenheartbeat.sh $1 $2 >/dev/null 2>/dev/null &
+nohup /opt/cloudstack/bin/xenheartbeat.sh $1 $2 >/dev/null 2>/dev/null &
echo "======> DONE <======"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/ovs-pvlan
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/ovs-pvlan b/scripts/vm/hypervisor/xenserver/ovs-pvlan
index c821870..e1e537f 100755
--- a/scripts/vm/hypervisor/xenserver/ovs-pvlan
+++ b/scripts/vm/hypervisor/xenserver/ovs-pvlan
@@ -30,13 +30,16 @@ import util
from time import localtime as _localtime, asctime as _asctime
+CS_DIR = "/opt/cloudstack/bin/"
+
xePath = "/opt/xensource/bin/xe"
+dhcpSetupPath = CS_DIR + "ovs-pvlan-dhcp-host.sh"
+vmSetupPath = CS_DIR + "ovs-pvlan-vm.sh"
+getDhcpIfacePath = CS_DIR + "ovs-get-dhcp-iface.sh"
+pvlanCleanupPath = CS_DIR + "ovs-pvlan-cleanup.sh"
+getBridgePath = CS_DIR + "ovs-get-bridge.sh"
+
lib.setup_logging("/var/log/ovs-pvlan.log")
-dhcpSetupPath = "/opt/xensource/bin/ovs-pvlan-dhcp-host.sh"
-vmSetupPath = "/opt/xensource/bin/ovs-pvlan-vm.sh"
-getDhcpIfacePath = "/opt/xensource/bin/ovs-get-dhcp-iface.sh"
-pvlanCleanupPath = "/opt/xensource/bin/ovs-pvlan-cleanup.sh"
-getBridgePath = "/opt/xensource/bin/ovs-get-bridge.sh"
def echo(fn):
def wrapped(*v, **k):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh b/scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh
index fb178e0..fdb3099 100755
--- a/scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh
+++ b/scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh
@@ -58,7 +58,7 @@ if [ `xe pbd-list sr-uuid=$2 | grep -B 1 $1 | wc -l` -eq 0 ]; then
exit 0
fi
-hbfile=/opt/xensource/bin/heartbeat
+hbfile=/opt/cloudstack/bin/heartbeat
if [ "$3" = "true" ]; then
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/setupxenserver.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/setupxenserver.sh b/scripts/vm/hypervisor/xenserver/setupxenserver.sh
index 311f273..61ce90b 100755
--- a/scripts/vm/hypervisor/xenserver/setupxenserver.sh
+++ b/scripts/vm/hypervisor/xenserver/setupxenserver.sh
@@ -55,7 +55,7 @@ mv -n /etc/cron.daily/logrotate /etc/cron.hourly 2>&1
echo 1048576 >/proc/sys/fs/aio-max-nr
# empty heartbeat
-cat /dev/null > /opt/xensource/bin/heartbeat
+cat /dev/null > /opt/cloudstack/bin/heartbeat
# empty knownhost
cat /dev/null > /root/.ssh/known_hosts
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/swiftxen
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/swiftxen b/scripts/vm/hypervisor/xenserver/swiftxen
index 1be4107..b9ede19 100644
--- a/scripts/vm/hypervisor/xenserver/swiftxen
+++ b/scripts/vm/hypervisor/xenserver/swiftxen
@@ -34,7 +34,7 @@ def echo(fn):
return res
return wrapped
-SWIFT = "/opt/xensource/bin/swift"
+SWIFT = "/opt/cloudstack/bin/swift"
MAX_SEG_SIZE = 5 * 1024 * 1024 * 1024
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh b/scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh
index 6dcc2c4..b2e8685 100755
--- a/scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh
+++ b/scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh
@@ -87,7 +87,7 @@ if [ $? -ne 0 ]; then
exit 0
fi
-VHDUTIL="/opt/xensource/bin/vhd-util"
+VHDUTIL="/opt/cloudstack/bin/vhd-util"
upgradeSnapshot()
{
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 48ca422..4f57271 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -32,6 +32,8 @@ import subprocess
import zlib
from util import CommandException
+CS_DIR="/opt/cloudstack/bin/"
+
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
@@ -47,7 +49,7 @@ def add_to_VCPUs_params_live(session, args):
value = args['value']
vmname = args['vmname']
try:
- cmd = ["bash", "/opt/xensource/bin/add_to_vcpus_params_live.sh", vmname, key, value]
+ cmd = ["bash", CS_DIR + "add_to_vcpus_params_live.sh", vmname, key, value]
txt = util.pread2(cmd)
except:
return 'false'
@@ -57,7 +59,7 @@ def add_to_VCPUs_params_live(session, args):
def setup_iscsi(session, args):
uuid=args['uuid']
try:
- cmd = ["bash", "/opt/xensource/bin/setup_iscsi.sh", uuid]
+ cmd = ["bash", CS_DIR + "setup_iscsi.sh", uuid]
txt = util.pread2(cmd)
except:
txt = ''
@@ -68,7 +70,7 @@ def setup_iscsi(session, args):
def getgateway(session, args):
mgmt_ip = args['mgmtIP']
try:
- cmd = ["bash", "/opt/xensource/bin/network_info.sh", "-g", mgmt_ip]
+ cmd = ["bash", CS_DIR + "network_info.sh", "-g", mgmt_ip]
txt = util.pread2(cmd)
except:
txt = ''
@@ -79,7 +81,7 @@ def getgateway(session, args):
def preparemigration(session, args):
uuid = args['uuid']
try:
- cmd = ["/opt/xensource/bin/make_migratable.sh", uuid]
+ cmd = [CS_DIR + "make_migratable.sh", uuid]
util.pread2(cmd)
txt = 'success'
except:
@@ -91,7 +93,7 @@ def preparemigration(session, args):
@echo
def setIptables(session, args):
try:
- cmd = ["/bin/bash", "/opt/xensource/bin/setupxenserver.sh"]
+ cmd = ["/bin/bash", CS_DIR + "setupxenserver.sh"]
txt = util.pread2(cmd)
txt = 'success'
except:
@@ -120,7 +122,7 @@ def pingdomr(session, args):
def kill_copy_process(session, args):
namelabel = args['namelabel']
try:
- cmd = ["bash", "/opt/xensource/bin/kill_copy_process.sh", namelabel]
+ cmd = ["bash", CS_DIR + "kill_copy_process.sh", namelabel]
txt = util.pread2(cmd)
except:
txt = 'false'
@@ -134,7 +136,7 @@ def pingxenserver(session, args):
def pingtest(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/pingtest.sh")
+ cmd.insert(0, CS_DIR + "pingtest.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -149,7 +151,7 @@ def pingtest(session, args):
def savePassword(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/save_password_to_domr.sh")
+ cmd.insert(0, CS_DIR + "save_password_to_domr.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -164,7 +166,7 @@ def savePassword(session, args):
def saveDhcpEntry(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/dhcp_entry.sh")
+ cmd.insert(0, CS_DIR + "dhcp_entry.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -226,7 +228,7 @@ def setLinkLocalIP(session, args):
def setFirewallRule(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/call_firewall.sh")
+ cmd.insert(0, CS_DIR + "call_firewall.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -241,7 +243,7 @@ def setFirewallRule(session, args):
def routerProxy(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/router_proxy.sh")
+ cmd.insert(0, CS_DIR + "router_proxy.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -259,7 +261,7 @@ def routerProxy(session, args):
def setLoadBalancerRule(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/call_loadbalancer.sh")
+ cmd.insert(0, CS_DIR + "call_loadbalancer.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
@@ -286,7 +288,7 @@ def configdnsmasq(session, args):
def createipAlias(session, args):
args = args['args']
cmd = args.split(' ')
- cmd.insert(0, "/opt/xensource/bin/createipAlias.sh")
+ cmd.insert(0, CS_DIR + "createipAlias.sh")
cmd.insert(0, "bin/bash")
try:
txt=util.pread2(cmd)
@@ -300,7 +302,7 @@ def createipAlias(session, args):
def deleteipAlias(session, args):
args = args['args']
cmd = args.split(' ')
- cmd.insert(0, "/opt/xensource/bin/deleteipAlias.sh")
+ cmd.insert(0, CS_DIR + "deleteipAlias.sh")
cmd.insert(0, "bin/bash")
try:
txt=util.pread2(cmd)
@@ -1606,7 +1608,7 @@ def network_rules(session, args):
def bumpUpPriority(session, args):
sargs = args['args']
cmd = sargs.split(' ')
- cmd.insert(0, "/opt/xensource/bin/bumpUpPriority.sh")
+ cmd.insert(0, CS_DIR + "bumpUpPriority.sh")
cmd.insert(0, "/bin/bash")
try:
txt = util.pread2(cmd)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/vmopsSnapshot
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopsSnapshot b/scripts/vm/hypervisor/xenserver/vmopsSnapshot
index f638de4..dc8e11d 100755
--- a/scripts/vm/hypervisor/xenserver/vmopsSnapshot
+++ b/scripts/vm/hypervisor/xenserver/vmopsSnapshot
@@ -35,7 +35,7 @@ import cleanup
import stat
import random
-VHD_UTIL = '/opt/xensource/bin/vhd-util'
+VHD_UTIL = '/opt/cloudstack/bin/vhd-util'
VHD_PREFIX = 'VHD-'
CLOUD_DIR = '/var/run/cloud_mount'
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/vmopspremium
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopspremium b/scripts/vm/hypervisor/xenserver/vmopspremium
index 38ec2e8..973c030 100755
--- a/scripts/vm/hypervisor/xenserver/vmopspremium
+++ b/scripts/vm/hypervisor/xenserver/vmopspremium
@@ -26,6 +26,8 @@ sys.path.append("/opt/xensource/sm/")
import util
import socket
+CS_DIR="/opt/cloudstack/bin/"
+
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
@@ -52,7 +54,7 @@ def create_privatetemplate_from_snapshot(session, args):
snapshotPath = args['snapshotPath']
tmpltLocalDir = args['tmpltLocalDir']
try:
- cmd = ["bash", "/opt/xensource/bin/create_privatetemplate_from_snapshot.sh",snapshotPath, templatePath, tmpltLocalDir]
+ cmd = ["bash", CS_DIR + "create_privatetemplate_from_snapshot.sh",snapshotPath, templatePath, tmpltLocalDir]
txt = util.pread2(cmd)
except:
txt = '10#failed'
@@ -63,7 +65,7 @@ def upgrade_snapshot(session, args):
templatePath = args['templatePath']
snapshotPath = args['snapshotPath']
try:
- cmd = ["bash", "/opt/xensource/bin/upgrate_snapshot.sh",snapshotPath, templatePath]
+ cmd = ["bash", CS_DIR + "upgrate_snapshot.sh",snapshotPath, templatePath]
txt = util.pread2(cmd)
except:
txt = '10#failed'
@@ -75,7 +77,7 @@ def copy_vhd_to_secondarystorage(session, args):
vdiuuid = args['vdiuuid']
sruuid = args['sruuid']
try:
- cmd = ["bash", "/opt/xensource/bin/copy_vhd_to_secondarystorage.sh", mountpoint, vdiuuid, sruuid]
+ cmd = ["bash", CS_DIR + "copy_vhd_to_secondarystorage.sh", mountpoint, vdiuuid, sruuid]
txt = util.pread2(cmd)
except:
txt = '10#failed'
@@ -87,7 +89,7 @@ def copy_vhd_from_secondarystorage(session, args):
sruuid = args['sruuid']
namelabel = args['namelabel']
try:
- cmd = ["bash", "/opt/xensource/bin/copy_vhd_from_secondarystorage.sh", mountpoint, sruuid, namelabel]
+ cmd = ["bash", CS_DIR + "copy_vhd_from_secondarystorage.sh", mountpoint, sruuid, namelabel]
txt = util.pread2(cmd)
except:
txt = '10#failed'
@@ -98,7 +100,7 @@ def setup_heartbeat_sr(session, args):
host = args['host']
sr = args['sr']
try:
- cmd = ["bash", "/opt/xensource/bin/setup_heartbeat_sr.sh", host, sr]
+ cmd = ["bash", CS_DIR + "setup_heartbeat_sr.sh", host, sr]
txt = util.pread2(cmd)
except:
txt = ''
@@ -110,7 +112,7 @@ def setup_heartbeat_file(session, args):
sr = args['sr']
add = args['add']
try:
- cmd = ["bash", "/opt/xensource/bin/setup_heartbeat_file.sh", host, sr, add]
+ cmd = ["bash", CS_DIR + "setup_heartbeat_file.sh", host, sr, add]
txt = util.pread2(cmd)
except:
txt = ''
@@ -121,7 +123,7 @@ def check_heartbeat(session, args):
host = args['host']
interval = args['interval']
try:
- cmd = ["bash", "/opt/xensource/bin/check_heartbeat.sh", host, interval]
+ cmd = ["bash", CS_DIR + "check_heartbeat.sh", host, interval]
txt = util.pread2(cmd)
except:
txt=''
@@ -133,7 +135,7 @@ def heartbeat(session, args):
host = args['host']
interval = args['interval']
try:
- cmd = ["/bin/bash", "/opt/xensource/bin/launch_hb.sh", host, interval]
+ cmd = ["/bin/bash", CS_DIR + "launch_hb.sh", host, interval]
txt = util.pread2(cmd)
except:
txt='fail'
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index 443abc1..4188846 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -34,33 +34,33 @@ vmopsSnapshot=..,0755,/etc/xapi.d/plugins
hostvmstats.py=..,0755,/opt/xensource/sm
systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
id_rsa.cloud=../../../systemvm,0600,/root/.ssh
-network_info.sh=..,0755,/opt/xensource/bin
-setupxenserver.sh=..,0755,/opt/xensource/bin
-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
-createipAlias.sh=..,0755,/opt/xensource/bin
-deleteipAlias.sh=..,0755,/opt/xensource/bin
-router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
-save_password_to_domr.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
-cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
-copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
-copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_file.sh=..,0755,/opt/xensource/bin
-check_heartbeat.sh=..,0755,/opt/xensource/bin
-xenheartbeat.sh=..,0755,/opt/xensource/bin
-launch_hb.sh=..,0755,/opt/xensource/bin
-vhd-util=..,0755,/opt/xensource/bin
+network_info.sh=..,0755,/opt/cloudstack/bin
+setupxenserver.sh=..,0755,/opt/cloudstack/bin
+make_migratable.sh=..,0755,/opt/cloudstack/bin
+setup_iscsi.sh=..,0755,/opt/cloudstack/bin
+pingtest.sh=../../..,0755,/opt/cloudstack/bin
+dhcp_entry.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+createipAlias.sh=..,0755,/opt/cloudstack/bin
+deleteipAlias.sh=..,0755,/opt/cloudstack/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+save_password_to_domr.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_firewall.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_loadbalancer.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+cloud-setup-bonding.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_to_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_from_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_sr.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_file.sh=..,0755,/opt/cloudstack/bin
+check_heartbeat.sh=..,0755,/opt/cloudstack/bin
+xenheartbeat.sh=..,0755,/opt/cloudstack/bin
+launch_hb.sh=..,0755,/opt/cloudstack/bin
+vhd-util=..,0755,/opt/cloudstack/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
-create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
-upgrade_snapshot.sh=..,0755,/opt/xensource/bin
-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
-add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+create_privatetemplate_from_snapshot.sh=..,0755,/opt/cloudstack/bin
+upgrade_snapshot.sh=..,0755,/opt/cloudstack/bin
+cloud-clean-vlan.sh=..,0755,/opt/cloudstack/bin
+cloud-prepare-upgrade.sh=..,0755,/opt/cloudstack/bin
+getRouterStatus.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+getDomRVersion.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/xenheartbeat.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenheartbeat.sh b/scripts/vm/hypervisor/xenserver/xenheartbeat.sh
index dd876ba..f875a3a 100755
--- a/scripts/vm/hypervisor/xenserver/xenheartbeat.sh
+++ b/scripts/vm/hypervisor/xenserver/xenheartbeat.sh
@@ -44,7 +44,7 @@ if [ $interval -gt $2 ]; then
exit 3
fi
-file=/opt/xensource/bin/heartbeat
+file=/opt/cloudstack/bin/heartbeat
lastdate=$(($(date +%s) + $interval))
while [ $(date +%s) -lt $(($lastdate + $2)) ]
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index db2de3e..da1670e 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -31,37 +31,37 @@ vmops=..,0755,/etc/xapi.d/plugins
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
id_rsa.cloud=../../../systemvm,0600,/root/.ssh
-network_info.sh=..,0755,/opt/xensource/bin
-setupxenserver.sh=..,0755,/opt/xensource/bin
-make_migratable.sh=..,0755,/opt/xensource/bin
-setup_iscsi.sh=..,0755,/opt/xensource/bin
-cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
-pingtest.sh=../../..,0755,/opt/xensource/bin
-createipAlias.sh=..,0755,/opt/xensource/bin
-deleteipAlias.sh=..,0755,/opt/xensource/bin
-dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-save_password_to_domr.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
-copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
-copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
-kill_copy_process.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_file.sh=..,0755,/opt/xensource/bin
-check_heartbeat.sh=..,0755,/opt/xensource/bin
-xenheartbeat.sh=..,0755,/opt/xensource/bin
-launch_hb.sh=..,0755,/opt/xensource/bin
-vhd-util=..,0755,/opt/xensource/bin
+network_info.sh=..,0755,/opt/cloudstack/bin
+setupxenserver.sh=..,0755,/opt/cloudstack/bin
+make_migratable.sh=..,0755,/opt/cloudstack/bin
+setup_iscsi.sh=..,0755,/opt/cloudstack/bin
+cloud-setup-bonding.sh=..,0755,/opt/cloudstack/bin
+pingtest.sh=../../..,0755,/opt/cloudstack/bin
+createipAlias.sh=..,0755,/opt/cloudstack/bin
+deleteipAlias.sh=..,0755,/opt/cloudstack/bin
+dhcp_entry.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+save_password_to_domr.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_firewall.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_loadbalancer.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+copy_vhd_to_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_from_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+kill_copy_process.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_sr.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_file.sh=..,0755,/opt/cloudstack/bin
+check_heartbeat.sh=..,0755,/opt/cloudstack/bin
+xenheartbeat.sh=..,0755,/opt/cloudstack/bin
+launch_hb.sh=..,0755,/opt/cloudstack/bin
+vhd-util=..,0755,/opt/cloudstack/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
InterfaceReconfigure.py=.,0755,/opt/xensource/libexec
-create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
-upgrade_snapshot.sh=..,0755,/opt/xensource/bin
-cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
-cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
-bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-swift=..,0755,/opt/xensource/bin
+create_privatetemplate_from_snapshot.sh=..,0755,/opt/cloudstack/bin
+upgrade_snapshot.sh=..,0755,/opt/cloudstack/bin
+cloud-clean-vlan.sh=..,0755,/opt/cloudstack/bin
+cloud-prepare-upgrade.sh=..,0755,/opt/cloudstack/bin
+bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+swift=..,0755,/opt/cloudstack/bin
swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
-add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index 3206a34..ecd4378 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -31,36 +31,36 @@ vmops=..,0755,/etc/xapi.d/plugins
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
id_rsa.cloud=../../../systemvm,0600,/root/.ssh
-network_info.sh=..,0755,/opt/xensource/bin
-setupxenserver.sh=..,0755,/opt/xensource/bin
-make_migratable.sh=..,0755,/opt/xensource/bin
-setup_iscsi.sh=..,0755,/opt/xensource/bin
-pingtest.sh=../../..,0755,/opt/xensource/bin
-createipAlias.sh=..,0755,/opt/xensource/bin
-deleteipAlias.sh=..,0755,/opt/xensource/bin
-dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-save_password_to_domr.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
-cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
-copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
-copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
-kill_copy_process.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_file.sh=..,0755,/opt/xensource/bin
-check_heartbeat.sh=..,0755,/opt/xensource/bin
-xenheartbeat.sh=..,0755,/opt/xensource/bin
-launch_hb.sh=..,0755,/opt/xensource/bin
-vhd-util=..,0755,/opt/xensource/bin
+network_info.sh=..,0755,/opt/cloudstack/bin
+setupxenserver.sh=..,0755,/opt/cloudstack/bin
+make_migratable.sh=..,0755,/opt/cloudstack/bin
+setup_iscsi.sh=..,0755,/opt/cloudstack/bin
+pingtest.sh=../../..,0755,/opt/cloudstack/bin
+createipAlias.sh=..,0755,/opt/cloudstack/bin
+deleteipAlias.sh=..,0755,/opt/cloudstack/bin
+dhcp_entry.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+save_password_to_domr.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_firewall.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_loadbalancer.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+cloud-setup-bonding.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_to_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_from_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+kill_copy_process.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_sr.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_file.sh=..,0755,/opt/cloudstack/bin
+check_heartbeat.sh=..,0755,/opt/cloudstack/bin
+xenheartbeat.sh=..,0755,/opt/cloudstack/bin
+launch_hb.sh=..,0755,/opt/cloudstack/bin
+vhd-util=..,0755,/opt/cloudstack/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
-create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
-upgrade_snapshot.sh=..,0755,/opt/xensource/bin
-cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
-cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
-bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-swift=..,0755,/opt/xensource/bin
+create_privatetemplate_from_snapshot.sh=..,0755,/opt/cloudstack/bin
+upgrade_snapshot.sh=..,0755,/opt/cloudstack/bin
+cloud-clean-vlan.sh=..,0755,/opt/cloudstack/bin
+cloud-prepare-upgrade.sh=..,0755,/opt/cloudstack/bin
+bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+swift=..,0755,/opt/cloudstack/bin
swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
-add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d93563d/scripts/vm/hypervisor/xenserver/xenserver60/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch b/scripts/vm/hypervisor/xenserver/xenserver60/patch
index 457bb26..049c22a 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver60/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch
@@ -36,41 +36,41 @@ ovstunnel=..,0755,/etc/xapi.d/plugins
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
id_rsa.cloud=../../../systemvm,0600,/root/.ssh
-network_info.sh=..,0755,/opt/xensource/bin
-setupxenserver.sh=..,0755,/opt/xensource/bin
-make_migratable.sh=..,0755,/opt/xensource/bin
-createipAlias.sh=..,0755,/opt/xensource/bin
-deleteipAlias.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
-save_password_to_domr.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
-cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
-copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
-copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
-kill_copy_process.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
-setup_heartbeat_file.sh=..,0755,/opt/xensource/bin
-check_heartbeat.sh=..,0755,/opt/xensource/bin
-xenheartbeat.sh=..,0755,/opt/xensource/bin
-launch_hb.sh=..,0755,/opt/xensource/bin
-vhd-util=..,0755,/opt/xensource/bin
+network_info.sh=..,0755,/opt/cloudstack/bin
+setupxenserver.sh=..,0755,/opt/cloudstack/bin
+make_migratable.sh=..,0755,/opt/cloudstack/bin
+createipAlias.sh=..,0755,/opt/cloudstack/bin
+deleteipAlias.sh=..,0755,/opt/cloudstack/bin
+setup_iscsi.sh=..,0755,/opt/cloudstack/bin
+pingtest.sh=../../..,0755,/opt/cloudstack/bin
+dhcp_entry.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+save_password_to_domr.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_firewall.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+call_loadbalancer.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+router_proxy.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+cloud-setup-bonding.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_to_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+copy_vhd_from_secondarystorage.sh=..,0755,/opt/cloudstack/bin
+kill_copy_process.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_sr.sh=..,0755,/opt/cloudstack/bin
+setup_heartbeat_file.sh=..,0755,/opt/cloudstack/bin
+check_heartbeat.sh=..,0755,/opt/cloudstack/bin
+xenheartbeat.sh=..,0755,/opt/cloudstack/bin
+launch_hb.sh=..,0755,/opt/cloudstack/bin
+vhd-util=..,0755,/opt/cloudstack/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
-create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
-upgrade_snapshot.sh=..,0755,/opt/xensource/bin
-cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
-cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
-bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
-swift=..,0755,/opt/xensource/bin
+create_privatetemplate_from_snapshot.sh=..,0755,/opt/cloudstack/bin
+upgrade_snapshot.sh=..,0755,/opt/cloudstack/bin
+cloud-clean-vlan.sh=..,0755,/opt/cloudstack/bin
+cloud-prepare-upgrade.sh=..,0755,/opt/cloudstack/bin
+bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
+swift=..,0755,/opt/cloudstack/bin
swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
-add_to_vcpus_params_live.sh=..,0755,/opt/xensource/bin
+add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
ovs-pvlan=..,0755,/etc/xapi.d/plugins
-ovs-pvlan-dhcp-host.sh=../../../network,0755,/opt/xensource/bin
-ovs-pvlan-vm.sh=../../../network,0755,/opt/xensource/bin
-ovs-pvlan-cleanup.sh=../../../network,0755,/opt/xensource/bin
-ovs-get-dhcp-iface.sh=..,0755,/opt/xensource/bin
-ovs-get-bridge.sh=..,0755,/opt/xensource/bin
+ovs-pvlan-dhcp-host.sh=../../../network,0755,/opt/cloudstack/bin
+ovs-pvlan-vm.sh=../../../network,0755,/opt/cloudstack/bin
+ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloudstack/bin
+ovs-get-dhcp-iface.sh=..,0755,/opt/cloudstack/bin
+ovs-get-bridge.sh=..,0755,/opt/cloudstack/bin
[3/3] git commit: updated refs/heads/4.2-workplace to ed5aaea
Posted by an...@apache.org.
CS doesn't switch XS master any more
use correct way to create master connection
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed5aaea4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed5aaea4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed5aaea4
Branch: refs/heads/4.2-workplace
Commit: ed5aaea41b74e12e6c88cfc18c00bf444fc9f28d
Parents: f1de07b
Author: Anthony Xu <an...@citrix.com>
Authored: Tue Nov 12 17:54:07 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Tue Nov 12 17:54:07 2013 -0800
----------------------------------------------------------------------
.../xen/discoverer/XcpServerDiscoverer.java | 7 +-
.../xen/resource/CitrixResourceBase.java | 34 +-
.../xen/resource/XenServerConnectionPool.java | 443 ++-----------------
3 files changed, 41 insertions(+), 443 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed5aaea4/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 377f15f..4d16934 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -180,8 +180,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
String hostIp = ia.getHostAddress();
Queue<String> pass=new LinkedList<String>();
pass.add(password);
- String masterIp = _connPool.getMasterIp(hostIp, username, pass);
- conn = _connPool.masterConnect(masterIp, username, pass);
+ conn = _connPool.getConnect(hostIp, username, pass);
if (conn == null) {
String msg = "Unable to get a connection to " + url;
s_logger.debug(msg);
@@ -381,7 +380,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
password = host.getDetail("password");
pass.add(password);
String address = host.getPrivateIpAddress();
- Connection hostConn = _connPool.slaveConnect(address, username, pass);
+ Connection hostConn = _connPool.getConnect(address, username, pass);
if (hostConn == null) {
continue;
}
@@ -395,7 +394,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
s_logger.warn("Can not get master ip address from host " + address);
} finally {
try{
- Session.localLogout(hostConn);
+ Session.logout(hostConn);
} catch (Exception e ) {
}
hostConn.dispose();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed5aaea4/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 31c336b..0f7ef12 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
@@ -6081,9 +6081,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
private void CheckXenHostInfo() throws ConfigurationException {
- Connection conn = _connPool.slaveConnect(_host.ip, _username, _password);
+ Connection conn = _connPool.getConnect(_host.ip, _username, _password);
if( conn == null ) {
- throw new ConfigurationException("Can not create slave connection to " + _host.ip);
+ throw new ConfigurationException("Can not create connection to " + _host.ip);
}
try {
Host.Record hostRec = null;
@@ -6103,7 +6103,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
} finally {
try {
- Session.localLogout(conn);
+ Session.logout(conn);
} catch (Exception e) {
}
}
@@ -7862,35 +7862,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Host.Record hostr = poolr.master.getRecord(conn);
if (_host.uuid.equals(hostr.uuid)) {
- boolean mastermigrated = false;
Map<Host, Host.Record> hostMap = Host.getAllRecords(conn);
- if (hostMap.size() != 1) {
- Host newMaster = null;
- Host.Record newMasterRecord = null;
- for (Map.Entry<Host, Host.Record> entry : hostMap.entrySet()) {
- if (_host.uuid.equals(entry.getValue().uuid)) {
- continue;
- }
- newMaster = entry.getKey();
- newMasterRecord = entry.getValue();
- s_logger.debug("New master for the XenPool is " + newMasterRecord.uuid + " : " + newMasterRecord.address);
- try {
- _connPool.switchMaster(_host.ip, _host.pool, conn, newMaster, _username, _password, _wait);
- mastermigrated = true;
- break;
- } catch (Exception e) {
- s_logger.warn("Unable to switch the new master to " + newMasterRecord.uuid + ": " + newMasterRecord.address + " due to " + e.toString());
- }
- }
- } else {
- s_logger.debug("This is last host to eject, so don't need to eject: " + hostuuid);
- return new Answer(cmd);
- }
- if ( !mastermigrated ) {
- String msg = "this host is master, and cannot designate a new master";
+ if (hostMap.size() > 1) {
+ String msg = "This host is XS master, please designate a new XS master throught XenCenter before you delete this host from CS";
s_logger.debug(msg);
return new Answer(cmd, false, msg);
-
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed5aaea4/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
index cb188d5..dc7861a 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
@@ -212,301 +212,29 @@ public class XenServerConnectionPool {
return false;
}
- public void switchMaster(String slaveIp, String poolUuid,
- Connection conn, Host host, String username, Queue<String> password,
- int wait) throws XmlRpcException, XenAPIException {
- synchronized (poolUuid.intern()) {
- String masterIp = host.getAddress(conn);
- s_logger.debug("Designating the new master to " + masterIp);
- Pool.designateNewMaster(conn, host);
- Connection slaveConn = null;
- Connection masterConn = null;
- int retry = 30;
- for (int i = 0; i < retry; i++) {
- forceSleep(5);
- try {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Logging on as the slave to " + slaveIp);
- }
- slaveConn = null;
- masterConn = null;
- Session slaveSession = null;
-
- slaveConn = new Connection(getURL(slaveIp), 10);
- slaveSession = slaveLocalLoginWithPassword(slaveConn, username, password);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Slave logon successful. session= "
- + slaveSession);
- }
-
- Pool.Record pr = getPoolRecord(slaveConn);
- Host master = pr.master;
- String ma = master.getAddress(slaveConn);
- if (!ma.trim().equals(masterIp.trim())) {
- continue;
- }
- s_logger.debug("Logging on as the master to " + masterIp);
- masterConn = new Connection(getURL(masterIp), 10);
- loginWithPassword(masterConn, username, password, APIVersion.latest().toString());
- removeConnect(poolUuid);
- ensurePoolIntegrity(masterConn, masterIp, username, password, wait);
- return;
- } catch (Types.HostIsSlave e) {
- s_logger.debug("HostIsSlaveException: Still waiting for the conversion to the master");
- } catch (XmlRpcException e) {
- s_logger.debug("XmlRpcException: Still waiting for the conversion to the master " + e.getMessage());
- } catch (Exception e) {
- s_logger.debug("Exception: Still waiting for the conversion to the master" + e.getMessage());
- } finally {
- if (masterConn != null) {
- try {
- Session.logout(masterConn);
- } catch (Exception e) {
- s_logger.debug("Unable to log out of session: "
- + e.getMessage());
- }
- masterConn.dispose();
- masterConn = null;
- }
- localLogout(slaveConn);
- slaveConn = null;
- }
- }
- throw new CloudRuntimeException(
- "Unable to logon to the new master after " + retry + " retries");
- }
- }
-
- private void localLogout(Connection conn) {
- if ( conn == null )
- return;
+
+ public Connection getConnect(String ip, String username, Queue<String> password) {
+ Connection conn = new Connection(getURL(ip), 10);
try {
- if( s_logger.isTraceEnabled()) {
- s_logger.trace("Logging out of the session "
- + conn.getSessionReference());
- }
- Session.localLogout(conn);
- } catch (Exception e) {
- s_logger.debug("localLogout has problem " + e.getMessage());
- } finally {
- conn.dispose();
- conn = null;
- }
- }
-
- public Connection slaveConnect(String ip, String username, Queue<String> password) {
- Connection conn = null;
- try{
- conn = new Connection(getURL(ip), 10);
- slaveLocalLoginWithPassword(conn, username, password);
- return conn;
- }catch ( Exception e){
- s_logger.debug("Failed to slave local login to " + ip);
- }
- return null;
- }
-
- public Connection masterConnect(String ip, String username, Queue<String> password) {
- Connection conn = null;
- try{
- conn = new Connection(getURL(ip), 10);
- s_logger.debug("Logging on as the master to " + ip);
loginWithPassword(conn, username, password, APIVersion.latest().toString());
- return conn;
- }catch ( Exception e){
- s_logger.debug("Failed to slave local login to " + ip);
- }
- throw new RuntimeException("can not log in to master " + ip);
- }
-
-
- public String getMasterIp(String ip, String username, Queue<String> password) throws XenAPIException {
- Connection slaveConn = null;
- try{
- slaveConn = new Connection(getURL(ip), 10);
- slaveLocalLoginWithPassword(slaveConn, username, password);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Slave logon to " + ip);
- }
- String masterIp = null;
- Pool.Record pr = getPoolRecord(slaveConn);
- Host master = pr.master;
- masterIp = master.getAddress(slaveConn);
- return masterIp;
- }catch(Types.SessionAuthenticationFailed e){
- s_logger.debug("Failed to slave local login to " + ip + " due to " + e.toString());
- throw e;
- }catch ( Exception e){
- s_logger.debug("Failed to slave local login to " + ip + " due to " + e.toString());
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- }
- throw new RuntimeException("can not get master ip");
- }
-
-
- void PoolEmergencyTransitionToMaster(String slaveIp, String username, Queue<String> password) {
- if (!s_managePool) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Don't manage pool on error so sleeping for " + s_sleepOnError);
- try {
- Thread.sleep(s_sleepOnError);
- } catch (InterruptedException ie) {
- }
- }
- return;
- }
-
- Connection slaveConn = null;
- Connection c = null;
- try{
- s_logger.debug("Trying to transition master to " + slaveIp);
- slaveConn = new Connection(getURL(slaveIp), 10);
- slaveLocalLoginWithPassword(slaveConn, username, password);
- Pool.emergencyTransitionToMaster(slaveConn);
- // restart xapi in 10 sec
- forceSleep(10);
- // check if the master of this host is set correctly.
- c = new Connection(getURL(slaveIp), 10);
- for (int i = 0; i < 30; i++) {
- try {
- loginWithPassword(c, username, password, APIVersion.latest().toString());
- s_logger.debug("Succeeded to transition master to " + slaveIp);
- return;
- } catch (Types.HostIsSlave e) {
- s_logger.debug("HostIsSlave: Still waiting for the conversion to the master " + slaveIp);
- } catch (Exception e) {
- s_logger.debug("Exception: Still waiting for the conversion to the master");
- }
- forceSleep(2);
- }
- throw new RuntimeException("EmergencyTransitionToMaster failed after retry 30 times");
- } catch (Exception e) {
- throw new RuntimeException("EmergencyTransitionToMaster failed due to " + e.getMessage());
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- if(c != null) {
- try {
- Session.logout(c);
- c.dispose();
- } catch (Exception e) {
- }
- }
- }
-
- }
-
- private void PoolEmergencyResetMaster(String slaveIp, String masterIp, String username, Queue<String> password) {
- if (!s_managePool) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Don't manage pool on error so sleeping for " + s_sleepOnError);
- try {
- Thread.sleep(s_sleepOnError);
- } catch (InterruptedException ie) {
- }
- }
- return;
- }
-
- Connection slaveConn = null;
- try {
- s_logger.debug("Trying to reset master of slave " + slaveIp
- + " to " + masterIp);
- slaveConn = new Connection(getURL(slaveIp), 10);
- slaveLocalLoginWithPassword(slaveConn, username, password);
- Pool.emergencyResetMaster(slaveConn, masterIp);
- forceSleep(10);
- for (int i = 0; i < 30; i++) {
- try {
- slaveLocalLoginWithPassword(slaveConn, username, password);
- Pool.Record pr = getPoolRecord(slaveConn);
- String mIp = pr.master.getAddress(slaveConn);
- if (mIp.trim().equals(masterIp.trim())) {
- s_logger.debug("Succeeded to reset master of slave " + slaveIp + " to " + masterIp);
- return;
- }
- } catch (Exception e) {
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- }
- // wait 2 second
- forceSleep(2);
- }
- throw new CloudRuntimeException("Unable to reset master of slave " + slaveIp
- + " to " + masterIp + "after 30 retry");
- } catch (Exception e) {
- throw new CloudRuntimeException("Unable to reset master of slave " + slaveIp
- + " to " + masterIp + " due to " + e.toString());
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- }
- }
-
- protected void ensurePoolIntegrity(Connection conn,
- String masterIp, String username, Queue<String> password, int wait) {
- try {
- // try recoverSlave first
- Set<Host> rcSlaves = Pool.recoverSlaves(conn);
- // wait 10 second
- forceSleep(10);
- for(Host slave : rcSlaves ) {
- for (int i = 0; i < 30; i++) {
- Connection slaveConn = null;
- try {
-
- String slaveIp = slave.getAddress(conn);
- s_logger.debug("Logging on as the slave to " + slaveIp);
- slaveConn = new Connection(getURL(slaveIp), 10);
- slaveLocalLoginWithPassword(slaveConn, username, password);
- Pool.Record pr = getPoolRecord(slaveConn);
- String mIp = pr.master.getAddress(slaveConn);
- if (mIp.trim().equals(masterIp.trim())) {
- break;
- }
- } catch (Exception e) {
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- }
- // wait 2 second
- forceSleep(2);
- }
- }
- // then try emergency reset master
- Set<Host> slaves = Host.getAll(conn);
- for (Host slave : slaves) {
- String slaveIp = slave.getAddress(conn);
- Connection slaveConn = null;
- try {
- s_logger.debug("Logging on as the slave to " + slaveIp);
-
- slaveConn = new Connection(getURL(slaveIp), 10);
- slaveLocalLoginWithPassword(slaveConn, username, password);
- Pool.Record slavePoolr = getPoolRecord(slaveConn);
- String ip = slavePoolr.master.getAddress(slaveConn);
- if (!masterIp.trim().equals(ip.trim())) {
- PoolEmergencyResetMaster(slaveIp, masterIp, username, password);
- }
- } catch (Exception e) {
- s_logger.debug("Unable to login to slave " + slaveIp + " error " + e.getMessage());
- } finally {
- localLogout(slaveConn);
- slaveConn = null;
- }
+ } catch (Types.HostIsSlave e) {
+ String maddress = e.masterIPAddress;
+ conn = new Connection(getURL(maddress), 10);
+ try {
+ loginWithPassword(conn, username, password, APIVersion.latest().toString());
+ } catch (Exception e1) {
+ String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString();
+ s_logger.debug(msg);
+ throw new CloudRuntimeException(msg, e1);
}
} catch (Exception e) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Catch " + e.getClass().getName() + " due to " + e.toString());
- }
+ String msg = "Unable to create master connection to host(" + ip +") , due to " + e.toString();
+ s_logger.debug(msg);
+ throw new CloudRuntimeException(msg, e);
}
+ return conn;
}
-
+
public URL getURL(String ip){
try {
return new URL("https://" + ip);
@@ -522,39 +250,18 @@ public class XenServerConnectionPool {
public Connection connect(String hostUuid, String poolUuid, String ipAddress,
String username, Queue<String> password, int wait) {
XenServerConnection mConn = null;
- Connection sConn = null;
- String masterIp = null;
if (hostUuid == null || poolUuid == null || ipAddress == null || username == null || password == null) {
String msg = "Connect some parameter are null hostUuid:" + hostUuid + " ,poolUuid:" + poolUuid
+ " ,ipAddress:" + ipAddress;
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
- Host host = null;
synchronized (poolUuid.intern()) {
// Let's see if it is an existing connection.
mConn = getConnect(poolUuid);
if (mConn != null){
try{
- host = Host.getByUuid(mConn, hostUuid);
- } catch (Types.SessionInvalid e) {
- s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString());
- try {
- loginWithPassword(mConn, mConn.getUsername(), mConn.getPassword(), APIVersion.latest().toString());
- } catch (Exception e1) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString());
- }
- removeConnect(poolUuid);
- mConn = null;
- }
- } catch (UuidInvalid e) {
- String msg = "Host(" + hostUuid + ") doesn't belong to pool(" + poolUuid + "), please execute 'xe pool-join master-address=" + mConn.getIp()
- + " master-username=" + mConn.getUsername();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg, e);
+ Host.getByUuid(mConn, hostUuid);
} catch (Exception e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString());
@@ -565,113 +272,29 @@ public class XenServerConnectionPool {
}
if ( mConn == null ) {
+ mConn = new XenServerConnection(getURL(ipAddress), ipAddress, username, password, _retries, _interval, wait);
try {
+ loginWithPassword(mConn, username, password, APIVersion.latest().toString());
+ } catch (Types.HostIsSlave e) {
+ String maddress = e.masterIPAddress;
+ mConn = new XenServerConnection(getURL(maddress), maddress, username, password, _retries, _interval, wait);
try {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Logging on as the slave to " + ipAddress);
- }
- sConn = new Connection(getURL(ipAddress), 5);
- slaveLocalLoginWithPassword(sConn, username, password);
- } catch (Exception e){
- String msg = "Unable to create slave connection to host(" + hostUuid +") due to " + e.toString();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg, e);
- }
- Pool.Record pr = null;
- try {
- pr = getPoolRecord(sConn);
- } catch (Exception e) {
- PoolEmergencyTransitionToMaster(ipAddress, username, password);
- mConn = new XenServerConnection(getURL(ipAddress), ipAddress, username, password, _retries, _interval, wait);
- try {
- loginWithPassword(mConn, username, password, APIVersion.latest().toString());
- pr = getPoolRecord(mConn);
- } catch (Exception e1) {
- String msg = "Unable to create master connection to host(" + hostUuid +") after transition it to master, due to " + e1.toString();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg, e1);
- }
- if ( !pr.uuid.equals(poolUuid) ) {
- String msg = "host(" + hostUuid +") should be in pool(" + poolUuid + "), but it is actually in pool(" + pr.uuid + ")";
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg);
- } else {
- if (s_managePool) {
- ensurePoolIntegrity(mConn, ipAddress, username, password, wait);
- }
- addConnect(poolUuid, mConn);
- return mConn;
- }
- }
- if ( !pr.uuid.equals(poolUuid) ) {
- String msg = "host(" + hostUuid +") should be in pool(" + poolUuid + "), but it is actually in pool(" + pr.uuid + ")";
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg);
- }
- try {
- masterIp = pr.master.getAddress(sConn);
- mConn = new XenServerConnection(getURL(masterIp), masterIp, username, password, _retries, _interval, wait);
loginWithPassword(mConn, username, password, APIVersion.latest().toString());
- addConnect(poolUuid, mConn);
- return mConn;
- } catch (Exception e) {
- String msg = "Unable to logon in " + masterIp + " as master in pool(" + poolUuid + ")";
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- throw new CloudRuntimeException(msg);
- }
- } finally {
- localLogout(sConn);
- sConn = null;
- }
- }
- }
-
- if ( mConn != null ) {
- if (s_managePool) {
- try {
- Map<String, String> args = new HashMap<String, String>();
- host.callPlugin(mConn, "echo", "main", args);
- } catch (Types.SessionInvalid e) {
- if (s_logger.isDebugEnabled()) {
- String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString();
+ } catch (Exception e1) {
+ String msg = "Unable to create master connection to host(" + maddress +") , due to " + e1.toString();
s_logger.debug(msg);
- }
- PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
- } catch (Types.CannotContactHost e ) {
- if (s_logger.isDebugEnabled()) {
- String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString();
- s_logger.debug(msg);
- }
- PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
- } catch (Types.HostOffline e ) {
- if (s_logger.isDebugEnabled()) {
- String msg = "Catch Exception: " + e.getClass().getName() + " Host is offline " + ipAddress + " due to " + e.toString();
- s_logger.debug(msg);
- }
- PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
- } catch (Types.HostNotLive e ) {
- String msg = "Catch Exception: " + e.getClass().getName() + " Host Not Live " + ipAddress + " due to " + e.toString();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(msg);
- }
- PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
+ throw new CloudRuntimeException(msg, e1);
+
+ }
} catch (Exception e) {
- String msg = "Echo test failed on host " + hostUuid + " IP " + ipAddress;
- s_logger.warn(msg, e);
- throw new CloudRuntimeException(msg, e);
+ String msg = "Unable to create master connection to host(" + ipAddress +") , due to " + e.toString();
+ s_logger.debug(msg);
+ throw new CloudRuntimeException(msg, e);
}
+ addConnect(poolUuid, mConn);
}
}
+
return mConn;
}
[2/3] git commit: updated refs/heads/4.2-workplace to ed5aaea
Posted by an...@apache.org.
use seperate log files and logrotate config
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f1de07ba
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f1de07ba
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f1de07ba
Branch: refs/heads/4.2-workplace
Commit: f1de07ba00cc6c3d78a548b08930d36173714450
Parents: 3d93563
Author: Anthony Xu <an...@citrix.com>
Authored: Mon Nov 11 17:02:49 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Tue Nov 12 11:20:36 2013 -0800
----------------------------------------------------------------------
scripts/vm/hypervisor/xenserver/cloudstacklog | 12 +
scripts/vm/hypervisor/xenserver/ovs-pvlan | 4 +-
scripts/vm/hypervisor/xenserver/ovstunnel | 4 +-
scripts/vm/hypervisor/xenserver/vmops | 236 ++++++++++---------
scripts/vm/hypervisor/xenserver/vmopsSnapshot | 108 +++++----
scripts/vm/hypervisor/xenserver/vmopspremium | 8 +-
scripts/vm/hypervisor/xenserver/xcpserver/patch | 1 +
.../vm/hypervisor/xenserver/xenserver56/patch | 2 +-
.../hypervisor/xenserver/xenserver56fp1/patch | 2 +-
.../vm/hypervisor/xenserver/xenserver60/patch | 1 +
10 files changed, 202 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/cloudstacklog
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/cloudstacklog b/scripts/vm/hypervisor/xenserver/cloudstacklog
new file mode 100644
index 0000000..2bae5ab
--- /dev/null
+++ b/scripts/vm/hypervisor/xenserver/cloudstacklog
@@ -0,0 +1,12 @@
+/var/log/vmops.log {
+ daily
+ size 1M
+ rotate 20
+}
+
+/var/log/ovstunnel.log /var/log/ovs-pvlan.log {
+ daily
+ size 1M
+ rotate 2
+}
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/ovs-pvlan
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/ovs-pvlan b/scripts/vm/hypervisor/xenserver/ovs-pvlan
index e1e537f..31d60d0 100755
--- a/scripts/vm/hypervisor/xenserver/ovs-pvlan
+++ b/scripts/vm/hypervisor/xenserver/ovs-pvlan
@@ -44,9 +44,9 @@ lib.setup_logging("/var/log/ovs-pvlan.log")
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
- util.SMlog("#### VMOPS enter %s ####" % name)
+ logging.debug("#### VMOPS enter %s ####" % name)
res = fn(*v, **k)
- util.SMlog("#### VMOPS exit %s ####" % name)
+ logging.debug("#### VMOPS exit %s ####" % name)
return res
return wrapped
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/ovstunnel
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/ovstunnel b/scripts/vm/hypervisor/xenserver/ovstunnel
index ddcaa5b..1ff7e82 100755
--- a/scripts/vm/hypervisor/xenserver/ovstunnel
+++ b/scripts/vm/hypervisor/xenserver/ovstunnel
@@ -53,9 +53,9 @@ block_ipv6_handlers = {
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
- util.SMlog("#### VMOPS enter %s ####" % name)
+ logging.debug("#### VMOPS enter %s ####" % name)
res = fn(*v, **k)
- util.SMlog("#### VMOPS exit %s ####" % name)
+ logging.debug("#### VMOPS exit %s ####" % name)
return res
return wrapped
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 4f57271..742cd95 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -30,16 +30,20 @@ import tempfile
import util
import subprocess
import zlib
+import cloudstack_pluginlib as lib
+import logging
from util import CommandException
+lib.setup_logging("/var/log/vmops.log")
+
CS_DIR="/opt/cloudstack/bin/"
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
- util.SMlog("#### VMOPS enter %s ####" % name )
+ logging.debug("#### VMOPS enter %s ####" % name )
res = fn(*v, **k)
- util.SMlog("#### VMOPS exit %s ####" % name )
+ logging.debug("#### VMOPS exit %s ####" % name )
return res
return wrapped
@@ -85,7 +89,7 @@ def preparemigration(session, args):
util.pread2(cmd)
txt = 'success'
except:
- util.SMlog("Catch prepare migration exception" )
+ logging.debug("Catch prepare migration exception" )
txt = ''
return txt
@@ -97,7 +101,7 @@ def setIptables(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" setIptables execution failed " )
+ logging.debug(" setIptables execution failed " )
txt = ''
return txt
@@ -142,7 +146,7 @@ def pingtest(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" pingtest failed " )
+ logging.debug(" pingtest failed " )
txt = ''
return txt
@@ -157,7 +161,7 @@ def savePassword(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" save password to domr failed " )
+ logging.debug(" save password to domr failed " )
txt = ''
return txt
@@ -172,7 +176,7 @@ def saveDhcpEntry(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" save dhcp entry failed " )
+ logging.debug(" save dhcp entry failed " )
txt = ''
return txt
@@ -234,7 +238,7 @@ def setFirewallRule(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" set firewall rule failed " )
+ logging.debug(" set firewall rule failed " )
txt = ''
return txt
@@ -250,7 +254,7 @@ def routerProxy(session, args):
if txt is None or len(txt) == 0 :
txt = 'success'
except:
- util.SMlog("routerProxy command " + sargs + " failed " )
+ logging.debug("routerProxy command " + sargs + " failed " )
txt = ''
return txt
@@ -267,7 +271,7 @@ def setLoadBalancerRule(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog(" set loadbalancer rule failed " )
+ logging.debug(" set loadbalancer rule failed " )
txt = ''
return txt
@@ -280,7 +284,7 @@ def configdnsmasq(session, args):
util.pread2(['ssh','-p','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',target,'/root/dnsmasq.sh',args])
txt='success'
except:
- util.SMlog("failed to config dnsmasq server")
+ logging.debug("failed to config dnsmasq server")
txt=''
return txt
@@ -294,7 +298,7 @@ def createipAlias(session, args):
txt=util.pread2(cmd)
txt='success'
except:
- util.SMlog("failed to create ip alias on router vm")
+ logging.debug("failed to create ip alias on router vm")
txt=''
return txt
@@ -308,7 +312,7 @@ def deleteipAlias(session, args):
txt=util.pread2(cmd)
txt='success'
except:
- util.SMlog("failed to create ip alias on router vm")
+ logging.debug("failed to create ip alias on router vm")
txt=''
return txt
@@ -323,7 +327,7 @@ def createFile(session, args):
f.close()
txt = 'success'
except:
- util.SMlog(" failed to create HA proxy cfg file ")
+ logging.debug(" failed to create HA proxy cfg file ")
txt = ''
return txt
@@ -343,7 +347,7 @@ def createFileInDomr(session, args):
util.pread2(['rm',tmpfile])
txt = 'success'
except:
- util.SMlog(" failed to create HA proxy cfg file ")
+ logging.debug(" failed to create HA proxy cfg file ")
txt = ''
return txt
@@ -357,7 +361,7 @@ def deleteFile(session, args):
os.remove(file_path)
txt = 'success'
except:
- util.SMlog(" failed to remove HA proxy cfg file ")
+ logging.debug(" failed to remove HA proxy cfg file ")
txt = ''
return txt
@@ -418,7 +422,7 @@ def can_bridge_firewall(session, args):
util.pread2(['iptables', '-A', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '-p', 'udp', '--dport', '68', '--sport', '67', '-j', 'ACCEPT'])
util.pread2(['iptables', '-D', 'FORWARD', '-j', 'RH-Firewall-1-INPUT'])
except:
- util.SMlog('Chain BRIDGE-FIREWALL already exists')
+ logging.debug('Chain BRIDGE-FIREWALL already exists')
try:
util.pread2(['iptables', '-N', 'BRIDGE-DEFAULT-FIREWALL'])
@@ -430,7 +434,7 @@ def can_bridge_firewall(session, args):
util.pread2(['iptables', '-D', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '-p', 'udp', '--dport', '67', '--sport', '68', '-j', 'ACCEPT'])
util.pread2(['iptables', '-D', 'BRIDGE-FIREWALL', '-m', 'physdev', '--physdev-is-bridged', '-p', 'udp', '--dport', '68', '--sport', '67', '-j', 'ACCEPT'])
except:
- util.SMlog('Chain BRIDGE-DEFAULT-FIREWALL already exists')
+ logging.debug('Chain BRIDGE-DEFAULT-FIREWALL already exists')
privnic = get_private_nic(session, args)
result = 'true'
@@ -479,7 +483,7 @@ def default_ebtables_rules():
# deny all others (e.g., 802.1d, CDP)
util.pread2(['ebtables', '-A', 'DEFAULT_EBTABLES', '-j', 'DROP'])
except:
- util.SMlog('Chain DEFAULT_EBTABLES already exists')
+ logging.debug('Chain DEFAULT_EBTABLES already exists')
@echo
@@ -496,7 +500,7 @@ def allow_egress_traffic(session):
try:
util.pread2(['iptables', '-I', 'FORWARD', '2', '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', d, '-j', 'ACCEPT'])
except:
- util.SMlog("Failed to add FORWARD rule through to %s" % d)
+ logging.debug("Failed to add FORWARD rule through to %s" % d)
return 'false'
return 'true'
@@ -505,7 +509,7 @@ def ipset(ipsetname, proto, start, end, ips):
try:
util.pread2(['ipset', '-N', ipsetname, 'iptreemap'])
except:
- util.SMlog("ipset chain already exists" + ipsetname)
+ logging.debug("ipset chain already exists" + ipsetname)
result = True
ipsettmp = ''.join(''.join(ipsetname.split('-')).split('_')) + str(int(time.time()) % 1000)
@@ -513,11 +517,11 @@ def ipset(ipsetname, proto, start, end, ips):
try:
util.pread2(['ipset', '-N', ipsettmp, 'iptreemap'])
except:
- util.SMlog("Failed to create temp ipset, reusing old name= " + ipsettmp)
+ logging.debug("Failed to create temp ipset, reusing old name= " + ipsettmp)
try:
util.pread2(['ipset', '-F', ipsettmp])
except:
- util.SMlog("Failed to clear old temp ipset name=" + ipsettmp)
+ logging.debug("Failed to clear old temp ipset name=" + ipsettmp)
return False
try:
@@ -528,7 +532,7 @@ def ipset(ipsetname, proto, start, end, ips):
if cex.reason.rfind('already in set') == -1:
raise
except:
- util.SMlog("Failed to program ipset " + ipsetname)
+ logging.debug("Failed to program ipset " + ipsetname)
util.pread2(['ipset', '-F', ipsettmp])
util.pread2(['ipset', '-X', ipsettmp])
return False
@@ -536,7 +540,7 @@ def ipset(ipsetname, proto, start, end, ips):
try:
util.pread2(['ipset', '-W', ipsettmp, ipsetname])
except:
- util.SMlog("Failed to swap ipset " + ipsetname)
+ logging.debug("Failed to swap ipset " + ipsetname)
result = False
try:
@@ -544,7 +548,7 @@ def ipset(ipsetname, proto, start, end, ips):
util.pread2(['ipset', '-X', ipsettmp])
except:
# if the temporary name clashes next time we'll just reuse it
- util.SMlog("Failed to delete temp ipset " + ipsettmp)
+ logging.debug("Failed to delete temp ipset " + ipsettmp)
return result
@@ -561,7 +565,7 @@ def destroy_network_rules_for_vm(session, args):
util.pread2(['iptables', '-F', vmchain_default])
util.pread2(['iptables', '-X', vmchain_default])
except:
- util.SMlog("Ignoring failure to delete chain " + vmchain_default)
+ logging.debug("Ignoring failure to delete chain " + vmchain_default)
destroy_ebtables_rules(vmchain)
destroy_arptables_rules(vmchain)
@@ -570,14 +574,14 @@ def destroy_network_rules_for_vm(session, args):
util.pread2(['iptables', '-F', vmchain])
util.pread2(['iptables', '-X', vmchain])
except:
- util.SMlog("Ignoring failure to delete ingress chain " + vmchain)
+ logging.debug("Ignoring failure to delete ingress chain " + vmchain)
try:
util.pread2(['iptables', '-F', vmchain_egress])
util.pread2(['iptables', '-X', vmchain_egress])
except:
- util.SMlog("Ignoring failure to delete egress chain " + vmchain_egress)
+ logging.debug("Ignoring failure to delete egress chain " + vmchain_egress)
remove_rule_log_for_vm(vm_name)
remove_secip_log_for_vm(vm_name)
@@ -593,7 +597,7 @@ def destroy_network_rules_for_vm(session, args):
util.pread2(['ipset', '-F', set])
util.pread2(['ipset', '-X', set])
except:
- util.SMlog("Failed to destroy ipsets for %" % vm_name)
+ logging.debug("Failed to destroy ipsets for %" % vm_name)
return 'true'
@@ -610,12 +614,12 @@ def destroy_ebtables_rules(vm_chain):
dc.insert(0, 'ebtables')
util.pread2(dc)
except:
- util.SMlog("Ignoring failure to delete ebtables rules for vm " + vm_chain)
+ logging.debug("Ignoring failure to delete ebtables rules for vm " + vm_chain)
try:
util.pread2(['ebtables', '-F', vm_chain])
util.pread2(['ebtables', '-X', vm_chain])
except:
- util.SMlog("Ignoring failure to delete ebtables chain for vm " + vm_chain)
+ logging.debug("Ignoring failure to delete ebtables chain for vm " + vm_chain)
@echo
def destroy_arptables_rules(vm_chain):
@@ -630,18 +634,18 @@ def destroy_arptables_rules(vm_chain):
dc.insert(2, 'FORWARD')
util.pread2(dc)
except:
- util.SMlog("Ignoring failure to delete arptables rules for vm " + vm_chain)
+ logging.debug("Ignoring failure to delete arptables rules for vm " + vm_chain)
try:
util.pread2(['arptables', '-F', vm_chain])
util.pread2(['arptables', '-X', vm_chain])
except:
- util.SMlog("Ignoring failure to delete arptables chain for vm " + vm_chain)
+ logging.debug("Ignoring failure to delete arptables chain for vm " + vm_chain)
@echo
def default_ebtables_antispoof_rules(vm_chain, vifs, vm_ip, vm_mac):
if vm_mac == 'ff:ff:ff:ff:ff:ff':
- util.SMlog("Ignoring since mac address is not valid")
+ logging.debug("Ignoring since mac address is not valid")
return 'true'
try:
@@ -650,7 +654,7 @@ def default_ebtables_antispoof_rules(vm_chain, vifs, vm_ip, vm_mac):
try:
util.pread2(['ebtables', '-F', vm_chain])
except:
- util.SMlog("Failed to create ebtables antispoof chain, skipping")
+ logging.debug("Failed to create ebtables antispoof chain, skipping")
return 'true'
# note all rules for packets into the bridge (-i) precede all output rules (-o)
@@ -660,7 +664,7 @@ def default_ebtables_antispoof_rules(vm_chain, vifs, vm_ip, vm_mac):
util.pread2(['ebtables', '-I', 'FORWARD', '2', '-i', vif, '-j', vm_chain])
util.pread2(['ebtables', '-A', 'FORWARD', '-o', vif, '-j', vm_chain])
except:
- util.SMlog("Failed to program default ebtables FORWARD rules for %s" % vm_chain)
+ logging.debug("Failed to program default ebtables FORWARD rules for %s" % vm_chain)
return 'false'
try:
@@ -676,7 +680,7 @@ def default_ebtables_antispoof_rules(vm_chain, vifs, vm_ip, vm_mac):
# do not allow snooping of dhcp requests
util.pread2(['ebtables', '-A', vm_chain, '-o', vif, '-p', 'IPv4', '--ip-proto', 'udp', '--ip-dport', '67', '-j', 'DROP'])
except:
- util.SMlog("Failed to program default ebtables antispoof rules for %s" % vm_chain)
+ logging.debug("Failed to program default ebtables antispoof rules for %s" % vm_chain)
return 'false'
return 'true'
@@ -684,7 +688,7 @@ def default_ebtables_antispoof_rules(vm_chain, vifs, vm_ip, vm_mac):
@echo
def default_arp_antispoof(vm_chain, vifs, vm_ip, vm_mac):
if vm_mac == 'ff:ff:ff:ff:ff:ff':
- util.SMlog("Ignoring since mac address is not valid")
+ logging.debug("Ignoring since mac address is not valid")
return 'true'
try:
@@ -693,7 +697,7 @@ def default_arp_antispoof(vm_chain, vifs, vm_ip, vm_mac):
try:
util.pread2(['arptables', '-F', vm_chain])
except:
- util.SMlog("Failed to create arptables rule, skipping")
+ logging.debug("Failed to create arptables rule, skipping")
return 'true'
# note all rules for packets into the bridge (-i) precede all output rules (-o)
@@ -702,7 +706,7 @@ def default_arp_antispoof(vm_chain, vifs, vm_ip, vm_mac):
util.pread2(['arptables', '-I', 'FORWARD', '-i', vif, '-j', vm_chain])
util.pread2(['arptables', '-A', 'FORWARD', '-o', vif, '-j', vm_chain])
except:
- util.SMlog("Failed to program default arptables rules in FORWARD chain vm=" + vm_chain)
+ logging.debug("Failed to program default arptables rules in FORWARD chain vm=" + vm_chain)
return 'false'
try:
@@ -719,7 +723,7 @@ def default_arp_antispoof(vm_chain, vifs, vm_ip, vm_mac):
util.pread2(['arptables', '-A', vm_chain, '-j', 'DROP'])
except:
- util.SMlog("Failed to program default arptables rules")
+ logging.debug("Failed to program default arptables rules")
return 'false'
return 'true'
@@ -731,10 +735,10 @@ def network_rules_vmSecondaryIp(session, args):
vm_mac = args.pop('vmMac')
ip_secondary = args.pop('vmSecIp')
action = args.pop('action')
- util.SMlog("vmMac = "+ vm_mac)
- util.SMlog("vmName = "+ vm_name)
+ logging.debug("vmMac = "+ vm_mac)
+ logging.debug("vmName = "+ vm_name)
#action = "-A"
- util.SMlog("action = "+ action)
+ logging.debug("action = "+ action)
try:
vm = session.xenapi.VM.get_by_name_label(vm_name)
if len(vm) != 1:
@@ -744,11 +748,11 @@ def network_rules_vmSecondaryIp(session, args):
vifnums = [session.xenapi.VIF.get_record(vif).get('device') for vif in vm_vifs]
domid = vm_rec.get('domid')
except:
- util.SMlog("### Failed to get domid or vif list for vm ##" + vm_name)
+ logging.debug("### Failed to get domid or vif list for vm ##" + vm_name)
return 'false'
if domid == '-1':
- util.SMlog("### Failed to get domid for vm (-1): " + vm_name)
+ logging.debug("### Failed to get domid for vm (-1): " + vm_name)
return 'false'
vifs = ["vif" + domid + "." + v for v in vifnums]
@@ -773,11 +777,11 @@ def default_network_rules_systemvm(session, args):
vifnums = [session.xenapi.VIF.get_record(vif).get('device') for vif in vm_vifs]
domid = vm_rec.get('domid')
except:
- util.SMlog("### Failed to get domid or vif list for vm ##" + vm_name)
+ logging.debug("### Failed to get domid or vif list for vm ##" + vm_name)
return 'false'
if domid == '-1':
- util.SMlog("### Failed to get domid for vm (-1): " + vm_name)
+ logging.debug("### Failed to get domid for vm (-1): " + vm_name)
return 'false'
vifs = ["vif" + domid + "." + v for v in vifnums]
@@ -798,26 +802,26 @@ def default_network_rules_systemvm(session, args):
util.pread2(['iptables', '-I', 'BRIDGE-FIREWALL', '2', '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', vif, '-j', vmchain])
util.pread2(['iptables', '-I', vmchain, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', vif, '-j', 'RETURN'])
except:
- util.SMlog("Failed to program default rules")
+ logging.debug("Failed to program default rules")
return 'false'
util.pread2(['iptables', '-A', vmchain, '-j', 'ACCEPT'])
if write_rule_log_for_vm(vm_name, '-1', '_ignore_', domid, '_initial_', '-1') == False:
- util.SMlog("Failed to log default network rules for systemvm, ignoring")
+ logging.debug("Failed to log default network rules for systemvm, ignoring")
return 'true'
@echo
def create_ipset_forvm (ipsetname):
result = True
try:
- util.SMlog("Creating ipset chain .... " + ipsetname)
+ logging.debug("Creating ipset chain .... " + ipsetname)
util.pread2(['ipset', '-F', ipsetname])
util.pread2(['ipset', '-X', ipsetname])
util.pread2(['ipset', '-N', ipsetname, 'iphash'])
except:
- util.SMlog("ipset chain not exists creating.... " + ipsetname)
+ logging.debug("ipset chain not exists creating.... " + ipsetname)
util.pread2(['ipset', '-N', ipsetname, 'iphash'])
return result
@@ -827,10 +831,10 @@ def add_to_ipset(ipsetname, ips, action):
result = True
for ip in ips:
try:
- util.SMlog("vm ip " + ip)
+ logging.debug("vm ip " + ip)
util.pread2(['ipset', action, ipsetname, ip])
except:
- util.SMlog("vm ip alreday in ip set" + ip)
+ logging.debug("vm ip alreday in ip set" + ip)
continue
return result
@@ -852,7 +856,7 @@ def arp_rules_vmip (vm_chain, vifs, ips, vm_mac, action):
#also important to restrict source ip and src mac in these requests as they can be used to update arp tables on destination
util.pread2(['arptables', action, vm_chain, '-i', vif, '--opcode', 'Request', '--source-mac', vm_mac, '--source-ip', vm_ip, '-j', 'RETURN'])
except:
- util.SMlog("Failed to program arptables rules for ip")
+ logging.debug("Failed to program arptables rules for ip")
return 'false'
return 'true'
@@ -870,15 +874,15 @@ def default_network_rules(session, args):
try:
vm = session.xenapi.VM.get_by_name_label(vm_name)
if len(vm) != 1:
- util.SMlog("### Failed to get record for vm " + vm_name)
+ logging.debug("### Failed to get record for vm " + vm_name)
return 'false'
vm_rec = session.xenapi.VM.get_record(vm[0])
domid = vm_rec.get('domid')
except:
- util.SMlog("### Failed to get domid for vm " + vm_name)
+ logging.debug("### Failed to get domid for vm " + vm_name)
return 'false'
if domid == '-1':
- util.SMlog("### Failed to get domid for vm (-1): " + vm_name)
+ logging.debug("### Failed to get domid for vm (-1): " + vm_name)
return 'false'
vif = "vif" + domid + ".0"
@@ -918,12 +922,12 @@ def default_network_rules(session, args):
vmipset = vm_name
#create ipset and add vm ips to that ip set
if create_ipset_forvm(vmipset) == False:
- util.SMlog(" failed to create ipset for rule " + str(tokens))
+ logging.debug(" failed to create ipset for rule " + str(tokens))
return 'false'
#add primary nic ip to ipset
if add_to_ipset(vmipset, [vm_ip], action ) == False:
- util.SMlog(" failed to add vm " + vm_ip + " ip to set ")
+ logging.debug(" failed to add vm " + vm_ip + " ip to set ")
return 'false'
#add secodnary nic ips to ipset
@@ -934,10 +938,10 @@ def default_network_rules(session, args):
secIpSet = "0";
if secIpSet == "1":
- util.SMlog("Adding ipset for secondary ips")
+ logging.debug("Adding ipset for secondary ips")
add_to_ipset(vmipset, ips, action)
if write_secip_log_for_vm(vm_name, sec_ips, vm_id) == False:
- util.SMlog("Failed to log default network rules, ignoring")
+ logging.debug("Failed to log default network rules, ignoring")
keyword = '--' + get_ipset_keyword()
@@ -955,21 +959,21 @@ def default_network_rules(session, args):
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-in', v, '-m', 'set', keyword, vmipset, 'src', '-j', vmchain_egress])
util.pread2(['iptables', '-A', vmchain_default, '-m', 'physdev', '--physdev-is-bridged', '--physdev-out', v, '-j', vmchain])
except:
- util.SMlog("Failed to program default rules for vm " + vm_name)
+ logging.debug("Failed to program default rules for vm " + vm_name)
return 'false'
default_arp_antispoof(vmchain, vifs, vm_ip, vm_mac)
#add default arp rules for secondary ips;
if secIpSet == "1":
- util.SMlog("Adding arp rules for sec ip")
+ logging.debug("Adding arp rules for sec ip")
arp_rules_vmip(vmchain, vifs, ips, vm_mac, action)
default_ebtables_antispoof_rules(vmchain, vifs, vm_ip, vm_mac)
if write_rule_log_for_vm(vm_name, vm_id, vm_ip, domid, '_initial_', '-1', vm_mac) == False:
- util.SMlog("Failed to log default network rules, ignoring")
+ logging.debug("Failed to log default network rules, ignoring")
- util.SMlog("Programmed default rules for vm " + vm_name)
+ logging.debug("Programmed default rules for vm " + vm_name)
return 'true'
@echo
@@ -978,12 +982,12 @@ def check_domid_changed(session, vmName):
try:
vm = session.xenapi.VM.get_by_name_label(vmName)
if len(vm) != 1:
- util.SMlog("### Could not get record for vm ## " + vmName)
+ logging.debug("### Could not get record for vm ## " + vmName)
else:
vm_rec = session.xenapi.VM.get_record(vm[0])
curr_domid = vm_rec.get('domid')
except:
- util.SMlog("### Failed to get domid for vm ## " + vmName)
+ logging.debug("### Failed to get domid for vm ## " + vmName)
logfilename = "/var/run/cloud/" + vmName +".log"
@@ -1017,7 +1021,7 @@ def delete_rules_for_vm_in_bridge_firewall_chain(vmName):
dc.pop()
util.pread2(filter(None, dc))
except:
- util.SMlog("Ignoring failure to delete rules for vm " + vmName)
+ logging.debug("Ignoring failure to delete rules for vm " + vmName)
@echo
@@ -1034,7 +1038,7 @@ def network_rules_for_rebooted_vm(session, vmName):
if curr_domid == '-1':
return True
- util.SMlog("Found a rebooted VM -- reprogramming rules for " + vm_name)
+ logging.debug("Found a rebooted VM -- reprogramming rules for " + vm_name)
delete_rules_for_vm_in_bridge_firewall_chain(vm_name)
if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-', 'l-'] ]:
@@ -1079,9 +1083,9 @@ def network_rules_for_rebooted_vm(session, vmName):
try:
util.pread2(filter(None,ipt))
except:
- util.SMlog("Failed to rewrite antispoofing rules for vm " + vm_name)
+ logging.debug("Failed to rewrite antispoofing rules for vm " + vm_name)
except:
- util.SMlog("No rules found for vm " + vm_name)
+ logging.debug("No rules found for vm " + vm_name)
destroy_ebtables_rules(vmchain)
destroy_arptables_rules(vmchain)
@@ -1185,7 +1189,7 @@ def get_rule_logs_for_vms(session, args):
hostrec = session.xenapi.host.get_record(thishost)
vms = hostrec.get('resident_VMs')
except:
- util.SMlog("Failed to get host from uuid " + host_uuid)
+ logging.debug("Failed to get host from uuid " + host_uuid)
return ' '
result = []
@@ -1198,7 +1202,7 @@ def get_rule_logs_for_vms(session, args):
log = get_rule_log_for_vm(session, name)
result.append(log)
except:
- util.SMlog("Failed to get rule logs, better luck next time!")
+ logging.debug("Failed to get rule logs, better luck next time!")
return ";".join(result)
@@ -1215,13 +1219,13 @@ def cleanup_rules_for_dead_vms(session):
vm_rec = session.xenapi.VM.get_record(vm[0])
state = vm_rec.get('power_state')
if state != 'Running' and state != 'Paused':
- util.SMlog("vm " + vm_name + " is not running, cleaning up")
+ logging.debug("vm " + vm_name + " is not running, cleaning up")
destroy_network_rules_for_vm(session, {'vmName':vm_name})
cleaned = cleaned+1
- util.SMlog("Cleaned up rules for " + str(cleaned) + " vms")
+ logging.debug("Cleaned up rules for " + str(cleaned) + " vms")
except:
- util.SMlog("Failed to cleanup rules for dead vms!")
+ logging.debug("Failed to cleanup rules for dead vms!")
@echo
@@ -1240,12 +1244,12 @@ def cleanup_rules(session, args):
hostrec = session.xenapi.host.get_record(thishost[0])
vms = hostrec.get('resident_VMs')
resident_vms = [session.xenapi.VM.get_name_label(x) for x in vms]
- util.SMlog('cleanup_rules: found %s resident vms on this host %s' % (len(resident_vms)-1, hostname[0]))
+ logging.debug('cleanup_rules: found %s resident vms on this host %s' % (len(resident_vms)-1, hostname[0]))
chainscmd = "iptables-save | grep '^:' | awk '{print $1}' | cut -d':' -f2 | sed 's/-def/-%s/'| sed 's/-eg//' | sort|uniq" % instance
chains = util.pread2(['/bin/bash', '-c', chainscmd]).split('\n')
vmchains = [ch for ch in chains if 1 in [ ch.startswith(c) for c in ['r-', 'i-', 's-', 'v-', 'l-']]]
- util.SMlog('cleanup_rules: found %s iptables chains for vms on this host %s' % (len(vmchains), hostname[0]))
+ logging.debug('cleanup_rules: found %s iptables chains for vms on this host %s' % (len(vmchains), hostname[0]))
cleaned = 0
cleanup = []
for chain in vmchains:
@@ -1253,16 +1257,16 @@ def cleanup_rules(session, args):
if vmname not in resident_vms:
vmname = chain + "-untagged"
if vmname not in resident_vms:
- util.SMlog("vm " + chain + " is not running on this host, cleaning up")
+ logging.debug("vm " + chain + " is not running on this host, cleaning up")
cleanup.append(chain)
for vm_name in cleanup:
destroy_network_rules_for_vm(session, {'vmName':vm_name})
- util.SMlog("Cleaned up rules for " + str(len(cleanup)) + " chains")
+ logging.debug("Cleaned up rules for " + str(len(cleanup)) + " chains")
return str(len(cleanup))
except Exception, ex:
- util.SMlog("Failed to cleanup rules, reason= " + str(ex))
+ logging.debug("Failed to cleanup rules, reason= " + str(ex))
return '-1';
@echo
@@ -1270,7 +1274,7 @@ def check_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno):
vm_name = vmName;
logfilename = "/var/run/cloud/" + vm_name +".log"
if not os.path.exists(logfilename):
- util.SMlog("Failed to find logfile %s" %logfilename)
+ logging.debug("Failed to find logfile %s" %logfilename)
return [True, True, True]
lines = (line.rstrip() for line in open(logfilename))
@@ -1284,39 +1288,39 @@ def check_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno):
[_vmName,_vmID,_vmIP,_domID,_signature,_seqno] = line.split(',')
break
except:
- util.SMlog("Failed to parse log file for vm " + vmName)
+ logging.debug("Failed to parse log file for vm " + vmName)
remove_rule_log_for_vm(vmName)
return [True, True, True]
reprogramDefault = False
if (domID != _domID) or (vmID != _vmID) or (vmIP != _vmIP):
- util.SMlog("Change in default info set of vm %s" % vmName)
+ logging.debug("Change in default info set of vm %s" % vmName)
return [True, True, True]
else:
- util.SMlog("No change in default info set of vm %s" % vmName)
+ logging.debug("No change in default info set of vm %s" % vmName)
reprogramChain = False
rewriteLog = True
if (int(seqno) > int(_seqno)):
if (_signature != signature):
reprogramChain = True
- util.SMlog("Seqno increased from %s to %s: reprogamming "\
+ logging.debug("Seqno increased from %s to %s: reprogamming "\
"ingress rules for vm %s" % (_seqno, seqno, vmName))
else:
- util.SMlog("Seqno increased from %s to %s: but no change "\
+ logging.debug("Seqno increased from %s to %s: but no change "\
"in signature for vm: skip programming ingress "\
"rules %s" % (_seqno, seqno, vmName))
elif (int(seqno) < int(_seqno)):
- util.SMlog("Seqno decreased from %s to %s: ignoring these "\
+ logging.debug("Seqno decreased from %s to %s: ignoring these "\
"ingress rules for vm %s" % (_seqno, seqno, vmName))
rewriteLog = False
elif (signature != _signature):
- util.SMlog("Seqno %s stayed the same but signature changed from "\
+ logging.debug("Seqno %s stayed the same but signature changed from "\
"%s to %s for vm %s" % (seqno, _signature, signature, vmName))
rewriteLog = True
reprogramChain = True
else:
- util.SMlog("Seqno and signature stayed the same: %s : ignoring these "\
+ logging.debug("Seqno and signature stayed the same: %s : ignoring these "\
"ingress rules for vm %s" % (seqno, vmName))
rewriteLog = False
@@ -1326,7 +1330,7 @@ def check_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno):
def write_secip_log_for_vm (vmName, secIps, vmId):
vm_name = vmName
logfilename = "/var/run/cloud/"+vm_name+".ip"
- util.SMlog("Writing log to " + logfilename)
+ logging.debug("Writing log to " + logfilename)
logf = open(logfilename, 'w')
output = ','.join([vmName, secIps, vmId])
result = True
@@ -1335,7 +1339,7 @@ def write_secip_log_for_vm (vmName, secIps, vmId):
logf.write(output)
logf.write('\n')
except:
- util.SMlog("Failed to write to rule log file " + logfilename)
+ logging.debug("Failed to write to rule log file " + logfilename)
result = False
logf.close()
@@ -1351,7 +1355,7 @@ def remove_secip_log_for_vm(vmName):
try:
os.remove(logfilename)
except:
- util.SMlog("Failed to delete rule log file " + logfilename)
+ logging.debug("Failed to delete rule log file " + logfilename)
result = False
return result
@@ -1360,7 +1364,7 @@ def remove_secip_log_for_vm(vmName):
def write_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno, vmMac='ff:ff:ff:ff:ff:ff'):
vm_name = vmName
logfilename = "/var/run/cloud/" + vm_name +".log"
- util.SMlog("Writing log to " + logfilename)
+ logging.debug("Writing log to " + logfilename)
logf = open(logfilename, 'w')
output = ','.join([vmName, vmID, vmIP, domID, signature, seqno, vmMac])
result = True
@@ -1368,7 +1372,7 @@ def write_rule_log_for_vm(vmName, vmID, vmIP, domID, signature, seqno, vmMac='ff
logf.write(output)
logf.write('\n')
except:
- util.SMlog("Failed to write to rule log file " + logfilename)
+ logging.debug("Failed to write to rule log file " + logfilename)
result = False
logf.close()
@@ -1384,7 +1388,7 @@ def remove_rule_log_for_vm(vmName):
try:
os.remove(logfilename)
except:
- util.SMlog("Failed to delete rule log file " + logfilename)
+ logging.debug("Failed to delete rule log file " + logfilename)
result = False
return result
@@ -1414,13 +1418,13 @@ def cache_ipset_keyword():
pass
cachefile = "/var/cache/cloud/ipset.keyword"
- util.SMlog("Writing ipset keyword to " + cachefile)
+ logging.debug("Writing ipset keyword to " + cachefile)
cachef = open(cachefile, 'w')
try:
cachef.write(keyword)
cachef.write('\n')
except:
- util.SMlog("Failed to write to cache file " + cachef)
+ logging.debug("Failed to write to cache file " + cachef)
cachef.close()
return keyword
@@ -1431,7 +1435,7 @@ def get_ipset_keyword():
keyword = 'match-set'
if not os.path.exists(cachefile):
- util.SMlog("Failed to find ipset keyword cachefile %s" %cachefile)
+ logging.debug("Failed to find ipset keyword cachefile %s" %cachefile)
keyword = cache_ipset_keyword()
else:
lines = (line.rstrip() for line in open(cachefile))
@@ -1458,15 +1462,15 @@ def network_rules(session, args):
try:
vm = session.xenapi.VM.get_by_name_label(vm_name)
if len(vm) != 1:
- util.SMlog("### Could not get record for vm ## " + vm_name)
+ logging.debug("### Could not get record for vm ## " + vm_name)
return 'false'
vm_rec = session.xenapi.VM.get_record(vm[0])
domid = vm_rec.get('domid')
except:
- util.SMlog("### Failed to get domid for vm ## " + vm_name)
+ logging.debug("### Failed to get domid for vm ## " + vm_name)
return 'false'
if domid == '-1':
- util.SMlog("### Failed to get domid for vm (-1): " + vm_name)
+ logging.debug("### Failed to get domid for vm (-1): " + vm_name)
return 'false'
vif = "vif" + domid + ".0"
@@ -1484,21 +1488,21 @@ def network_rules(session, args):
check_rule_log_for_vm (vm_name, vm_id, vm_ip, domid, signature, seqno)
if not reprogramDefault and not reprogramChain:
- util.SMlog("No changes detected between current state and received state")
+ logging.debug("No changes detected between current state and received state")
reason = 'seqno_same_sig_same'
if rewriteLog:
reason = 'seqno_increased_sig_same'
write_rule_log_for_vm(vm_name, vm_id, vm_ip, domid, signature, seqno, vm_mac)
- util.SMlog("Programming network rules for vm %s seqno=%s signature=%s guestIp=%s,"\
+ logging.debug("Programming network rules for vm %s seqno=%s signature=%s guestIp=%s,"\
" do nothing, reason=%s" % (vm_name, seqno, signature, vm_ip, reason))
return 'true'
if not reprogramChain:
- util.SMlog("###Not programming any ingress rules since no changes detected?")
+ logging.debug("###Not programming any ingress rules since no changes detected?")
return 'true'
if reprogramDefault:
- util.SMlog("Change detected in vmId or vmIp or domId, resetting default rules")
+ logging.debug("Change detected in vmId or vmIp or domId, resetting default rules")
default_network_rules(session, args)
reason = 'domid_change'
@@ -1508,7 +1512,7 @@ def network_rules(session, args):
keyword = '--' + get_ipset_keyword()
lines = rules.split(' ')
- util.SMlog("Programming network rules for vm %s seqno=%s numrules=%s signature=%s guestIp=%s,"\
+ logging.debug("Programming network rules for vm %s seqno=%s numrules=%s signature=%s guestIp=%s,"\
" update iptables, reason=%s" % (vm_name, seqno, len(lines), signature, vm_ip, reason))
cmds = []
@@ -1546,7 +1550,7 @@ def network_rules(session, args):
ipsetname = vmchain + "_" + protocol + "_any"
if ipset(ipsetname, protocol, start, end, ips) == False:
- util.SMlog(" failed to create ipset for rule " + str(tokens))
+ logging.debug(" failed to create ipset for rule " + str(tokens))
if protocol == 'all':
iptables = ['iptables', '-I', vmchain, '-m', 'state', '--state', 'NEW', '-m', 'set', keyword, ipsetname, direction, '-j', action]
@@ -1559,7 +1563,7 @@ def network_rules(session, args):
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-m', 'set', keyword, ipsetname, direction, '-j', action]
cmds.append(iptables)
- util.SMlog(iptables)
+ logging.debug(iptables)
if allow_any and protocol != 'all':
if protocol != 'icmp':
@@ -1570,20 +1574,20 @@ def network_rules(session, args):
range = "any"
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-j', action]
cmds.append(iptables)
- util.SMlog(iptables)
+ logging.debug(iptables)
vmchain = chain_name(vm_name)
try:
util.pread2(['iptables', '-F', vmchain])
except:
- util.SMlog("Ignoring failure to delete chain " + vmchain)
+ logging.debug("Ignoring failure to delete chain " + vmchain)
util.pread2(['iptables', '-N', vmchain])
egress_vmchain = egress_chain_name(vm_name)
try:
util.pread2(['iptables', '-F', egress_vmchain])
except:
- util.SMlog("Ignoring failure to delete chain " + egress_vmchain)
+ logging.debug("Ignoring failure to delete chain " + egress_vmchain)
util.pread2(['iptables', '-N', egress_vmchain])
@@ -1602,7 +1606,7 @@ def network_rules(session, args):
return 'true'
except:
- util.SMlog("Failed to network rule !")
+ logging.debug("Failed to network rule !")
@echo
def bumpUpPriority(session, args):
@@ -1614,7 +1618,7 @@ def bumpUpPriority(session, args):
txt = util.pread2(cmd)
txt = 'success'
except:
- util.SMlog("bump up priority fail! ")
+ logging.debug("bump up priority fail! ")
txt = ''
return txt
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/vmopsSnapshot
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopsSnapshot b/scripts/vm/hypervisor/xenserver/vmopsSnapshot
index dc8e11d..0f5fbc6 100755
--- a/scripts/vm/hypervisor/xenserver/vmopsSnapshot
+++ b/scripts/vm/hypervisor/xenserver/vmopsSnapshot
@@ -34,6 +34,10 @@ import xs_errors
import cleanup
import stat
import random
+import cloudstack_pluginlib as lib
+import logging
+
+lib.setup_logging("/var/log/vmops.log")
VHD_UTIL = '/opt/cloudstack/bin/vhd-util'
VHD_PREFIX = 'VHD-'
@@ -42,9 +46,9 @@ CLOUD_DIR = '/var/run/cloud_mount'
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
- util.SMlog("#### VMOPS enter %s ####" % name )
+ logging.debug("#### VMOPS enter %s ####" % name )
res = fn(*v, **k)
- util.SMlog("#### VMOPS exit %s ####" % name )
+ logging.debug("#### VMOPS exit %s ####" % name )
return res
return wrapped
@@ -53,7 +57,7 @@ def echo(fn):
def create_secondary_storage_folder(session, args):
local_mount_path = None
- util.SMlog("create_secondary_storage_folder, args: " + str(args))
+ logging.debug("create_secondary_storage_folder, args: " + str(args))
try:
try:
@@ -70,11 +74,11 @@ def create_secondary_storage_folder(session, args):
os.umask(current_umask)
except OSError, (errno, strerror):
errMsg = "create_secondary_storage_folder failed: errno: " + str(errno) + ", strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
except:
errMsg = "create_secondary_storage_folder failed."
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
finally:
if local_mount_path != None:
@@ -89,7 +93,7 @@ def create_secondary_storage_folder(session, args):
def delete_secondary_storage_folder(session, args):
local_mount_path = None
- util.SMlog("delete_secondary_storage_folder, args: " + str(args))
+ logging.debug("delete_secondary_storage_folder, args: " + str(args))
try:
try:
@@ -105,11 +109,11 @@ def delete_secondary_storage_folder(session, args):
os.system("rmdir " + folder)
except OSError, (errno, strerror):
errMsg = "delete_secondary_storage_folder failed: errno: " + str(errno) + ", strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
except:
errMsg = "delete_secondary_storage_folder failed."
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
finally:
if local_mount_path != None:
@@ -155,16 +159,16 @@ def post_create_private_template(session, args):
f.write("vhd.size=" + str(file_size) + "\n")
f.write("size=" + str(file_size) + "\n")
f.close()
- util.SMlog("Created template.properties file")
+ logging.debug("Created template.properties file")
# Set permissions
permissions = stat.S_IREAD | stat.S_IWRITE | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH
os.chmod(template_properties_install_path, permissions)
- util.SMlog("Set permissions on template and template.properties")
+ logging.debug("Set permissions on template and template.properties")
except:
errMsg = "post_create_private_template failed."
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
finally:
@@ -185,12 +189,12 @@ def isfile(path, isISCSI):
if not exists:
errMsg = "File " + path + " does not exist."
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return errMsg
def copyfile(fromFile, toFile, isISCSI):
- util.SMlog("Starting to copy " + fromFile + " to " + toFile)
+ logging.debug("Starting to copy " + fromFile + " to " + toFile)
errMsg = ''
try:
cmd = ['dd', 'if=' + fromFile, 'of=' + toFile, 'bs=4M']
@@ -202,10 +206,10 @@ def copyfile(fromFile, toFile, isISCSI):
txt = ''
txt = ''
errMsg = "Error while copying " + fromFile + " to " + toFile + " in secondary storage"
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
- util.SMlog("Successfully copied " + fromFile + " to " + toFile)
+ logging.debug("Successfully copied " + fromFile + " to " + toFile)
return errMsg
def chdir(path):
@@ -213,9 +217,9 @@ def chdir(path):
os.chdir(path)
except OSError, (errno, strerror):
errMsg = "Unable to chdir to " + path + " because of OSError with errno: " + str(errno) + " and strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
- util.SMlog("Chdired to " + path)
+ logging.debug("Chdired to " + path)
return
def scanParent(path):
@@ -230,7 +234,7 @@ def scanParent(path):
parentUUID = vhdInfo.parentUuid
except:
errMsg = "Could not get vhd parent of " + path
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return parentUUID
@@ -243,7 +247,7 @@ def getParent(path, isISCSI):
parentUUID = vhdutil.getParent(path, cleanup.FileVDI.extractUuid)
except:
errMsg = "Could not get vhd parent of " + path
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return parentUUID
@@ -258,7 +262,7 @@ def getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI):
else:
baseCopyUuid = getParent(snapshotPath, isISCSI)
- util.SMlog("Base copy of snapshotUuid: " + snapshotUuid + " is " + baseCopyUuid)
+ logging.debug("Base copy of snapshotUuid: " + snapshotUuid + " is " + baseCopyUuid)
return baseCopyUuid
def setParent(parent, child):
@@ -267,9 +271,9 @@ def setParent(parent, child):
txt = util.pread2(cmd)
except:
errMsg = "Unexpected error while trying to set parent of " + child + " to " + parent
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
- util.SMlog("Successfully set parent of " + child + " to " + parent)
+ logging.debug("Successfully set parent of " + child + " to " + parent)
return
def rename(originalVHD, newVHD):
@@ -277,7 +281,7 @@ def rename(originalVHD, newVHD):
os.rename(originalVHD, newVHD)
except OSError, (errno, strerror):
errMsg = "OSError while renaming " + origiinalVHD + " to " + newVHD + "with errno: " + str(errno) + " and strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return
@@ -290,7 +294,7 @@ def makedirs(path):
if os.path.isdir(path):
return
errMsg = "OSError while creating " + path + " with errno: " + str(errno) + " and strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return
@@ -303,9 +307,9 @@ def mount(remoteDir, localDir):
except:
txt = ''
errMsg = "Unexpected error while trying to mount " + remoteDir + " to " + localDir
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
- util.SMlog("Successfully mounted " + remoteDir + " to " + localDir)
+ logging.debug("Successfully mounted " + remoteDir + " to " + localDir)
return
@@ -315,10 +319,10 @@ def umount(localDir):
util.pread2(cmd)
except CommandException:
errMsg = "CommandException raised while trying to umount " + localDir
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
- util.SMlog("Successfully unmounted " + localDir)
+ logging.debug("Successfully unmounted " + localDir)
return
def mountSnapshotsDir(secondaryStorageMountPath, localMountPointPath, path):
@@ -340,7 +344,7 @@ def mountSnapshotsDir(secondaryStorageMountPath, localMountPointPath, path):
# There is more than one secondary storage per zone.
# And we are mounting each sec storage under a zone-specific directory
# So two secondary storage snapshot dirs will never get mounted on the same point on the same XenServer.
- util.SMlog("The remote snapshots directory has already been mounted on " + localMountPointPath)
+ logging.debug("The remote snapshots directory has already been mounted on " + localMountPointPath)
else:
mount(snapshotsDir, localMountPointPath)
@@ -353,11 +357,11 @@ def unmountAll(path):
try:
for dir in os.listdir(path):
if dir.isdigit():
- util.SMlog("Unmounting Sub-Directory: " + dir)
+ logging.debug("Unmounting Sub-Directory: " + dir)
localMountPointPath = os.path.join(path, dir)
umount(localMountPointPath)
except:
- util.SMlog("Ignoring the error while trying to unmount the snapshots dir")
+ logging.debug("Ignoring the error while trying to unmount the snapshots dir")
@echo
def unmountSnapshotsDir(session, args):
@@ -368,7 +372,7 @@ def unmountSnapshotsDir(session, args):
try:
umount(localMountPointPath)
except:
- util.SMlog("Ignoring the error while trying to unmount the snapshots dir.")
+ logging.debug("Ignoring the error while trying to unmount the snapshots dir.")
return "1"
@@ -405,14 +409,14 @@ def makeUnavailable(uuid, primarySRPath, isISCSI):
def manageAvailability(path, value):
if path.__contains__("/var/run/sr-mount"):
return
- util.SMlog("Setting availability of " + path + " to " + value)
+ logging.debug("Setting availability of " + path + " to " + value)
try:
cmd = ['/usr/sbin/lvchange', value, path]
util.pread2(cmd)
except: #CommandException, (rc, cmdListStr, stderr):
#errMsg = "CommandException thrown while executing: " + cmdListStr + " with return code: " + str(rc) + " and stderr: " + stderr
errMsg = "Unexpected exception thrown by lvchange"
- util.SMlog(errMsg)
+ logging.debug(errMsg)
if value == "-ay":
# Raise an error only if we are trying to make it available.
# Just warn if we are trying to make it unavailable after the
@@ -430,7 +434,7 @@ def checkVolumeAvailablility(path):
manageAvailability(path, '-ay')
except:
errMsg = "Could not determine status of ISCSI path: " + path
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
success = False
@@ -441,7 +445,7 @@ def checkVolumeAvailablility(path):
# set isISCSI to true
success = isVolumeAvailable(path)
if success:
- util.SMlog("Made vhd: " + path + " available and confirmed that it is visible")
+ logging.debug("Made vhd: " + path + " available and confirmed that it is visible")
break
# Sleep for 10 seconds before checking again.
@@ -449,7 +453,7 @@ def checkVolumeAvailablility(path):
# If not visible within 1 min fail
if not success:
- util.SMlog("Could not make vhd: " + path + " available despite waiting for 1 minute. Does it exist?")
+ logging.debug("Could not make vhd: " + path + " available despite waiting for 1 minute. Does it exist?")
return success
@@ -461,19 +465,19 @@ def isVolumeAvailable(path):
status = p.communicate()[0].strip("\n")
except:
errMsg = "Could not determine status of ISCSI path: " + path
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return (status == "1")
def getVhdParent(session, args):
- util.SMlog("getParent with " + str(args))
+ logging.debug("getParent with " + str(args))
primaryStorageSRUuid = args['primaryStorageSRUuid']
snapshotUuid = args['snapshotUuid']
isISCSI = getIsTrueString(args['isISCSI'])
primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI)
- util.SMlog("primarySRPath: " + primarySRPath)
+ logging.debug("primarySRPath: " + primarySRPath)
baseCopyUuid = getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI)
@@ -481,7 +485,7 @@ def getVhdParent(session, args):
def backupSnapshot(session, args):
- util.SMlog("Called backupSnapshot with " + str(args))
+ logging.debug("Called backupSnapshot with " + str(args))
primaryStorageSRUuid = args['primaryStorageSRUuid']
secondaryStorageMountPath = args['secondaryStorageMountPath']
snapshotUuid = args['snapshotUuid']
@@ -491,19 +495,19 @@ def backupSnapshot(session, args):
path = args['path']
localMountPoint = args['localMountPoint']
primarySRPath = getPrimarySRPath(primaryStorageSRUuid, isISCSI)
- util.SMlog("primarySRPath: " + primarySRPath)
+ logging.debug("primarySRPath: " + primarySRPath)
baseCopyUuid = getParentOfSnapshot(snapshotUuid, primarySRPath, isISCSI)
baseCopyVHD = getVHD(baseCopyUuid, isISCSI)
baseCopyPath = os.path.join(primarySRPath, baseCopyVHD)
- util.SMlog("Base copy path: " + baseCopyPath)
+ logging.debug("Base copy path: " + baseCopyPath)
# Mount secondary storage mount path on XenServer along the path
# /var/run/sr-mount/<dcId>/snapshots/ and create <accountId>/<volumeId> dir
# on it.
backupsDir = mountSnapshotsDir(secondaryStorageMountPath, localMountPoint, path)
- util.SMlog("Backups dir " + backupsDir)
+ logging.debug("Backups dir " + backupsDir)
prevBackupUuid = prevBackupUuid.split("/")[-1]
# Check existence of snapshot on primary storage
isfile(baseCopyPath, isISCSI)
@@ -516,7 +520,7 @@ def backupSnapshot(session, args):
# copy baseCopyPath to backupsDir with new uuid
backupVHD = getBackupVHD(backupUuid)
backupFile = os.path.join(backupsDir, backupVHD)
- util.SMlog("Back up " + baseCopyUuid + " to Secondary Storage as " + backupUuid)
+ logging.debug("Back up " + baseCopyUuid + " to Secondary Storage as " + backupUuid)
copyfile(baseCopyPath, backupFile, isISCSI)
vhdutil.setHidden(backupFile, False)
@@ -532,7 +536,7 @@ def backupSnapshot(session, args):
@echo
def deleteSnapshotBackup(session, args):
- util.SMlog("Calling deleteSnapshotBackup with " + str(args))
+ logging.debug("Calling deleteSnapshotBackup with " + str(args))
secondaryStorageMountPath = args['secondaryStorageMountPath']
backupUUID = args['backupUUID']
path = args['path']
@@ -543,27 +547,27 @@ def deleteSnapshotBackup(session, args):
chdir(backupsDir)
backupVHD = getBackupVHD(backupUUID)
- util.SMlog("checking existence of " + backupVHD)
+ logging.debug("checking existence of " + backupVHD)
# The backupVHD is on secondary which is NFS and not ISCSI.
if not os.path.isfile(backupVHD):
- util.SMlog("backupVHD " + backupVHD + "does not exist. Not trying to delete it")
+ logging.debug("backupVHD " + backupVHD + "does not exist. Not trying to delete it")
return "1"
- util.SMlog("backupVHD " + backupVHD + " exists.")
+ logging.debug("backupVHD " + backupVHD + " exists.")
# Just delete the backupVHD
try:
os.remove(backupVHD)
except OSError, (errno, strerror):
errMsg = "OSError while removing " + backupVHD + " with errno: " + str(errno) + " and strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return "1"
@echo
def revert_memory_snapshot(session, args):
- util.SMlog("Calling revert_memory_snapshot with " + str(args))
+ logging.debug("Calling revert_memory_snapshot with " + str(args))
vmName = args['vmName']
snapshotUUID = args['snapshotUUID']
oldVmUuid = args['oldVmUuid']
@@ -583,7 +587,7 @@ def revert_memory_snapshot(session, args):
os.system("xe vdi-destroy uuid=" + vdiUuid)
except OSError, (errno, strerror):
errMsg = "OSError while reverting vm " + vmName + " to snapshot " + snapshotUUID + " with errno: " + str(errno) + " and strerr: " + strerror
- util.SMlog(errMsg)
+ logging.debug(errMsg)
raise xs_errors.XenError(errMsg)
return "0"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/vmopspremium
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopspremium b/scripts/vm/hypervisor/xenserver/vmopspremium
index 973c030..cd495fd 100755
--- a/scripts/vm/hypervisor/xenserver/vmopspremium
+++ b/scripts/vm/hypervisor/xenserver/vmopspremium
@@ -25,15 +25,19 @@ import XenAPIPlugin
sys.path.append("/opt/xensource/sm/")
import util
import socket
+import cloudstack_pluginlib as lib
+import logging
+
+lib.setup_logging("/var/log/vmops.log")
CS_DIR="/opt/cloudstack/bin/"
def echo(fn):
def wrapped(*v, **k):
name = fn.__name__
- util.SMlog("#### VMOPS enter %s ####" % name )
+ logging.debug("#### VMOPS enter %s ####" % name )
res = fn(*v, **k)
- util.SMlog("#### VMOPS exit %s ####" % name )
+ logging.debug("#### VMOPS exit %s ####" % name )
return res
return wrapped
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index 4188846..8af0314 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -64,3 +64,4 @@ getRouterStatus.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
bumpUpPriority.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
getDomRVersion.sh=../../../../network/domr/,0755,/opt/cloudstack/bin
add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
+cloudstacklog=..,0644,/etc/logrotate.d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index da1670e..9eac710 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -64,4 +64,4 @@ swift=..,0755,/opt/cloudstack/bin
swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
-
+cloudstacklog=..,0644,/etc/logrotate.d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index ecd4378..573e0c5 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -63,4 +63,4 @@ swift=..,0755,/opt/cloudstack/bin
swiftxen=..,0755,/etc/xapi.d/plugins
s3xen=..,0755,/etc/xapi.d/plugins
add_to_vcpus_params_live.sh=..,0755,/opt/cloudstack/bin
-
+cloudstacklog=..,0644,/etc/logrotate.d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1de07ba/scripts/vm/hypervisor/xenserver/xenserver60/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch b/scripts/vm/hypervisor/xenserver/xenserver60/patch
index 049c22a..11185ee 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver60/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch
@@ -74,3 +74,4 @@ ovs-pvlan-vm.sh=../../../network,0755,/opt/cloudstack/bin
ovs-pvlan-cleanup.sh=../../../network,0755,/opt/cloudstack/bin
ovs-get-dhcp-iface.sh=..,0755,/opt/cloudstack/bin
ovs-get-bridge.sh=..,0755,/opt/cloudstack/bin
+cloudstacklog=..,0644,/etc/logrotate.d