HeatContext model update to match heat code update 47/6647/4
authorQiLiang <liangqi1@huawei.com>
Thu, 14 Jan 2016 08:09:40 +0000 (08:09 +0000)
committerqi liang <liangqi1@huawei.com>
Fri, 15 Jan 2016 01:10:25 +0000 (01:10 +0000)
In Heat Liberty release OS::Nova::Server will always use the user
pre-configured in the image (e.g. "fedora" for stock Fedora cloud
images, "ubuntu" for stock Ubuntu cloud images, "cloud-user" for
stock CentOS cloud images etc)

Change all ec2-user -> ubuntu

Add admin-user in Heat model for backwards compatibility.

Refer below links for detalis:
https://etherpad.opnfv.org/p/yardstick_release_b_troubleshooting
https://github.com/openstack/heat/commit/e423bec7f10b0f5d07f05d195b3b7860f6bceb00
http://blog.scottlowe.org/2015/04/23/ubuntu-openstack-heat-cloud-init/

JIRA: -

Change-Id: I6b8b2b21daf113a3a86aee1126b0c3e74737ef4f
Signed-off-by: QiLiang <liangqi1@huawei.com>
29 files changed:
docs/configguide/yardstick_testcases/Yardstick_task_templates.rst
docs/templates/Yardstick_task_templates.rst
samples/background-task.yaml
samples/cpuload.yaml
samples/cyclictest.yaml
samples/fio-template.yaml
samples/fio.yaml
samples/iperf3-jitter.yaml
samples/iperf3.yaml
samples/lmbench.yaml
samples/netperf.yaml
samples/perf.yaml
samples/pktgen.yaml
samples/unixbench.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml
tests/unit/benchmark/contexts/test_model.py
tests/unit/benchmark/scenarios/storage/test_fio.py
yardstick/benchmark/contexts/model.py
yardstick/benchmark/scenarios/compute/cpuload.py
yardstick/benchmark/scenarios/storage/fio.py
yardstick/orchestrator/heat.py

index d2c2b7e..8185062 100755 (executable)
@@ -139,7 +139,7 @@ construct to accomplish that:
   -
     type: Fio
     options:
-      filename: /home/ec2-user/data.raw
+      filename: /home/ubuntu/data.raw
       bs: {{bs}}
       rw: {{rw}}
       ramp_time: 10
index d2c2b7e..8185062 100755 (executable)
@@ -139,7 +139,7 @@ construct to accomplish that:
   -
     type: Fio
     options:
-      filename: /home/ec2-user/data.raw
+      filename: /home/ubuntu/data.raw
       bs: {{bs}}
       rw: {{rw}}
       ramp_time: 10
index f81867b..a844c2d 100644 (file)
@@ -41,7 +41,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index e28d2d2..7ca5282 100644 (file)
@@ -20,7 +20,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   servers:
     apollo:
index 6a16bd2..cb85dec 100644 (file)
@@ -35,7 +35,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
   servers:
     kvm:
       floating_ip: true
index ce64cde..ba710d9 100644 (file)
@@ -13,7 +13,7 @@ scenarios:
 -
   type: Fio
   options:
-    filename: /home/ec2-user/data.raw
+    filename: /home/ubuntu/data.raw
     bs: {{bs}}
     rw: {{rw}}
     ramp_time: 10
@@ -30,7 +30,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
   servers:
     fio:
       floating_ip: true
index 6e77f68..e1f5e6d 100644 (file)
@@ -5,7 +5,7 @@
 # For this sample just like running the command below on the test vm and
 # getting benchmark info back to the yardstick.
 #
-# sudo fio -filename=/home/ec2-user/data.raw -bs=4k -ipdepth=1 -rw=rw \
+# sudo fio -filename=/home/ubuntu/data.raw -bs=4k -ipdepth=1 -rw=rw \
 #          -ramp_time=10 -runtime=60 -name=yardstick-fio -ioengine=libaio \
 #          -direct=1 -group_reporting -numjobs=1 -time_based \
 #          --output-format=json
@@ -16,7 +16,7 @@ scenarios:
 -
   type: Fio
   options:
-    filename: /home/ec2-user/data.raw
+    filename: /home/ubuntu/data.raw
     bs: 4k
     iodepth: 1
     rw: rw
@@ -39,7 +39,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
   servers:
     fio:
       floating_ip: true
index 0544c41..c211571 100644 (file)
@@ -25,7 +25,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 561be81..72f2609 100644 (file)
@@ -23,7 +23,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 4ef53c3..311770c 100644 (file)
@@ -50,7 +50,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 6d1dd8e..4d7f7a7 100755 (executable)
@@ -48,7 +48,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index b6ce2a2..541f846 100644 (file)
@@ -32,7 +32,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   servers:
     hades:
index d621cb7..ddafb27 100644 (file)
@@ -40,7 +40,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 9af032f..825fd76 100644 (file)
@@ -23,7 +23,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   servers:
     Chang'e:
index 9e29ec2..899ee96 100644 (file)
@@ -33,7 +33,7 @@ context:
   name: yardstick
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index f89a309..6e50157 100644 (file)
@@ -9,7 +9,7 @@ scenarios:
 -
   type: Fio
   options:
-    filename: /home/ec2-user/data.raw
+    filename: /home/ubuntu/data.raw
     bs: {{bs}}
     rw: {{rw}}
     ramp_time: 10
@@ -37,7 +37,7 @@ context:
   name: yardstick-TC005
   image: yardstick-trusty-server
   flavor: m1.small
-  user: ec2-user
+  user: ubuntu
 
   servers:
     fio:
