Use a proper function to execute commands on dom0
This commit is contained in:
parent
76feb4e3c3
commit
c51c58637f
36
run_tests.sh
36
run_tests.sh
@ -19,23 +19,25 @@ export DEVSTACK_GATE_TIMEOUT=240
|
||||
|
||||
set -u
|
||||
|
||||
SSH_DOM0="sudo -u domzero ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.33.2"
|
||||
function run_in_domzero() {
|
||||
sudo -u domzero ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.33.2 "$@"
|
||||
}
|
||||
|
||||
# Get some parameters
|
||||
APP=$($SSH_DOM0 xe vm-list name-label=$APPLIANCE_NAME --minimal </dev/null)
|
||||
APP=$(run_in_domzero xe vm-list name-label=$APPLIANCE_NAME --minimal </dev/null)
|
||||
|
||||
# Create a vm network
|
||||
VMNET=$($SSH_DOM0 xe network-create name-label=vmnet </dev/null)
|
||||
VMVIF=$($SSH_DOM0 xe vif-create vm-uuid=$APP network-uuid=$VMNET device=3 </dev/null)
|
||||
$SSH_DOM0 xe vif-plug uuid=$VMVIF </dev/null
|
||||
VMNET=$(run_in_domzero xe network-create name-label=vmnet </dev/null)
|
||||
VMVIF=$(run_in_domzero xe vif-create vm-uuid=$APP network-uuid=$VMNET device=3 </dev/null)
|
||||
run_in_domzero xe vif-plug uuid=$VMVIF </dev/null
|
||||
|
||||
# Create pub network
|
||||
PUBNET=$($SSH_DOM0 xe network-create name-label=pubnet </dev/null)
|
||||
PUBVIF=$($SSH_DOM0 xe vif-create vm-uuid=$APP network-uuid=$PUBNET device=4 </dev/null)
|
||||
$SSH_DOM0 xe vif-plug uuid=$PUBVIF </dev/null
|
||||
PUBNET=$(run_in_domzero xe network-create name-label=pubnet </dev/null)
|
||||
PUBVIF=$(run_in_domzero xe vif-create vm-uuid=$APP network-uuid=$PUBNET device=4 </dev/null)
|
||||
run_in_domzero xe vif-plug uuid=$PUBVIF </dev/null
|
||||
|
||||
# Hack iSCSI SR
|
||||
$SSH_DOM0 << SRHACK
|
||||
run_in_domzero << SRHACK
|
||||
set -eux
|
||||
sed -ie "s/'phy'/'aio'/g" /opt/xensource/sm/ISCSISR.py
|
||||
SRHACK
|
||||
@ -46,10 +48,10 @@ for dev in eth0 eth1 eth2 eth3 eth4; do
|
||||
done
|
||||
|
||||
# Add a separate disk
|
||||
SR=$($SSH_DOM0 xe sr-list type=ext --minimal </dev/null)
|
||||
VDI=$($SSH_DOM0 xe vdi-create name-label=disk-for-volumes virtual-size=10GiB sr-uuid=$SR type=user </dev/null)
|
||||
VBD=$($SSH_DOM0 xe vbd-create vm-uuid=$APP vdi-uuid=$VDI device=1 </dev/null)
|
||||
$SSH_DOM0 xe vbd-plug uuid=$VBD </dev/null
|
||||
SR=$(run_in_domzero xe sr-list type=ext --minimal </dev/null)
|
||||
VDI=$(run_in_domzero xe vdi-create name-label=disk-for-volumes virtual-size=10GiB sr-uuid=$SR type=user </dev/null)
|
||||
VBD=$(run_in_domzero xe vbd-create vm-uuid=$APP vdi-uuid=$VDI device=1 </dev/null)
|
||||
run_in_domzero xe vbd-plug uuid=$VBD </dev/null
|
||||
|
||||
# For development:
|
||||
export SKIP_DEVSTACK_GATE_PROJECT=1
|
||||
@ -73,14 +75,14 @@ mkdir -p $WORKSPACE
|
||||
function pre_test_hook() {
|
||||
# Plugins
|
||||
tar -czf - -C /home/jenkins/workspace-cache/nova/plugins/xenserver/xenapi/etc/xapi.d/plugins/ ./ |
|
||||
$SSH_DOM0 \
|
||||
run_in_domzero \
|
||||
'tar -xzf - -C /etc/xapi.d/plugins/ && chmod a+x /etc/xapi.d/plugins/*'
|
||||
|
||||
# Console log
|
||||
tar -czf - -C /home/jenkins/workspace-cache/nova/tools/xenserver/ rotate_xen_guest_logs.sh |
|
||||
$SSH_DOM0 \
|
||||
run_in_domzero \
|
||||
'tar -xzf - -C /root/ && chmod +x /root/rotate_xen_guest_logs.sh && mkdir -p /var/log/xen/guest'
|
||||
$SSH_DOM0 crontab - << CRONTAB
|
||||
run_in_domzero crontab - << CRONTAB
|
||||
* * * * * /root/rotate_xen_guest_logs.sh
|
||||
CRONTAB
|
||||
|
||||
@ -91,7 +93,7 @@ CRONTAB
|
||||
cat tools/xen/functions
|
||||
echo "create_directory_for_images"
|
||||
echo "create_directory_for_kernels"
|
||||
} | $SSH_DOM0
|
||||
} | run_in_domzero
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user