[KVM-AUTOTEST PATCH v2 04/11] KVM test: add host-specific MAC-IP pool configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- Add kvm_address_pools.cfg which specifies a set of MAC-IP ranges for each
  host.
- Read kvm_address_pools.cfg in the control file and filter it by hostname, so
  that each host uses only the MAC addresses assigned to it.  If the hostname
  doesn't match any hostname in kvm_address_pools.cfg, use 'default_host'.
- While we're at it, add a comment informing the user where to modify the test
  configration, if that is desirable
- (Also add a missing space somewhere in the control file, and remove a few
  extra ones)

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/control                      |   25 +++++++++--
 client/tests/kvm/kvm_address_pools.cfg.sample |   56 +++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 5 deletions(-)
 create mode 100644 client/tests/kvm/kvm_address_pools.cfg.sample

diff --git a/client/tests/kvm/control b/client/tests/kvm/control
index 5c5d424..2ad8d81 100644
--- a/client/tests/kvm/control
+++ b/client/tests/kvm/control
@@ -133,12 +133,27 @@ if not r:
 import kvm_config
 
 filename = os.path.join(pwd, "kvm_tests.cfg")
-list = kvm_config.config(filename).get_list()
+cfg = kvm_config.config(filename)
+
+# If desirable, make changes to the test configuration here.  For example:
+# cfg.parse_string("only fc8_quick")
+# cfg.parse_string("display = sdl")
+
+filename = os.path.join(pwd, "kvm_address_pools.cfg")
+if os.path.exists(filename):
+    cfg.parse_file(filename)
+    hostname = os.uname()[1].split(".")[0]
+    if cfg.filter("^" + hostname):
+        cfg.parse_string("only ^%s" % hostname)
+    else:
+        cfg.parse_string("only ^default_host")
+
+list = cfg.get_list()
 
 
-#  -------------
-#  Run the tests
-#  -------------
+# -------------
+# Run the tests
+# -------------
 status_dict = {}
 
 for dict in list:
@@ -153,7 +168,7 @@ for dict in list:
                 dependencies_satisfied = False
                 break
     if dependencies_satisfied:
-        test_iterations=int(dict.get("iterations", 1))
+        test_iterations = int(dict.get("iterations", 1))
         current_status = job.run_test("kvm", params=dict,
                                       tag=dict.get("shortname"),
                                       iterations=test_iterations)
diff --git a/client/tests/kvm/kvm_address_pools.cfg.sample b/client/tests/kvm/kvm_address_pools.cfg.sample
new file mode 100644
index 0000000..8a27ee1
--- /dev/null
+++ b/client/tests/kvm/kvm_address_pools.cfg.sample
@@ -0,0 +1,56 @@
+# Rename this file to kvm_address_pools.cfg.
+# This file specifies several MAC-IP ranges for each host in the network that
+# may run KVM tests.  A MAC address must not be used twice, so these ranges
+# must not overlap.  The VMs running on each host will only use MAC addresses
+# from the pool of that host.
+# If you wish to use a static MAC-IP mapping, where each MAC address range is
+# mapped to a known corresponding IP address range, specify the bases of the IP
+# address ranges in this file.
+
+variants:
+    # Rename host1 to an actual (short) hostname in the network that will be running the Autotest client
+    - @host1:
+        # Add/remove ranges here
+        address_ranges = r1 r2
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r1 = 52:54:00:12:35:56
+        #address_range_base_ip_r1 = 10.0.2.20
+        address_range_size_r1 = 16
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r2 = 52:54:00:12:35:80
+        #address_range_base_ip_r2 = 10.0.2.40
+        address_range_size_r2 = 16
+
+    # Rename host2 to an actual (short) hostname in the network that will be running the Autotest client
+    - @host2:
+        # Add/remove ranges here
+        address_ranges = r1 r2
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r1 = 52:54:00:12:36:56
+        #address_range_base_ip_r1 = 10.0.3.20
+        address_range_size_r1 = 16
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r2 = 52:54:00:12:36:80
+        #address_range_base_ip_r2 = 10.0.3.40
+        address_range_size_r2 = 16
+
+    # Add additional hosts here...
+
+    # This will be used for hosts that do not appear on the list
+    - @default_host:
+        # Add/remove ranges here
+        address_ranges = r1 r2
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r1 = 52:54:00:12:34:56
+        #address_range_base_ip_r1 = 10.0.1.20
+        address_range_size_r1 = 16
+
+        # Modify the following parameters to reflect the DHCP server's configuration
+        address_range_base_mac_r2 = 52:54:00:12:34:80
+        #address_range_base_ip_r2 = 10.0.1.40
+        address_range_size_r2 = 16
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux