enable xml tests test_disk_config

This enable the xml tests in file test_disk_config.
In diskconfig extension, it require disk_config
must be 'AUTO' or 'MANUAL'. So Change it in
test_create_server.py. It can work before, because
it didn't deal with the parameter disk_config.

Partially implements bp missing-tempest-tests

Change-Id: Ib6ed2f2b4319193ba57a139083e8974deeee3f35
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index bd393e8..b755b41 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -93,6 +93,11 @@
         json['addresses'] = json_addresses
     else:
         json = xml_to_json(xml_dom)
+    diskConfig = '{http://docs.openstack.org/compute/ext/disk_config/api/v1.1'\
+                 '}diskConfig'
+    if diskConfig in json:
+        json['OS-DCF:diskConfig'] = json[diskConfig]
+        del json[diskConfig]
     return json
 
 
@@ -233,6 +238,11 @@
             if attr in kwargs:
                 server.add_attr(attr, kwargs[attr])
 
+        if 'disk_config' in kwargs:
+            server.add_attr('xmlns:OS-DCF', "http://docs.openstack.org/"
+                            "compute/ext/disk_config/api/v1.1")
+            server.add_attr('OS-DCF:diskConfig', kwargs['disk_config'])
+
         if 'security_groups' in kwargs:
             secgroups = Element("security_groups")
             server.append(secgroups)
@@ -355,6 +365,12 @@
 
     def rebuild(self, server_id, image_ref, **kwargs):
         kwargs['imageRef'] = image_ref
+        if 'disk_config' in kwargs:
+            kwargs['OS-DCF:diskConfig'] = kwargs['disk_config']
+            del kwargs['disk_config']
+            kwargs['xmlns:OS-DCF'] = "http://docs.openstack.org/"\
+                                     "compute/ext/disk_config/api/v1.1"
+            kwargs['xmlns:atom'] = "http://www.w3.org/2005/Atom"
         if 'xmlns' not in kwargs:
             kwargs['xmlns'] = XMLNS_11
 
@@ -379,8 +395,11 @@
 
     def resize(self, server_id, flavor_ref, **kwargs):
         if 'disk_config' in kwargs:
-            raise NotImplementedError("Sorry, disk_config not "
-                                      "supported via XML yet")
+            kwargs['OS-DCF:diskConfig'] = kwargs['disk_config']
+            del kwargs['disk_config']
+            kwargs['xmlns:OS-DCF'] = "http://docs.openstack.org/"\
+                                     "compute/ext/disk_config/api/v1.1"
+            kwargs['xmlns:atom'] = "http://www.w3.org/2005/Atom"
         kwargs['flavorRef'] = flavor_ref
         return self.action(server_id, 'resize', None, **kwargs)
 
diff --git a/tempest/tests/compute/servers/test_create_server.py b/tempest/tests/compute/servers/test_create_server.py
index aaab9fa..b522992 100644
--- a/tempest/tests/compute/servers/test_create_server.py
+++ b/tempest/tests/compute/servers/test_create_server.py
@@ -33,7 +33,7 @@
 class ServersTestJSON(base.BaseComputeTest):
     _interface = 'json'
     run_ssh = tempest.config.TempestConfig().compute.run_ssh
-    disk_config = None
+    disk_config = 'AUTO'
 
     @classmethod
     def setUpClass(cls):
@@ -118,18 +118,6 @@
 
 
 @attr(type='positive')
-class ServersTestAutoDisk(ServersTestJSON):
-    disk_config = 'AUTO'
-
-    @classmethod
-    def setUpClass(cls):
-        if not compute.DISK_CONFIG_ENABLED:
-            msg = "DiskConfig extension not enabled."
-            raise cls.skipException(msg)
-        super(ServersTestAutoDisk, cls).setUpClass()
-
-
-@attr(type='positive')
 class ServersTestManualDisk(ServersTestJSON):
     disk_config = 'MANUAL'
 
diff --git a/tempest/tests/compute/servers/test_disk_config.py b/tempest/tests/compute/servers/test_disk_config.py
index 3a1ec20..401e770 100644
--- a/tempest/tests/compute/servers/test_disk_config.py
+++ b/tempest/tests/compute/servers/test_disk_config.py
@@ -23,7 +23,7 @@
 from tempest.tests.compute import base
 
 
-class TestServerDiskConfig(base.BaseComputeTest):
+class ServerDiskConfigTestJSON(base.BaseComputeTest):
     _interface = 'json'
 
     @classmethod
@@ -31,7 +31,7 @@
         if not compute.DISK_CONFIG_ENABLED:
             msg = "DiskConfig extension not enabled."
             raise cls.skipException(msg)
-        super(TestServerDiskConfig, cls).setUpClass()
+        super(ServerDiskConfigTestJSON, cls).setUpClass()
         cls.client = cls.os.servers_client
 
     @attr(type='positive')
@@ -121,3 +121,7 @@
 
         #Delete the server
         resp, body = self.client.delete_server(server['id'])
+
+
+class ServerDiskConfigTestXML(ServerDiskConfigTestJSON):
+    _interface = 'xml'