Merge "Adds XML support to test_live_block_migration.py"
diff --git a/cli/simple_read_only/test_compute.py b/cli/simple_read_only/test_compute.py
index 43c3c45..c904882 100644
--- a/cli/simple_read_only/test_compute.py
+++ b/cli/simple_read_only/test_compute.py
@@ -73,7 +73,7 @@
     def test_admin_dns_domains(self):
         self.nova('dns-domains')
 
-    @testtools.skip("Test needs parameters, Bug: 1157349")
+    @testtools.skip("Test needs parameters, Bug #1157349")
     def test_admin_dns_list(self):
         self.nova('dns-list')
 
@@ -111,7 +111,7 @@
     def test_admin_image_list(self):
         self.nova('image-list')
 
-    @testtools.skip("Test needs parameters, Bug: 1157349")
+    @testtools.skip("Test needs parameters, Bug #1157349")
     def test_admin_interface_list(self):
         self.nova('interface-list')
 
@@ -136,7 +136,7 @@
     def test_admin_secgroup_list(self):
         self.nova('secgroup-list')
 
-    @testtools.skip("Test needs parameters, Bug: 1157349")
+    @testtools.skip("Test needs parameters, Bug #1157349")
     def test_admin_secgroup_list_rules(self):
         self.nova('secgroup-list-rules')
 
diff --git a/cli/simple_read_only/test_compute_manage.py b/cli/simple_read_only/test_compute_manage.py
index 17b3bf6..5768c74 100644
--- a/cli/simple_read_only/test_compute_manage.py
+++ b/cli/simple_read_only/test_compute_manage.py
@@ -49,9 +49,18 @@
     def test_help_flag(self):
         self.nova_manage('', '-h')
 
-    @testtools.skip("version is empty, bug 1138844")
     def test_version_flag(self):
         self.assertNotEqual("", self.nova_manage('', '--version'))
+        self.assertEqual(self.nova_manage('version'),
+                         self.nova_manage('', '--version'))
+
+    def test_debug_flag(self):
+        self.assertNotEqual("", self.nova_manage('instance_type list',
+                            '--debug'))
+
+    def test_verbose_flag(self):
+        self.assertNotEqual("", self.nova_manage('instance_type list',
+                            '--verbose'))
 
     # test actions
     def test_version(self):
@@ -59,3 +68,16 @@
 
     def test_flavor_list(self):
         self.assertNotEqual("", self.nova_manage('flavor list'))
+        self.assertNotEqual(self.nova_manage('instance_type list'),
+                            self.nova_manage('flavor list'))
+
+    def test_db_archive_deleted_rows(self):
+        # make sure command doesn't error out
+        self.nova_manage('db archive_deleted_rows 50')
+
+    def test_db_sync(self):
+        # make sure command doesn't error out
+        self.nova_manage('db sync')
+
+    def test_db_version(self):
+        self.assertNotEqual("", self.nova_manage('db version'))
diff --git a/tempest/services/volume/xml/admin/volume_types_client.py b/tempest/services/volume/xml/admin/volume_types_client.py
index ba4ba67..49cbadb 100644
--- a/tempest/services/volume/xml/admin/volume_types_client.py
+++ b/tempest/services/volume/xml/admin/volume_types_client.py
@@ -149,11 +149,16 @@
         url = "types/%s/extra_specs" % str(vol_type_id)
         extra_specs = Element("extra_specs", xmlns=XMLNS_11)
         if extra_spec:
-            for key, value in extra_spec.items():
-                spec = Element('extra_spec')
-                spec.add_attr('key', key)
-                spec.append(Text(value))
-                extra_specs.append(spec)
+            if isinstance(extra_spec, list):
+                extra_specs.append(extra_spec)
+            else:
+                for key, value in extra_spec.items():
+                    spec = Element('extra_spec')
+                    spec.add_attr('key', key)
+                    spec.append(Text(value))
+                    extra_specs.append(spec)
+        else:
+            extra_specs = None
 
         resp, body = self.post(url, str(Document(extra_specs)),
                                self.headers)
