Esempio n. 1
0
def build_vms(inventory,
              network_settings,
              template_dir='/usr/share/opnfv-apex'):
    """
    Creates VMs and configures vbmc and host
    :param inventory:
    :param network_settings:
    :return:
    """

    for idx, node in enumerate(inventory['nodes']):
        name = 'baremetal{}'.format(idx)
        volume = name + ".qcow2"
        volume_path = os.path.join(constants.LIBVIRT_VOLUME_PATH, volume)
        # TODO(trozet): add error checking
        vm_lib.create_vm(
            name,
            volume_path,
            baremetal_interfaces=network_settings.enabled_network_list,
            memory=node['memory'],
            cpus=node['cpu'],
            macs=node['mac'],
            template_dir=template_dir)
        virt_utils.host_setup({name: node['pm_port']})
Esempio n. 2
0
 def test_host_setup(self, mock_vbmc_lib, mock_subprocess, mock_iptc,
                     mock_check_output, mock_get_virt_ip):
     mock_get_virt_ip.return_value = '192.168.122.1'
     mock_check_output.return_value = b'blah |dummy \nstatus | running'
     host_setup({'test': 2468})
     mock_subprocess.assert_called_with(['vbmc', 'start', 'test'])
Esempio n. 3
0
 def test_host_setup(self, mock_vbmc_lib, mock_subprocess, mock_iptc):
     host_setup({'test': 2468})
     mock_subprocess.assert_called_with(['vbmc', 'start', 'test'])