travis: Use patched version of ipmitool for tests

- For out-of-band management feature (CLOUDSTACK-9299) use patched version of
  ipmitool that would work on trusty travis machines
- The ipmitool used is from xenial/16.04 release with patch from RedHat
  https://bugzilla.redhat.com/show_bug.cgi?id=1286035
- Installs ipmitool from xenial repositories to get all the dependencies
  and then install patched deb version
- Skip test if the known failure occurs

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-05-06 05:52:07 +05:30
parent 07564469e9
commit 4d5e8df2f9
4 changed files with 30 additions and 13 deletions

View File

@ -116,7 +116,7 @@ INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value) INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server', VALUES ('Advanced', 'DEFAULT', 'management-server',
'outofbandmanagement.sync.interval', '2000'); 'outofbandmanagement.sync.interval', '1000');
-- Enable dynamic RBAC by default for fresh deployments -- Enable dynamic RBAC by default for fresh deployments
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value) INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)

View File

@ -226,7 +226,7 @@
}, },
{ {
"name": "outofbandmanagement.sync.interval", "name": "outofbandmanagement.sync.interval",
"value": "2000" "value": "1000"
} }
], ],
"mgtSvr": [ "mgtSvr": [

View File

@ -70,6 +70,7 @@ class TestOutOfBandManagement(cloudstackTestCase):
if self.server: if self.server:
self.server.shutdown() self.server.shutdown()
self.server.server_close() self.server.server_close()
IpmiServerContext('reset')
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@ -143,7 +144,13 @@ class TestOutOfBandManagement(cloudstackTestCase):
cmd.action = action cmd.action = action
if timeout: if timeout:
cmd.timeout = timeout cmd.timeout = timeout
return self.apiclient.issueOutOfBandManagementPowerAction(cmd)
try:
return self.apiclient.issueOutOfBandManagementPowerAction(cmd)
except Exception as e:
if "packet session id 0x0 does not match active session" in str(e):
raise self.skipTest("Known ipmitool issue hit, skipping test")
raise e
def configureAndEnableOobm(self): def configureAndEnableOobm(self):
@ -166,8 +173,14 @@ class TestOutOfBandManagement(cloudstackTestCase):
def checkSyncToState(self, state, interval): def checkSyncToState(self, state, interval):
self.debug("Waiting for background thread to update powerstate to " + state) def checkForStateSync(expectedState):
time.sleep(1 + int(interval)*2/1000) # interval is in ms response = self.getHost(hostId=self.getHost().id).outofbandmanagement
return response.powerstate == expectedState, None
sync_interval = 1 + int(interval)/1000
res, _ = wait_until(sync_interval, 10, checkForStateSync, state)
if not res:
self.fail("Failed to get host.powerstate synced to expected state:" + state)
response = self.getHost(hostId=self.getHost().id).outofbandmanagement response = self.getHost(hostId=self.getHost().id).outofbandmanagement
self.assertEqual(response.powerstate, state) self.assertEqual(response.powerstate, state)

View File

@ -86,18 +86,22 @@ sudo service mysql restart
echo -e "\nInstalling Development tools: " echo -e "\nInstalling Development tools: "
RETRY_COUNT=3 RETRY_COUNT=3
sudo apt-get -q -y install uuid-runtime genisoimage netcat freeipmi-common freeipmi-tools libfreeipmi12 > /dev/null sudo apt-get -q -y install uuid-runtime genisoimage netcat > /dev/null
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo -e "\napt-get packages failed to install" echo -e "\napt-get packages failed to install"
fi fi
# We need version 1.8.15 or above, default installed version is buggy # Use latest ipmitool 1.8.16 dependencies
wget http://mirrors.kernel.org/ubuntu/pool/universe/i/ipmitool/ipmitool_1.8.15-1ubuntu1.1_amd64.deb -O /tmp/ipmitool.deb sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
if [[ $? -eq 0 ]]; then sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" >> /etc/apt/sources.list'
sudo dpkg -i /tmp/ipmitool.deb sudo apt-get update -q -y > /dev/null
sudo apt-get install -f -y sudo apt-get -q -y -V install freeipmi-common libfreeipmi16 libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 --no-install-recommends > /dev/null
ipmitool -V
fi # Installed version 1.8.16 with patch: https://bugzilla.redhat.com/show_bug.cgi?id=1286035
wget http://packages.shapeblue.com/contribs/ipmitool_1.8.16_travis_amd64.deb -O ipmitool.deb > /dev/null
sudo dpkg -i ipmitool.deb
ipmitool -V
echo "<settings> echo "<settings>
<mirrors> <mirrors>