diff --git a/tempest/tests/compute/images/test_images.py b/tempest/tests/compute/images/test_images.py
index fb0364a..d9e4153 100644
--- a/tempest/tests/compute/images/test_images.py
+++ b/tempest/tests/compute/images/test_images.py
@@ -108,7 +108,7 @@
         self.assertRaises(exceptions.Duplicate, self.client.create_image,
                           server['id'], snapshot_name)
 
-    @testtools.skip("Until Bug 1039739 is fixed")
+    @testtools.skip("Until Bug #1039739 is fixed")
     @attr(type='negative')
     def test_create_image_when_server_is_rebooting(self):
         # Return error when creating an image of server that is rebooting
diff --git a/tempest/tests/compute/images/test_images_oneserver.py b/tempest/tests/compute/images/test_images_oneserver.py
index f7008f0..9412d39 100644
--- a/tempest/tests/compute/images/test_images_oneserver.py
+++ b/tempest/tests/compute/images/test_images_oneserver.py
@@ -58,7 +58,7 @@
             cls.alt_client = cls.alt_manager.images_client
 
     @attr(type='negative')
-    @testtools.skip("Until Bug 1006725 is fixed")
+    @testtools.skip("Until Bug #1006725 is fixed")
     def test_create_image_specify_multibyte_character_image_name(self):
         # Return an error if the image name has multi-byte characters
         snapshot_name = rand_name('\xef\xbb\xbf')
@@ -67,7 +67,7 @@
                           snapshot_name)
 
     @attr(type='negative')
-    @testtools.skip("Until Bug 1005423 is fixed")
+    @testtools.skip("Until Bug #1005423 is fixed")
     def test_create_image_specify_invalid_metadata(self):
         # Return an error when creating image with invalid metadata
         snapshot_name = rand_name('test-snap-')
@@ -76,7 +76,7 @@
                           self.server['id'], snapshot_name, meta)
 
     @attr(type='negative')
-    @testtools.skip("Until Bug 1005423 is fixed")
+    @testtools.skip("Until Bug #1005423 is fixed")
     def test_create_image_specify_metadata_over_limits(self):
         # Return an error when creating image with meta data over 256 chars
         snapshot_name = rand_name('test-snap-')
diff --git a/tempest/tests/compute/servers/test_server_actions.py b/tempest/tests/compute/servers/test_server_actions.py
index d5b2650..5634784 100644
--- a/tempest/tests/compute/servers/test_server_actions.py
+++ b/tempest/tests/compute/servers/test_server_actions.py
@@ -87,7 +87,7 @@
             self.assertGreater(new_boot_time, boot_time)
 
     @attr(type='smoke')
-    @testtools.skip('Until bug 1014647 is dealt with.')
+    @testtools.skip('Until Bug #1014647 is dealt with.')
     def test_reboot_server_soft(self):
         # The server should be signaled to reboot gracefully
         if self.run_ssh:
@@ -239,7 +239,7 @@
                           '!@#$%^&*()', 10)
 
     @attr(type='positive')
-    @testtools.skip('Until tempest bug 1014683 is fixed.')
+    @testtools.skip('Until tempest Bug #1014683 is fixed.')
     def test_get_console_output_server_id_in_reboot_status(self):
         # Positive test:Should be able to GET the console output
         # for a given server_id in reboot status
diff --git a/tempest/tests/compute/servers/test_server_rescue.py b/tempest/tests/compute/servers/test_server_rescue.py
index 9230305..5fc730a 100644
--- a/tempest/tests/compute/servers/test_server_rescue.py
+++ b/tempest/tests/compute/servers/test_server_rescue.py
@@ -123,7 +123,7 @@
         self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
 
     @attr(type='negative')
-    @testtools.skip("Skipped until Bug:1126163 is resolved")
+    @testtools.skip("Skipped until Bug #1126163 is resolved")
     def test_rescued_vm_reboot(self):
         self.assertRaises(exceptions.BadRequest, self.servers_client.reboot,
                           self.rescue_id, 'HARD')
@@ -136,7 +136,7 @@
                           self.image_ref_alt)
 
     @attr(type='positive')
-    @testtools.skip("Skipped due to Bug:1126187")
+    @testtools.skip("Skipped due to Bug #1126187")
     def test_rescued_vm_attach_volume(self):
         client = self.volumes_extensions_client
 
