Configure the ec2 zone explicitly

Tempest now creates Availability zones which in parallel run,
may causes issues with EC2 tests.

The EC2 tests will use the preconfigured zone, instead of just picking a
random existing zone.

Closes-Bug: 1265672
Change-Id: I12dfaca868a3f0aec2a85fe45d8a524940d9eae0
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 95a4884..a07af1a 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -128,6 +128,9 @@
 # AWS Access Key (string value)
 #aws_access=<None>
 
+# AWS Zone for EC2 tests (string value)
+#aws_zone=nova
+
 # S3 Materials Path (string value)
 #s3_materials_path=/opt/stack/devstack/files/images/s3-materials/cirros-0.3.0
 
diff --git a/tempest/config.py b/tempest/config.py
index 05a493c..c2ce698 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -594,6 +594,9 @@
     cfg.StrOpt('aws_access',
                default=None,
                help="AWS Access Key"),
+    cfg.StrOpt('aws_zone',
+               default="nova",
+               help="AWS Zone for EC2 tests"),
     cfg.StrOpt('s3_materials_path',
                default="/opt/stack/devstack/files/images/"
                        "s3-materials/cirros-0.3.0",
diff --git a/tempest/services/botoclients.py b/tempest/services/botoclients.py
index b52d48c..7616a99 100644
--- a/tempest/services/botoclients.py
+++ b/tempest/services/botoclients.py
@@ -179,19 +179,6 @@
                            'revoke_security_group',
                            'revoke_security_group_egress'))
 
-    def get_good_zone(self):
-        """
-        :rtype: BaseString
-        :return: Returns with the first available zone name
-        """
-        for zone in self.get_all_zones():
-            # NOTE(afazekas): zone.region_name was None
-            if (zone.state == "available" and
-                zone.region.name == self.connection_data["region"].name):
-                return zone.name
-        else:
-            raise IndexError("Don't have a good zone")
-
 
 class ObjectClientS3(BotoClientBase):
 
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index bbfbb79..e6a1638 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -40,7 +40,7 @@
                                     ": requires ami/aki/ari manifest")))
         cls.s3_client = cls.os.s3_client
         cls.ec2_client = cls.os.ec2api_client
-        cls.zone = cls.ec2_client.get_good_zone()
+        cls.zone = CONF.boto.aws_zone
         cls.materials_path = CONF.boto.s3_materials_path
         ami_manifest = CONF.boto.ami_manifest
         aki_manifest = CONF.boto.aki_manifest
diff --git a/tempest/thirdparty/boto/test_ec2_volumes.py b/tempest/thirdparty/boto/test_ec2_volumes.py
index 6a771e5..12dea18 100644
--- a/tempest/thirdparty/boto/test_ec2_volumes.py
+++ b/tempest/thirdparty/boto/test_ec2_volumes.py
@@ -38,7 +38,7 @@
             raise cls.skipException(skip_msg)
 
         cls.client = cls.os.ec2api_client
-        cls.zone = cls.client.get_good_zone()
+        cls.zone = CONF.boto.aws_zone
 
     @test.attr(type='smoke')
     def test_create_get_delete(self):