Fix update_server JSON Schema for Nova V2

This patch fix the update_server V2 Schema to remove the
'progress' attribute from 'required' field.
'progress' attribute is not always present in response.
If server's status is one of the progress status ("ACTIVE",
"BUILD", "REBUILD", "RESIZE", "VERIFY_RESIZE",) then only
'progress' is present in response. So it should not defined as
'required'

Fixing it in base schema as same applies for other server APIs
(GET, rebuild).

This patch also adds the test case for update server in stop state
where 'progress' attribute does not come in response body.

Partially implements blueprint nova-api-attribute-test

Change-Id: Id77d263f685f69f48a8b5592465bfe91eb306443
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index 40b97d7..936b871 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -70,20 +70,34 @@
         resp, server = self.client.get_server(server['id'])
         self.assertEqual(key_name, server['key_name'])
 
+    def _update_server_name(self, server_id, status):
+        # The server name should be changed to the the provided value
+        new_name = data_utils.rand_name('server')
+        # Update the server with a new name
+        resp, server = self.client.update_server(server_id,
+                                                 name=new_name)
+        self.client.wait_for_server_status(server_id, status)
+
+        # Verify the name of the server has changed
+        resp, server = self.client.get_server(server_id)
+        self.assertEqual(new_name, server['name'])
+        return server
+
     @test.attr(type='gate')
     def test_update_server_name(self):
         # The server name should be changed to the the provided value
         resp, server = self.create_test_server(wait_until='ACTIVE')
 
-        # Update the server with a new name
-        resp, server = self.client.update_server(server['id'],
-                                                 name='newname')
-        self.assertEqual(200, resp.status)
-        self.client.wait_for_server_status(server['id'], 'ACTIVE')
+        self._update_server_name(server['id'], 'ACTIVE')
 
-        # Verify the name of the server has changed
-        resp, server = self.client.get_server(server['id'])
-        self.assertEqual('newname', server['name'])
+    @test.attr(type='gate')
+    def test_update_server_name_in_stop_state(self):
+        # The server name should be changed to the the provided value
+        resp, server = self.create_test_server(wait_until='ACTIVE')
+        self.client.stop(server['id'])
+        self.client.wait_for_server_status(server['id'], 'SHUTOFF')
+        updated_server = self._update_server_name(server['id'], 'SHUTOFF')
+        self.assertNotIn('progress', updated_server)
 
     @test.attr(type='gate')
     def test_update_access_server_address(self):
diff --git a/tempest/api_schema/compute/servers.py b/tempest/api_schema/compute/servers.py
index ca1f5aa..4e8c201 100644
--- a/tempest/api_schema/compute/servers.py
+++ b/tempest/api_schema/compute/servers.py
@@ -84,9 +84,13 @@
                     'links': parameter_types.links,
                     'addresses': parameter_types.addresses,
                 },
+                # NOTE(GMann): 'progress' attribute is present in the response
+                # only when server's status is one of the progress statuses
+                # ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE")
+                # So it is not defined as 'required'.
                 'required': ['id', 'name', 'status', 'image', 'flavor',
                              'user_id', 'tenant_id', 'created', 'updated',
-                             'progress', 'metadata', 'links', 'addresses']
+                             'metadata', 'links', 'addresses']
             }
         }
     }