From eaf1e56b210c94e7d26ca99b5931f3688cef984c Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Wed, 2 Sep 2015 17:05:46 -0700 Subject: [PATCH] Update path to subunit2html in post_test_hook Per: http://lists.openstack.org/pipermail/openstack-dev/2015-August/072982.html The location of subunit2html changed on the images in the gate so update the path used in the post_test_hook. Long-term we should just use what's in devstack-gate. Change-Id: I5e50e7d7ad845aba26403df1df412c0a139a6dc7 Closes-Bug: #1491646 -------------- squashed with: -------------- Don't pass null device when attaching a volume The v2.1 API schema rejects null device values in an os-volume_attachments request, so only include the device in the request if one is specified on the command line. Closes-Bug: #1491325 Change-Id: I4fa4019f19f9af6ff350db2fb6e524fa8570a6f3 --- novaclient/tests/functional/hooks/post_test_hook.sh | 2 +- novaclient/tests/unit/v2/test_shell.py | 3 +-- novaclient/v2/volumes.py | 9 +++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/novaclient/tests/functional/hooks/post_test_hook.sh b/novaclient/tests/functional/hooks/post_test_hook.sh index 8eff1fd28..1fa2618ba 100755 --- a/novaclient/tests/functional/hooks/post_test_hook.sh +++ b/novaclient/tests/functional/hooks/post_test_hook.sh @@ -18,7 +18,7 @@ function generate_testr_results { if [ -f .testrepository/0 ]; then sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo .tox/functional/bin/python /usr/local/jenkins/slave_scripts/subunit2html.py $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html + sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html sudo gzip -9 $BASE/logs/testrepository.subunit sudo gzip -9 $BASE/logs/testr_results.html sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index cfd81fccb..603e59ec1 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -2293,8 +2293,7 @@ class ShellTest(utils.TestCase): self.run_command('volume-attach sample-server Work') self.assert_called('POST', '/servers/1234/os-volume_attachments', {'volumeAttachment': - {'device': None, - 'volumeId': 'Work'}}) + {'volumeId': 'Work'}}) def test_volume_update(self): self.run_command('volume-update sample-server Work Work') diff --git a/novaclient/v2/volumes.py b/novaclient/v2/volumes.py index f0403af63..d0446c5fd 100644 --- a/novaclient/v2/volumes.py +++ b/novaclient/v2/volumes.py @@ -131,17 +131,18 @@ class VolumeManager(base.ManagerWithFind): with self.alternate_service_type('volume'): self._delete("/volumes/%s" % base.getid(volume)) - def create_server_volume(self, server_id, volume_id, device): + def create_server_volume(self, server_id, volume_id, device=None): """ Attach a volume identified by the volume ID to the given server ID :param server_id: The ID of the server :param volume_id: The ID of the volume to attach. - :param device: The device name + :param device: The device name (optional) :rtype: :class:`Volume` """ - body = {'volumeAttachment': {'volumeId': volume_id, - 'device': device}} + body = {'volumeAttachment': {'volumeId': volume_id}} + if device is not None: + body['volumeAttachment']['device'] = device return self._create("/servers/%s/os-volume_attachments" % server_id, body, "volumeAttachment")