summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Andrews <anotherjesse@gmail.com>2011-04-08 15:17:52 -0700
committerJesse Andrews <anotherjesse@gmail.com>2011-04-08 15:17:52 -0700
commitdf4c269a338a9b983488ce4d5b86c829a92d471b (patch)
tree17a92431dc833bb357808b44fe324a6e592da6e2
parent2800f931e134e7d6b316bb4d7f7118162c301ca9 (diff)
dd needs a count to succeed, and remove unused/non-working special case for size 0
-rw-r--r--nova/volume/driver.py11
-rw-r--r--nova/volume/san.py10
2 files changed, 5 insertions, 16 deletions
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index 906a9654b..43792b791 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -93,10 +93,7 @@ class VolumeDriver(object):
def create_volume(self, volume):
"""Creates a logical volume. Can optionally return a Dictionary of
changes to the volume object to be persisted."""
- if int(volume['size']) == 0:
- sizestr = '100M'
- else:
- sizestr = '%sG' % volume['size']
+ sizestr = '%sG' % volume['size']
self._try_execute('sudo', 'lvcreate', '-L', sizestr, '-n',
volume['name'],
FLAGS.volume_group)
@@ -116,6 +113,7 @@ class VolumeDriver(object):
# TODO(ja): reclaiming space should be done lazy and low priority
self._try_execute('sudo', 'dd', 'if=/dev/zero',
'of=%s' % self.local_path(volume),
+ 'count=%d' % volume['size'] * 1024,
'bs=1M')
self._try_execute('sudo', 'lvremove', '-f', "%s/%s" %
(FLAGS.volume_group,
@@ -601,10 +599,7 @@ class SheepdogDriver(VolumeDriver):
def create_volume(self, volume):
"""Creates a sheepdog volume"""
- if int(volume['size']) == 0:
- sizestr = '100M'
- else:
- sizestr = '%sG' % volume['size']
+ sizestr = '%sG' % volume['size']
self._try_execute('qemu-img', 'create',
"sheepdog:%s" % volume['name'],
sizestr)
diff --git a/nova/volume/san.py b/nova/volume/san.py
index 9532c8116..dd332de1a 100644
--- a/nova/volume/san.py
+++ b/nova/volume/san.py
@@ -219,10 +219,7 @@ class SolarisISCSIDriver(SanISCSIDriver):
def create_volume(self, volume):
"""Creates a volume."""
- if int(volume['size']) == 0:
- sizestr = '100M'
- else:
- sizestr = '%sG' % volume['size']
+ sizestr = '%sG' % volume['size']
zfs_poolname = self._build_zfs_poolname(volume)
@@ -489,10 +486,7 @@ class HpSanISCSIDriver(SanISCSIDriver):
#TODO(justinsb): Should we default to inheriting thinProvision?
cliq_args['thinProvision'] = '1' if FLAGS.san_thin_provision else '0'
cliq_args['volumeName'] = volume['name']
- if int(volume['size']) == 0:
- cliq_args['size'] = '100MB'
- else:
- cliq_args['size'] = '%sGB' % volume['size']
+ cliq_args['size'] = '%sGB' % volume['size']
self._cliq_run_xml("createVolume", cliq_args)