summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-05-14 01:42:26 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-05-14 01:42:26 +0900
commitaaec8400be701c674bbf89badd59ee9468827ed9 (patch)
treeeeb63be0022b8091f9a94b763baf4d97b0c556db
parent4f7cfba4a00f04b7c30c61da2946f183241a7c7f (diff)
downloadnova-aaec8400be701c674bbf89badd59ee9468827ed9.tar.gz
nova-aaec8400be701c674bbf89badd59ee9468827ed9.tar.xz
nova-aaec8400be701c674bbf89badd59ee9468827ed9.zip
volume/driver: make unit test, test_volume, pass
fake command executer doesn't return command result. Which return None instead of string. So add None check to make unit test pass.
-rw-r--r--nova/volume/driver.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index a6cf2cb46..0807ff476 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -145,9 +145,11 @@ class VolumeDriver(object):
'-C', '-o', 'Attr',
'%s/%s' % (FLAGS.volume_group,
volume['name']))
- out = out.strip()
- if (out[0] == 'o') or (out[0] == 'O'):
- raise exception.VolumeIsBusy(volume_name=volume['name'])
+ # fake_execute returns None resulting unit test error
+ if out:
+ out = out.strip()
+ if (out[0] == 'o') or (out[0] == 'O'):
+ raise exception.VolumeIsBusy(volume_name=volume['name'])
self._delete_volume(volume, volume['size'])