Skip to content

Commit 5a062e1

Browse files
author
Anthony Xu
committed
put shell scripts to a seperate directory in XS
use same scripts for both XS and XCP
1 parent 30db5d6 commit 5a062e1

25 files changed

Lines changed: 219 additions & 2895 deletions

plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@
301301
import com.cloud.vm.VirtualMachine.State;
302302
import com.cloud.vm.snapshot.VMSnapshot;
303303

304+
import com.cloud.utils.ssh.SSHCmdHelper;
305+
306+
304307
/**
305308
* CitrixResourceBase encapsulates the calls to the XenServer Xapi process
306309
* to perform the required functionalities for CloudStack.
@@ -5299,6 +5302,12 @@ protected boolean setupServer(Connection conn) {
52995302
}
53005303

53015304
com.trilead.ssh2.Session session = sshConnection.openSession();
5305+
5306+
String cmd = "mkdir -p /opt/cloud/bin";
5307+
if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) {
5308+
throw new CloudRuntimeException("Cannot create directory /opt/cloud/bin on XenServer hosts");
5309+
}
5310+
53025311
SCPClient scp = new SCPClient(sshConnection);
53035312

53045313
List<File> files = getPatchFiles();

scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fi
8989

9090

9191

92-
VHDUTIL="/opt/xensource/bin/vhd-util"
92+
VHDUTIL="/opt/cloud/bin/vhd-util"
9393

9494
copyvhd()
9595
{

scripts/vm/hypervisor/xenserver/copy_vhd_to_secondarystorage.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if [ $? -ne 0 ]; then
7878
fi
7979

8080
vhdfile=$localmp/${vdiuuid}.vhd
81+
VHDUTIL="vhd-util"
8182

8283
if [ $type == "nfs" -o $type == "ext" ]; then
8384
dd if=/var/run/sr-mount/$sruuid/${vdiuuid}.vhd of=$vhdfile bs=2M
@@ -94,7 +95,7 @@ elif [ $type == "lvmoiscsi" -o $type == "lvm" -o $type == "lvmohba" ]; then
9495
cleanup
9596
exit 0
9697
fi
97-
size=$(vhd-util query -s -n /dev/VG_XenStorage-$sruuid/VHD-$vdiuuid)
98+
size=$($VHDUTIL query -s -n /dev/VG_XenStorage-$sruuid/VHD-$vdiuuid)
9899
if [ $? -ne 0 ]; then
99100
echo "10#can not get physical size of /dev/VG_XenStorage-$sruuid/VHD-$vdiuuid"
100101
cleanup
@@ -112,7 +113,7 @@ elif [ $type == "lvmoiscsi" -o $type == "lvm" -o $type == "lvmohba" ]; then
112113
fi
113114
#in byte unit
114115
size=$((size<<21))
115-
vhd-util modify -s $size -n $vhdfile
116+
$VHDUTIL modify -s $size -n $vhdfile
116117
if [ $? -ne 0 ]; then
117118
rm -f $vhdfile
118119
echo "11#failed to change $vhdfile physical size"

scripts/vm/hypervisor/xenserver/create_privatetemplate_from_snapshot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if [ $? -ne 0 ]; then
9696
exit 0
9797
fi
9898

99-
VHDUTIL="/opt/xensource/bin/vhd-util"
99+
VHDUTIL="/opt/cloud/bin/vhd-util"
100100

101101
copyvhd()
102102
{

scripts/vm/hypervisor/xenserver/launch_hb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if [ -z $2 ]; then
3333
exit 3
3434
fi
3535

36-
if [ ! -f /opt/xensource/bin/xenheartbeat.sh ]; then
36+
if [ ! -f /opt/cloud/bin/xenheartbeat.sh ]; then
3737
printf "Error: Unable to find xenheartbeat.sh to launch\n"
3838
exit 4
3939
fi
@@ -42,5 +42,5 @@ for psid in `ps -ef | grep xenheartbeat | grep -v grep | awk '{print $2}'`; do
4242
kill $psid
4343
done
4444

45-
nohup /opt/xensource/bin/xenheartbeat.sh $1 $2 >/dev/null 2>/dev/null &
45+
nohup /opt/cloud/bin/xenheartbeat.sh $1 $2 >/dev/null 2>/dev/null &
4646
echo "======> DONE <======"

scripts/vm/hypervisor/xenserver/ovs-pvlan

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ from time import localtime as _localtime, asctime as _asctime
3232

3333
xePath = "/opt/xensource/bin/xe"
3434
lib.setup_logging("/var/log/ovs-pvlan.log")
35-
dhcpSetupPath = "/opt/xensource/bin/ovs-pvlan-dhcp-host.sh"
36-
vmSetupPath = "/opt/xensource/bin/ovs-pvlan-vm.sh"
37-
getDhcpIfacePath = "/opt/xensource/bin/ovs-get-dhcp-iface.sh"
38-
pvlanCleanupPath = "/opt/xensource/bin/ovs-pvlan-cleanup.sh"
39-
getBridgePath = "/opt/xensource/bin/ovs-get-bridge.sh"
35+
dhcpSetupPath = "/opt/cloud/bin/ovs-pvlan-dhcp-host.sh"
36+
vmSetupPath = "/opt/cloud/bin/ovs-pvlan-vm.sh"
37+
getDhcpIfacePath = "/opt/cloud/bin/ovs-get-dhcp-iface.sh"
38+
pvlanCleanupPath = "/opt/cloud/bin/ovs-pvlan-cleanup.sh"
39+
getBridgePath = "/opt/cloud/bin/ovs-get-bridge.sh"
4040

4141
def echo(fn):
4242
def wrapped(*v, **k):

scripts/vm/hypervisor/xenserver/setup_heartbeat_file.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [ `xe pbd-list sr-uuid=$2 | grep -B 1 $1 | wc -l` -eq 0 ]; then
5858
exit 0
5959
fi
6060

61-
hbfile=/opt/xensource/bin/heartbeat
61+
hbfile=/opt/cloud/bin/heartbeat
6262

6363
if [ "$3" = "true" ]; then
6464

scripts/vm/hypervisor/xenserver/setupxenserver.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mv -n /etc/cron.daily/logrotate /etc/cron.hourly 2>&1
5555
echo 1048576 >/proc/sys/fs/aio-max-nr
5656

5757
# empty heartbeat
58-
cat /dev/null > /opt/xensource/bin/heartbeat
58+
cat /dev/null > /opt/cloud/bin/heartbeat
5959
# empty knownhost
6060
cat /dev/null > /root/.ssh/known_hosts
6161

scripts/vm/hypervisor/xenserver/swiftxen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def echo(fn):
3434
return res
3535
return wrapped
3636

37-
SWIFT = "/opt/xensource/bin/swift"
37+
SWIFT = "/opt/cloud/bin/swift"
3838

3939
MAX_SEG_SIZE = 5 * 1024 * 1024 * 1024
4040

scripts/vm/hypervisor/xenserver/upgrade_snapshot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if [ $? -ne 0 ]; then
8787
exit 0
8888
fi
8989

90-
VHDUTIL="/opt/xensource/bin/vhd-util"
90+
VHDUTIL="/opt/cloud/bin/vhd-util"
9191

9292
upgradeSnapshot()
9393
{

0 commit comments

Comments
 (0)