]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Set bootable flag for volume serializer
authorxiaoxi_chen <xiaoxi.chen@intel.com>
Thu, 1 Aug 2013 04:15:42 +0000 (12:15 +0800)
committerxiaoxi_chen <xiaoxi.chen@intel.com>
Sun, 4 Aug 2013 06:47:47 +0000 (14:47 +0800)
In previous code we didn't set the bootable flag in volume
serializer, and even didn't check it in test. This is the
root cause for bug #1207155

This patch fixed this issue by set the bootable flag in serializer.

Fixed bug #1207155

Change-Id: I0219785aa7f30036747c230800447e99c383042c

cinder/api/v1/volumes.py
cinder/api/v2/volumes.py
cinder/tests/api/v1/test_volumes.py
cinder/tests/api/v2/test_volumes.py

index 61eb48c23f6b6193dc58ded80589755ceb1b4f6b..3053119bbc42f26937230c29455ae8c11b7d9898 100644 (file)
@@ -131,6 +131,7 @@ def make_volume(elem):
     elem.set('availability_zone')
     elem.set('created_at')
     elem.set('display_name')
+    elem.set('bootable')
     elem.set('display_description')
     elem.set('volume_type')
     elem.set('snapshot_id')
index 36e354dfb496b0fd623481478a4885b15d17316f..c2b3f938ffc9cb44863e2213b51db90d2ca72a82 100644 (file)
@@ -52,6 +52,7 @@ def make_volume(elem):
     elem.set('availability_zone')
     elem.set('created_at')
     elem.set('name')
+    elem.set('bootable')
     elem.set('description')
     elem.set('volume_type')
     elem.set('snapshot_id')
index 4c557efc969557cbb00de8161cc769fe5c990922..7870186627fb1cbdfb232b0bd7327a0dfa5953d3 100644 (file)
@@ -622,7 +622,7 @@ class VolumeSerializerTest(test.TestCase):
 
         for attr in ('id', 'status', 'size', 'availability_zone', 'created_at',
                      'display_name', 'display_description', 'volume_type',
-                     'snapshot_id'):
+                     'bootable', 'snapshot_id'):
             self.assertEqual(str(vol[attr]), tree.get(attr))
 
         for child in tree:
@@ -648,6 +648,7 @@ class VolumeSerializerTest(test.TestCase):
             status='vol_status',
             size=1024,
             availability_zone='vol_availability',
+            bootable=False,
             created_at=datetime.datetime.now(),
             attachments=[dict(id='vol_id',
                               volume_id='vol_id',
@@ -673,6 +674,7 @@ class VolumeSerializerTest(test.TestCase):
                             status='vol1_status',
                             size=1024,
                             availability_zone='vol1_availability',
+                            bootable=True,
                             created_at=datetime.datetime.now(),
                             attachments=[dict(id='vol1_id',
                                               volume_id='vol1_id',
@@ -689,6 +691,7 @@ class VolumeSerializerTest(test.TestCase):
                             status='vol2_status',
                             size=1024,
                             availability_zone='vol2_availability',
+                            bootable=False,
                             created_at=datetime.datetime.now(),
                             attachments=[dict(id='vol2_id',
                                               volume_id='vol2_id',
index 828296b61194c6559cda780c288360eff0eceb3d..842f4fb5bd632ece6799ce2c8d33af9d1be8a11a 100644 (file)
@@ -821,7 +821,7 @@ class VolumeSerializerTest(test.TestCase):
         self.assertEqual(tree.tag, NS + 'volume')
 
         for attr in ('id', 'status', 'size', 'availability_zone', 'created_at',
-                     'name', 'description', 'volume_type',
+                     'name', 'description', 'volume_type', 'bootable',
                      'snapshot_id', 'source_volid'):
             self.assertEqual(str(vol[attr]), tree.get(attr))
 
@@ -848,6 +848,7 @@ class VolumeSerializerTest(test.TestCase):
             status='vol_status',
             size=1024,
             availability_zone='vol_availability',
+            bootable=False,
             created_at=datetime.datetime.now(),
             attachments=[
                 dict(
@@ -882,6 +883,7 @@ class VolumeSerializerTest(test.TestCase):
                 status='vol1_status',
                 size=1024,
                 availability_zone='vol1_availability',
+                bootable=True,
                 created_at=datetime.datetime.now(),
                 attachments=[
                     dict(
@@ -903,6 +905,7 @@ class VolumeSerializerTest(test.TestCase):
                 status='vol2_status',
                 size=1024,
                 availability_zone='vol2_availability',
+                bootable=False,
                 created_at=datetime.datetime.now(),
                 attachments=[dict(id='vol2_id',
                                   volume_id='vol2_id',