def create_vswitches(self, external_vswitch_name, internal_network_config): virt_driver = virt_factory.get_virt_driver() if not virt_driver.vswitch_exists(external_vswitch_name): raise Exception("Virtual switch not found: %s" % external_vswitch_name) if not virt_driver.vswitch_exists(VSWITCH_INTERNAL_NAME): virt_driver.create_vswitch(VSWITCH_INTERNAL_NAME, create_internal_port=True) virt_driver.set_vswitch_host_ip(VSWITCH_INTERNAL_NAME, internal_network_config["host_ip"], internal_network_config["netmask"]) local_ports = str(DHCP_PORT) + "," + str(TFTP_PORT) virt_driver.add_vswitch_host_firewall_rule(VSWITCH_INTERNAL_NAME, FIREWALL_PXE_RULE_NAME, local_ports, base_virt_driver.UDP) if not virt_driver.vswitch_exists(VSWITCH_DATA_NAME): virt_driver.create_vswitch(VSWITCH_DATA_NAME)
def __init__(self): self._pybootd_manager = pybootdmgr.PyBootdManager() self._virt_driver = virt_factory.get_virt_driver() self._windows_utils = windows.WindowsUtils() self._config = config.AppConfig() self._vm_name = None