KVMFORNFV: Reverting LiveMigration changes 03/48303/1
authorNavya Bathula <navyax.bathula@intel.com>
Thu, 30 Nov 2017 21:46:15 +0000 (21:46 +0000)
committerNavya Bathula <navyax.bathula@intel.com>
Mon, 4 Dec 2017 08:52:08 +0000 (08:52 +0000)
This patch consists of reverting the changes of patch 45227 and
incudes redirecting the console output of the LiveMigration
execution to /dev/null as the stdout contains only the statistics,
i.e., totaltime, downtime and setuptime.

This reverts commit 5a1f65d3e7d67488ee6f558dccfa5ca5581ddb65.

Change-Id: I252b5a4045657cfa8362e9aae755249480cd3b77
Signed-off-by: Navya <navyax.bathula@intel.com>
(cherry picked from commit 3ca70b916c386b7ec4d9a7f2f9bb6fec2e917785)

tests/unit/benchmark/scenarios/compute/test_qemumigrate.py
yardstick/benchmark/scenarios/compute/qemu_migrate.py
yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash

index f163f19..1f0ff3c 100644 (file)
@@ -16,6 +16,7 @@ from __future__ import absolute_import
 import unittest
 
 import mock
+from oslo_serialization import jsonutils
 
 from yardstick.benchmark.scenarios.compute import qemu_migrate
 
@@ -83,7 +84,7 @@ class QemuMigrateTestCase(unittest.TestCase):
         mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
 
         q.run(result)
-        expected_result = {}
+        expected_result = jsonutils.loads(sample_output)
         self.assertEqual(result, expected_result)
 
     def test_qemu_migrate_successful_sla(self, mock_ssh):
@@ -103,7 +104,7 @@ class QemuMigrateTestCase(unittest.TestCase):
         mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
 
         q.run(result)
-        expected_result = {}
+        expected_result = jsonutils.loads(sample_output)
         self.assertEqual(result, expected_result)
 
     def test_qemu_migrate_unsuccessful_sla_totaltime(self, mock_ssh):
@@ -117,8 +118,7 @@ class QemuMigrateTestCase(unittest.TestCase):
         sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}'
 
         mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
-        with self.assertRaises(AssertionError):
-          q.run(result)
+        self.assertRaises(AssertionError, q.run, result)
 
     def test_qemu_migrate_unsuccessful_sla_downtime(self, mock_ssh):
 
@@ -131,8 +131,7 @@ class QemuMigrateTestCase(unittest.TestCase):
         sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}'
 
         mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
-        with self.assertRaises(AssertionError):
-          q.run(result)
+        self.assertRaises(AssertionError, q.run, result)
 
     def test_qemu_migrate_unsuccessful_sla_setuptime(self, mock_ssh):
 
@@ -145,8 +144,7 @@ class QemuMigrateTestCase(unittest.TestCase):
         sample_output = '{"totaltime": 15, "downtime": 2, "setuptime": 1}'
 
         mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
-        with self.assertRaises(AssertionError):
-          q.run(result)
+        self.assertRaises(AssertionError, q.run, result)
 
     def test_qemu_migrate_unsuccessful_script_error(self, mock_ssh):
 
@@ -156,9 +154,10 @@ class QemuMigrateTestCase(unittest.TestCase):
         mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
         q.setup()
 
+
         mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
-        with self.assertRaises(RuntimeError):
-          q.run(result)
+        self.assertRaises(RuntimeError, q.run, result)
+
 
 def main():
     unittest.main()
index 286d8cd..2de1270 100644 (file)
@@ -113,11 +113,11 @@ class QemuMigrate(base.Scenario):
         if status:
             raise RuntimeError(stderr)
 
-        parsed_data = jsonutils.loads(stdout)
+        result.update(jsonutils.loads(stdout))
 
         if "sla" in self.scenario_cfg:
             sla_error = ""
-            for t, timevalue in parsed_data.items():
+            for t, timevalue in result.items():
                 if 'max_%s' % t not in self.scenario_cfg['sla']:
                     continue
 
index 757553e..d95e914 100644 (file)
@@ -21,13 +21,6 @@ max_down_time=$6
 
 OUTPUT_FILE=/tmp/output-qemu.log
 
-echo "To check the parameters:"
-echo "SRC: $src"
-echo "DST: $dst"
-echo "DST_IP: $dst_ip"
-echo "MIGRATE_PORT: $migrate_to_port"
-echo "DOWN_TIME: $max_down_time"
-
 do_migrate()
 {
         echo "Execution of Live Migration"
@@ -49,7 +42,8 @@ do_migrate()
         done
 
         echo "End of Live Migration"
-}
+
+} > /dev/null
 
 output_qemu()
 {
@@ -74,14 +68,18 @@ echo -e "{ \
         \"setuptime\":\"$setuptime\" \
          }"
 }
+
 # main entry
 main()
 {
-    echo "Perform LiveMigration"
+    # Perform LiveMigration
     do_migrate
-    echo "LiveMigration Status"
+
+    # LiveMigration Status
     output_qemu
-    echo "LiveMigration JSON output "
+
+    # LiveMigration JSON output
     output_json
 }
+
 main