Merge "Update hacking.py for @testtools.skip() formatting."
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index d73b8a9..27733ac 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -47,10 +47,12 @@
raise exceptions.NotFound(body)
return resp, body['floating_ip']
- def create_floating_ip(self):
+ def create_floating_ip(self, pool_name=None):
"""Allocate a floating IP to the project."""
url = 'os-floating-ips'
- resp, body = self.post(url, None, None)
+ post_body = {'pool': pool_name}
+ post_body = json.dumps(post_body)
+ resp, body = self.post(url, post_body, self.headers)
body = json.loads(body)
return resp, body['floating_ip']
diff --git a/tempest/services/compute/xml/floating_ips_client.py b/tempest/services/compute/xml/floating_ips_client.py
index 74b4be2..93f5208 100644
--- a/tempest/services/compute/xml/floating_ips_client.py
+++ b/tempest/services/compute/xml/floating_ips_client.py
@@ -22,6 +22,7 @@
from tempest import exceptions
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
+from tempest.services.compute.xml.common import Text
from tempest.services.compute.xml.common import xml_to_json
@@ -60,10 +61,17 @@
raise exceptions.NotFound(body)
return resp, body
- def create_floating_ip(self):
+ def create_floating_ip(self, pool_name=None):
"""Allocate a floating IP to the project."""
url = 'os-floating-ips'
- resp, body = self.post(url, None, self.headers)
+ if pool_name:
+ doc = Document()
+ pool = Element("pool")
+ pool.append(Text(pool_name))
+ doc.append(pool)
+ resp, body = self.post(url, str(doc), self.headers)
+ else:
+ resp, body = self.post(url, None, self.headers)
body = self._parse_floating_ip(etree.fromstring(body))
return resp, body
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index fceeb28..008417b 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -401,6 +401,19 @@
def remove_security_group(self, server_id, name):
return self.action(server_id, 'removeSecurityGroup', None, name=name)
+ def live_migrate_server(self, server_id, dest_host, use_block_migration):
+ """This should be called with administrator privileges ."""
+
+ req_body = Element("os-migrateLive",
+ xmlns=XMLNS_11,
+ disk_over_commit=False,
+ block_migration=use_block_migration,
+ host=dest_host)
+
+ resp, body = self.post("servers/%s/action" % str(server_id),
+ str(Document(req_body)), self.headers)
+ return resp, body
+
def list_server_metadata(self, server_id):
resp, body = self.get("servers/%s/metadata" % str(server_id),
self.headers)
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index 888481a..2b21710 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -73,6 +73,14 @@
#Deleting the floating IP which is created in this method
self.client.delete_floating_ip(floating_ip_id_allocated)
+ @attr(type='negative')
+ def test_allocate_floating_ip_from_nonexistent_pool(self):
+ # Positive test:Allocation of a new floating IP from a nonexistent_pool
+ #to a project should fail
+ self.assertRaises(exceptions.NotFound,
+ self.client.create_floating_ip,
+ "non_exist_pool")
+
@attr(type='positive')
def test_delete_floating_ip(self):
# Positive test:Deletion of valid floating IP from project
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index abaaf85..e5a7d5b 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -27,7 +27,7 @@
@attr(category='live-migration')
-class LiveBlockMigrationTest(base.BaseComputeAdminTest):
+class LiveBlockMigrationTestJSON(base.BaseComputeAdminTest):
_interface = 'json'
live_migration_available = (
@@ -38,7 +38,7 @@
@classmethod
def setUpClass(cls):
- super(LiveBlockMigrationTest, cls).setUpClass()
+ super(LiveBlockMigrationTestJSON, cls).setUpClass()
cls.admin_hosts_client = cls.os_adm.hosts_client
cls.admin_servers_client = cls.os_adm.servers_client
@@ -125,4 +125,8 @@
for server_id in cls.created_server_ids:
cls.servers_client.delete_server(server_id)
- super(LiveBlockMigrationTest, cls).tearDownClass()
+ super(LiveBlockMigrationTestJSON, cls).tearDownClass()
+
+
+class LiveBlockMigrationTestXML(LiveBlockMigrationTestJSON):
+ _interface = 'xml'