@@ -165,7 +165,7 @@
         self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
 
     @attr(type='positive')
-    @testtools.skip("Skipped until Bug:1126187 is resolved")
+    @testtools.skip("Skipped until Bug #1126187 is resolved")
     def test_rescued_vm_detach_volume(self):
         # Attach the volume to the server
         self.servers_client.attach_volume(self.server_id,
@@ -217,7 +217,7 @@
         self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
 
     @attr(type='positive')
-    @testtools.skip("Skipped until Bug: 1126257 is resolved")
+    @testtools.skip("Skipped until Bug #1126257 is resolved")
     def test_rescued_vm_add_remove_security_group(self):
         #Add Security group
         resp, body = self.servers_client.add_security_group(self.server_id,
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index 6a72218..4ca197a 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -320,47 +320,34 @@
     def test_get_metadata_of_alt_account_image_fails(self):
         # A get metadata for another user's image should fail
         req_metadata = {'meta1': 'value1'}
+        self.addCleanup(self.images_client.delete_image_metadata_item,
+                        self.image['id'], 'meta1')
         self.images_client.set_image_metadata(self.image['id'],
                                               req_metadata)
-        try:
-            resp, meta = \
-            self.alt_images_client.get_image_metadata_item(self.image['id'],
-                                                           'meta1')
-        except exceptions.NotFound:
-            pass
-        finally:
-            resp, body = self.images_client.delete_image_metadata_item(
-                                self.image['id'], 'meta1')
+        self.assertRaises(exceptions.NotFound,
+                          self.alt_images_client.get_image_metadata_item,
+                          self.image['id'], 'meta1')
 
     def test_delete_metadata_of_alt_account_server_fails(self):
         # A delete metadata for another user's server should fail
         req_metadata = {'meta1': 'data1'}
+        self.addCleanup(self.client.delete_server_metadata_item,
+                        self.server['id'], 'meta1')
         self.client.set_server_metadata(self.server['id'], req_metadata)
-        try:
-            resp, body = \
-            self.alt_client.delete_server_metadata_item(self.server['id'],
-                                                        'meta1')
-        except exceptions.NotFound:
-            pass
-        finally:
-            resp, body = \
-            self.client.delete_server_metadata_item(self.server['id'], 'meta1')
+        self.assertRaises(exceptions.NotFound,
+                          self.alt_client.delete_server_metadata_item,
+                          self.server['id'], 'meta1')
 
     def test_delete_metadata_of_alt_account_image_fails(self):
         # A delete metadata for another user's image should fail
         req_metadata = {'meta1': 'data1'}
+        self.addCleanup(self.images_client.delete_image_metadata_item,
+                        self.image['id'], 'meta1')
         self.images_client.set_image_metadata(self.image['id'],
                                               req_metadata)
-        try:
-            resp, body = \
-            self.alt_images_client.delete_image_metadata_item(self.image['id'],
-                                                              'meta1')
-        except exceptions.NotFound:
-            pass
-        finally:
-            resp, body = \
-            self.images_client.delete_image_metadata_item(self.image['id'],
-                                                          'meta1')
+        self.assertRaises(exceptions.NotFound,
+                          self.alt_images_client.delete_image_metadata_item,
+                          self.image['id'], 'meta1')
 
     def test_get_console_output_of_alt_account_server_fails(self):
         # A Get Console Output for another user's server should fail
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index caf57bd..35b2463 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -77,20 +77,17 @@
             services.append(service)
         service_ids = map(lambda x: x['id'], services)
 
+        def delete_services():
+            for service_id in service_ids:
+                self.client.delete_service(service_id)
+
+        self.addCleanup(delete_services)
         # List and Verify Services
         resp, body = self.client.list_services()
         self.assertTrue(resp['status'].startswith('2'))
         found = [service for service in body if service['id'] in service_ids]
         self.assertEqual(len(found), len(services), 'Services not found')
 
-        # Delete Services
-        for service in services:
-            resp, body = self.client.delete_service(service['id'])
-            self.assertTrue(resp['status'].startswith('2'))
-        resp, body = self.client.list_services()
-        found = [service for service in body if service['id'] in service_ids]
-        self.assertFalse(any(found), 'Services failed to delete')
-
 
 class ServicesTestXML(ServicesTestJSON):
     _interface = 'xml'
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index 224272e..80c6fc9 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -77,7 +77,7 @@
                           self.data.tenant['id'], self.data.test_email)
 
     @attr(type='negative')
-    @testtools.skip("Until Bug 999084 is fixed")
+    @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_empty_password(self):
         # User with an empty password should not be created
         self.data.setup_test_tenant()
@@ -86,7 +86,7 @@
                           self.alt_email)
 
     @attr(type='nagative')
-    @testtools.skip("Until Bug 999084 is fixed")
+    @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_long_password(self):
         # User having password exceeding max length should not be created
         self.data.setup_test_tenant()
@@ -95,7 +95,7 @@
                           self.alt_email)
 
     @attr(type='negative')
-    @testtools.skip("Until Bug 999084 is fixed")
+    @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_invalid_email_format(self):
         # Email format should be validated while creating a user
         self.data.setup_test_tenant()
diff --git a/tempest/tests/object_storage/test_container_sync.py b/tempest/tests/object_storage/test_container_sync.py
index dad6309..d5fa96c 100644
--- a/tempest/tests/object_storage/test_container_sync.py
+++ b/tempest/tests/object_storage/test_container_sync.py
@@ -61,7 +61,7 @@
             #Attempt to delete the container
             resp, _ = client[0].delete_container(cont_name)
 
-    @testtools.skip('Until Bug 1093743 is resolved.')
+    @testtools.skip('Until Bug #1093743 is resolved.')
     @attr(type='positive')
     def test_container_synchronization(self):
         #Container to container synchronization
diff --git a/tempest/tests/object_storage/test_object_expiry.py b/tempest/tests/object_storage/test_object_expiry.py
index 8411ef5..c12ec3d 100644
--- a/tempest/tests/object_storage/test_object_expiry.py
+++ b/tempest/tests/object_storage/test_object_expiry.py
@@ -55,7 +55,7 @@
         #Attempt to delete the container
         resp, _ = cls.container_client.delete_container(cls.container_name)
 
-    @testtools.skip('Until bug 1069849 is resolved.')
+    @testtools.skip('Until Bug #1069849 is resolved.')
     @attr(type='regression')
     def test_get_object_after_expiry_time(self):
         # GET object after expiry time
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index 76fab0b..1edce92 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -590,7 +590,7 @@
                           self.container_name, object_name,
                           metadata=self.custom_headers)
 
-    @testtools.skip('Until bug 1097137 is resolved.')
+    @testtools.skip('Until Bug #1097137 is resolved.')
     @attr(type='positive')
     def test_get_object_using_temp_url(self):
         #Access object using temp url within expiry time
diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
index 6b274c6..f528cec 100644
--- a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
@@ -79,14 +79,12 @@
                           self.client.create_volume_type_extra_specs,
                           str(uuid.uuid4()), extra_specs)
 
-    @testtools.skip('Until bug 1090322 is fixed')
     def test_create_none_body(self):
         # Should not create volume type extra spec for none POST body.
         self.assertRaises(exceptions.BadRequest,
                           self.client.create_volume_type_extra_specs,
                           self.volume_type['id'], None)
 
-    @testtools.skip('Until bug 1090322 is fixed')
     def test_create_invalid_body(self):
         # Should not create volume type extra spec for invalid POST body.
         self.assertRaises(exceptions.BadRequest,
diff --git a/tempest/tests/volume/admin/test_volume_types_negative.py b/tempest/tests/volume/admin/test_volume_types_negative.py
index c706f3d..1b11d68 100644
--- a/tempest/tests/volume/admin/test_volume_types_negative.py
+++ b/tempest/tests/volume/admin/test_volume_types_negative.py
@@ -32,7 +32,6 @@
                           display_name=str(uuid.uuid4()),
                           volume_type=str(uuid.uuid4()))
 
-    @testtools.skip('Until bug 1090356 is fixed')
     def test_create_with_empty_name(self):
         # Should not be able to create volume type with an empty name.
         self.assertRaises(exceptions.BadRequest,