index 385e530..1cec80f 100644 (file)
@@ -39,7 +39,7 @@ context:
   name: yardstick-TC008
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 4d46c03..82a55d7 100644 (file)
@@ -34,7 +34,7 @@ context:
   name: yardstick-TC009
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 42327f0..aeb1854 100644 (file)
@@ -27,7 +27,7 @@ context:
   name: yardstick-TC010
   image: yardstick-trusty-server
   flavor: m1.small
-  user: ec2-user
+  user: ubuntu
 
   servers:
     demeter:
index 0c54d0c..3bdb8cb 100644 (file)
@@ -28,7 +28,7 @@ context:
   name: demo
   image: yardstick-trusty-server
   flavor: m1.small
-  user: ec2-user
+  user: ubuntu
 
   servers:
     demeter:
index f1b9953..648657f 100644 (file)
@@ -21,7 +21,7 @@ context:
   name: yardstick-TC014
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   servers:
     Chang'e:
index a73dfee..5e2177a 100644 (file)
@@ -66,7 +66,7 @@ context:
   name: yardstick-TC037
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 59608e3..128f940 100644 (file)
@@ -66,7 +66,7 @@ context:
   name: yardstick-TC038
   image: yardstick-trusty-server
   flavor: yardstick-flavor
-  user: ec2-user
+  user: ubuntu
 
   placement_groups:
     pgrp1:
index 48584cf..a1978e3 100644 (file)
@@ -167,6 +167,7 @@ class ServerTestCase(unittest.TestCase):
         self.mock_context.name = 'bar'
         self.mock_context.keypair_name = 'some-keys'
         self.mock_context.secgroup_name = 'some-secgroup'
+        self.mock_context.user = "some-user"
 
     def test_construct_defaults(self):
 
@@ -215,6 +216,7 @@ class ServerTestCase(unittest.TestCase):
         mock_template.add_server.assert_called_with(
             'some-server', 'some-image', 'some-flavor',
             ports=['some-server-some-network-port'],
+            user=self.mock_context.user,
             key_name=self.mock_context.keypair_name,
             scheduler_hints='hints')
 
index ac8aa06..153d150 100644 (file)
@@ -39,7 +39,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_setup(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -55,7 +55,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_no_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -80,7 +80,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_read_no_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': "read",
             'ramp_time': 10
@@ -104,7 +104,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_write_no_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'write',
             'ramp_time': 10
@@ -128,7 +128,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_lat_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -157,7 +157,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_unsuccessful_lat_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -178,7 +178,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_successful_bw_iops_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -206,7 +206,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_unsuccessful_bw_iops_sla(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
@@ -227,7 +227,7 @@ class FioTestCase(unittest.TestCase):
     def test_fio_unsuccessful_script_error(self, mock_ssh):
 
         options = {
-            'filename': '/home/ec2-user/data.raw',
+            'filename': '/home/ubuntu/data.raw',
             'bs': '4k',
             'rw': 'rw',
             'ramp_time': 10
index 91020b9..bb61c61 100644 (file)
@@ -118,6 +118,7 @@ class Server(Object):
         self.stack_name = self.name + "." + context.name
         self.keypair_name = context.keypair_name
         self.secgroup_name = context.secgroup_name
+        self.user = context.user
         self.context = context
         self.public_ip = None
         self.private_ip = None
@@ -201,6 +202,7 @@ class Server(Object):
 
         template.add_server(server_name, self.image, self.flavor,
                             ports=port_name_list,
+                            user=self.user,
                             key_name=self.keypair_name,
                             scheduler_hints=scheduler_hints)
 
index 2b458ff..d11bec5 100644 (file)
@@ -219,7 +219,7 @@ class CPULoad(base.Scenario):
 #     ctx = {
 #         'host': {
 #             'ip': '172.16.0.175',
-#             'user': 'ec2-user',
+#             'user': 'ubuntu',
 #             'key_filename': key_filename
 #         }
 #     }
index 8969472..a8d27fa 100644 (file)
@@ -23,7 +23,7 @@ class Fio(base.Scenario):
     filename - file name for fio workload
         type:    string
         unit:    na
-        default: /home/ec2-user/data.raw
+        default: /home/ubuntu/data.raw
     bs - block size used for the io units
         type:    int
         unit:    bytes
@@ -82,7 +82,7 @@ class Fio(base.Scenario):
             self.setup()
 
         options = self.scenario_cfg["options"]
-        filename = options.get("filename", "/home/ec2-user/data.raw")
+        filename = options.get("filename", "/home/ubuntu/data.raw")
         bs = options.get("bs", "4k")
         iodepth = options.get("iodepth", "1")
         rw = options.get("rw", "write")
@@ -162,7 +162,7 @@ def _test():
     logger.setLevel(logging.DEBUG)
 
     options = {
-        "filename": "/home/ec2-user/data.raw",
+        "filename": "/home/ubuntu/data.raw",
         "bs": "4k",
         "iodepth": "1",
         "rw": "rw",
index 470f938..8d535c2 100644 (file)
@@ -353,8 +353,8 @@ class HeatTemplate(HeatObject):
         }
 
     def add_server(self, name, image, flavor, ports=None, networks=None,
-                   scheduler_hints=None, key_name=None, user_data=None,
-                   metadata=None, additional_properties=None):
+                   scheduler_hints=None, user=None, key_name=None,
+                   user_data=None, metadata=None, additional_properties=None):
         '''add to the template a Nova Server'''
         log.debug("adding Nova::Server '%s', image '%s', flavor '%s', "
                   "ports %s", name, image, flavor, ports)
@@ -370,6 +370,9 @@ class HeatTemplate(HeatObject):
             'networks': []  # list of dictionaries
         }
 
+        if user:
+            server_properties['admin_user'] = user
+
         if key_name:
             self.resources[name]['depends_on'] = [key_name]
             server_properties['key_name'] = {'get_resource': key_name}