Merge "Fix worker VMs configurations"
This commit is contained in:
commit
a41fffdefc
virtualbox/pybox
@ -12,7 +12,7 @@ to virtual machines in a lab environment.
|
||||
Classes:
|
||||
- `Subnets`: A class containing dictionaries for IPv4 and IPv6 subnets.
|
||||
- `NICs`: A class containing dictionaries for NIC configurations of different types of
|
||||
nodes in the virtual environment, such as `CONTROLLER`, `COMPUTE`, and `STORAGE`.
|
||||
nodes in the virtual environment, such as `CONTROLLER`, `WORKER`, and `STORAGE`.
|
||||
- `OAM`: A class containing an IP address and netmask for the out-of-band management (OAM) network.
|
||||
- `Serial`: A class containing configurations for the serial ports.
|
||||
|
||||
@ -40,7 +40,7 @@ class Subnets:
|
||||
|
||||
class NICs:
|
||||
"""The `NICs` class contains dictionaries for NIC configurations of different types
|
||||
of nodes in the virtual environment, such as `CONTROLLER`, `COMPUTE`, and `STORAGE`."""
|
||||
of nodes in the virtual environment, such as `CONTROLLER`, `WORKER`, and `STORAGE`."""
|
||||
|
||||
if platform in ("win32", "win64"):
|
||||
CONTROLLER = {
|
||||
@ -107,8 +107,8 @@ class NICs:
|
||||
},
|
||||
}
|
||||
|
||||
COMPUTE = {
|
||||
"node_type": "compute",
|
||||
WORKER = {
|
||||
"node_type": "worker",
|
||||
"1": {
|
||||
"nic": "intnet",
|
||||
"intnet": "intnet-unused1",
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
"""
|
||||
This module contains dictionaries for different types of nodes in a virtual environment,
|
||||
such as CONTROLLER_CEPH, CONTROLLER_LVM, CONTROLLER_AIO, COMPUTE, and STORAGE.
|
||||
such as CONTROLLER_CEPH, CONTROLLER_LVM, CONTROLLER_AIO, WORKER, and STORAGE.
|
||||
"""
|
||||
|
||||
class Nodes: #pylint: disable=too-few-public-methods
|
||||
@ -57,8 +57,8 @@ class Nodes: #pylint: disable=too-few-public-methods
|
||||
}
|
||||
}
|
||||
|
||||
COMPUTE = {
|
||||
'node_type': 'compute',
|
||||
WORKER = {
|
||||
'node_type': 'worker',
|
||||
'memory': 8192,
|
||||
'cpus': 3,
|
||||
'disks': {
|
||||
|
@ -88,7 +88,7 @@ def install_host(stream, hostname, host_type, host_id):
|
||||
Args:
|
||||
stream(stream): Stream to cont0
|
||||
hostname(str): Name of host
|
||||
host_type(str): Type of host being installed e.g. 'storage' or 'compute'
|
||||
host_type(str): Type of host being installed e.g. 'storage' or 'worker'
|
||||
host_id(int): id to identify host
|
||||
"""
|
||||
|
||||
@ -100,7 +100,7 @@ def install_host(stream, hostname, host_type, host_id):
|
||||
cmd = f"system host-update {host_id} personality=storage"
|
||||
serial.send_bytes(stream, cmd, expect_prompt=False)
|
||||
else:
|
||||
cmd = f"system host-update {host_id} personality=compute hostname={hostname}"
|
||||
cmd = f"system host-update {host_id} personality=worker hostname={hostname}"
|
||||
serial.send_bytes(stream, cmd, expect_prompt=False)
|
||||
|
||||
|
||||
|
@ -175,13 +175,13 @@ class InstallHostTestCase(unittest.TestCase):
|
||||
expect_prompt=False)
|
||||
|
||||
@patch("host_helper.serial")
|
||||
def test_install_host_compute(self, mock_serial):
|
||||
def test_install_host_worker(self, mock_serial):
|
||||
"""
|
||||
Test install_host for compute type host
|
||||
Test install_host for worker type host
|
||||
"""
|
||||
|
||||
# Setup
|
||||
mock_host_type = "compute"
|
||||
mock_host_type = "worker"
|
||||
|
||||
# Run
|
||||
host_helper.install_host(self.mock_stream, self.mock_hostname, mock_host_type, self.mock_host_id)
|
||||
@ -189,7 +189,7 @@ class InstallHostTestCase(unittest.TestCase):
|
||||
# Assert
|
||||
mock_serial.send_bytes.assert_called_once_with(
|
||||
self.mock_stream,
|
||||
f"system host-update {self.mock_host_id} personality=compute hostname={self.mock_hostname}",
|
||||
f"system host-update {self.mock_host_id} personality=worker hostname={self.mock_hostname}",
|
||||
expect_prompt=False)
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ class GetAllVmsTestCase(unittest.TestCase):
|
||||
labname = "lab1"
|
||||
mock_list.return_value = [
|
||||
b'"lab1-controller-0" {2f7f1b1c-40fe-4063-8182-ece45bbe229d}',
|
||||
b'"lab1-compute-0" {1f7a1a1a-30ee-4062-8182-edc45bbe239d}',
|
||||
b'"lab1-worker-0" {1f7a1a1a-30ee-4062-8182-edc45bbe239d}',
|
||||
b'"lab1-storage-0" {1f6a1a1b-30ee-4071-8182-edd45bbe239d}',
|
||||
b'"not-matching-vm" {2f7f1b1c-40fe-4063-8182-ece45bbe229d}'
|
||||
]
|
||||
@ -91,7 +91,7 @@ class GetAllVmsTestCase(unittest.TestCase):
|
||||
mock_list.assert_called_once_with("vms")
|
||||
expected_vms = [
|
||||
'"lab1-controller-0" {2f7f1b1c-40fe-4063-8182-ece45bbe229d}',
|
||||
'"lab1-compute-0" {1f7a1a1a-30ee-4062-8182-edc45bbe239d}',
|
||||
'"lab1-worker-0" {1f7a1a1a-30ee-4062-8182-edc45bbe239d}',
|
||||
'"lab1-storage-0" {1f6a1a1b-30ee-4071-8182-edd45bbe239d}',
|
||||
]
|
||||
self.assertCountEqual(vms, expected_vms)
|
||||
|
@ -73,7 +73,7 @@ def get_all_vms(labname, option="vms"):
|
||||
# Reduce the number of VMs we query
|
||||
for item in vm_list:
|
||||
if labname.encode("utf-8") in item and (
|
||||
b"controller-" in item or b"compute-" in item or b"storage-" in item
|
||||
b"controller-" in item or b"worker-" in item or b"storage-" in item
|
||||
):
|
||||
initial_node_list.append(item.decode("utf-8"))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user