From 8681bc5960d91330a3afa3db5bd5a258901bb554 Mon Sep 17 00:00:00 2001 From: QiLiang Date: Thu, 14 Jan 2016 08:09:40 +0000 Subject: HeatContext model update to match heat code update 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 (cherry picked from commit 9d36842e3966185e97cc5732aa7a0edd2050bfe2) --- .../yardstick_testcases/Yardstick_task_templates.rst | 2 +- docs/templates/Yardstick_task_templates.rst | 2 +- samples/background-task.yaml | 2 +- samples/cpuload.yaml | 2 +- samples/cyclictest.yaml | 2 +- samples/fio-template.yaml | 4 ++-- samples/fio.yaml | 6 +++--- samples/iperf3-jitter.yaml | 2 +- samples/iperf3.yaml | 2 +- samples/lmbench.yaml | 2 +- samples/netperf.yaml | 2 +- samples/perf.yaml | 2 +- samples/pktgen.yaml | 2 +- samples/unixbench.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml | 4 ++-- tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml | 2 +- tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml | 2 +- tests/unit/benchmark/contexts/test_model.py | 2 ++ tests/unit/benchmark/scenarios/storage/test_fio.py | 18 +++++++++--------- yardstick/benchmark/contexts/model.py | 2 ++ yardstick/benchmark/scenarios/compute/cpuload.py | 2 +- yardstick/benchmark/scenarios/storage/fio.py | 6 +++--- yardstick/orchestrator/heat.py | 7 +++++-- 29 files changed, 49 insertions(+), 42 deletions(-) diff --git a/docs/configguide/yardstick_testcases/Yardstick_task_templates.rst b/docs/configguide/yardstick_testcases/Yardstick_task_templates.rst index d2c2b7ec9..8185062b2 100755 --- a/docs/configguide/yardstick_testcases/Yardstick_task_templates.rst +++ b/docs/configguide/yardstick_testcases/Yardstick_task_templates.rst @@ -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 diff --git a/docs/templates/Yardstick_task_templates.rst b/docs/templates/Yardstick_task_templates.rst index d2c2b7ec9..8185062b2 100755 --- a/docs/templates/Yardstick_task_templates.rst +++ b/docs/templates/Yardstick_task_templates.rst @@ -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 diff --git a/samples/background-task.yaml b/samples/background-task.yaml index f81867b33..a844c2d7f 100644 --- a/samples/background-task.yaml +++ b/samples/background-task.yaml @@ -41,7 +41,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/cpuload.yaml b/samples/cpuload.yaml index e28d2d281..7ca528278 100644 --- a/samples/cpuload.yaml +++ b/samples/cpuload.yaml @@ -20,7 +20,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu servers: apollo: diff --git a/samples/cyclictest.yaml b/samples/cyclictest.yaml index 6a16bd234..cb85decb1 100644 --- a/samples/cyclictest.yaml +++ b/samples/cyclictest.yaml @@ -35,7 +35,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu servers: kvm: floating_ip: true diff --git a/samples/fio-template.yaml b/samples/fio-template.yaml index ce64cdee2..ba710d95f 100644 --- a/samples/fio-template.yaml +++ b/samples/fio-template.yaml @@ -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 diff --git a/samples/fio.yaml b/samples/fio.yaml index 6e77f681a..e1f5e6d2d 100644 --- a/samples/fio.yaml +++ b/samples/fio.yaml @@ -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 diff --git a/samples/iperf3-jitter.yaml b/samples/iperf3-jitter.yaml index 0544c4186..c211571d0 100644 --- a/samples/iperf3-jitter.yaml +++ b/samples/iperf3-jitter.yaml @@ -25,7 +25,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/iperf3.yaml b/samples/iperf3.yaml index 561be81f5..72f260942 100644 --- a/samples/iperf3.yaml +++ b/samples/iperf3.yaml @@ -23,7 +23,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/lmbench.yaml b/samples/lmbench.yaml index 4ef53c30b..311770c42 100644 --- a/samples/lmbench.yaml +++ b/samples/lmbench.yaml @@ -50,7 +50,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/netperf.yaml b/samples/netperf.yaml index 6d1dd8ec9..4d7f7a798 100755 --- a/samples/netperf.yaml +++ b/samples/netperf.yaml @@ -48,7 +48,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/perf.yaml b/samples/perf.yaml index b6ce2a226..541f846e7 100644 --- a/samples/perf.yaml +++ b/samples/perf.yaml @@ -32,7 +32,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu servers: hades: diff --git a/samples/pktgen.yaml b/samples/pktgen.yaml index d621cb730..ddafb27bd 100644 --- a/samples/pktgen.yaml +++ b/samples/pktgen.yaml @@ -40,7 +40,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/samples/unixbench.yaml b/samples/unixbench.yaml index 9af032f23..825fd767f 100644 --- a/samples/unixbench.yaml +++ b/samples/unixbench.yaml @@ -23,7 +23,7 @@ context: name: demo image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu servers: Chang'e: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml index 9e29ec2b1..899ee963c 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml @@ -33,7 +33,7 @@ context: name: yardstick image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml index f89a3099e..6e50157fc 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml @@ -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: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml index 385e530ce..1cec80ff6 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml @@ -39,7 +39,7 @@ context: name: yardstick-TC008 image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml index 4d46c0336..82a55d751 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml @@ -34,7 +34,7 @@ context: name: yardstick-TC009 image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml index 42327f05f..aeb18543e 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml @@ -27,7 +27,7 @@ context: name: yardstick-TC010 image: yardstick-trusty-server flavor: m1.small - user: ec2-user + user: ubuntu servers: demeter: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml index 0c54d0cf0..3bdb8cb9a 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml @@ -28,7 +28,7 @@ context: name: demo image: yardstick-trusty-server flavor: m1.small - user: ec2-user + user: ubuntu servers: demeter: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml index f1b995371..648657f22 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml @@ -21,7 +21,7 @@ context: name: yardstick-TC014 image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu servers: Chang'e: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml index a73dfee0a..5e2177a6e 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml @@ -66,7 +66,7 @@ context: name: yardstick-TC037 image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml index 59608e312..128f94045 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml @@ -66,7 +66,7 @@ context: name: yardstick-TC038 image: yardstick-trusty-server flavor: yardstick-flavor - user: ec2-user + user: ubuntu placement_groups: pgrp1: diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py index 48584cf33..a1978e320 100644 --- a/tests/unit/benchmark/contexts/test_model.py +++ b/tests/unit/benchmark/contexts/test_model.py @@ -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') diff --git a/tests/unit/benchmark/scenarios/storage/test_fio.py b/tests/unit/benchmark/scenarios/storage/test_fio.py index ac8aa0684..153d15052 100644 --- a/tests/unit/benchmark/scenarios/storage/test_fio.py +++ b/tests/unit/benchmark/scenarios/storage/test_fio.py @@ -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 diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py index 91020b92f..bb61c613d 100644 --- a/yardstick/benchmark/contexts/model.py +++ b/yardstick/benchmark/contexts/model.py @@ -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) diff --git a/yardstick/benchmark/scenarios/compute/cpuload.py b/yardstick/benchmark/scenarios/compute/cpuload.py index 2b458ff64..d11bec5c3 100644 --- a/yardstick/benchmark/scenarios/compute/cpuload.py +++ b/yardstick/benchmark/scenarios/compute/cpuload.py @@ -219,7 +219,7 @@ class CPULoad(base.Scenario): # ctx = { # 'host': { # 'ip': '172.16.0.175', -# 'user': 'ec2-user', +# 'user': 'ubuntu', # 'key_filename': key_filename # } # } diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py index 8969472e9..a8d27faba 100644 --- a/yardstick/benchmark/scenarios/storage/fio.py +++ b/yardstick/benchmark/scenarios/storage/fio.py @@ -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", diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 470f938ed..8d535c252 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -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} -- cgit 1.2.3-korg