def init_microvm(root_path, bin_cloner_path, fc_binary=None, jailer_binary=None): """Auxiliary function for instantiating a microvm and setting it up.""" # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. microvm_id = str(uuid.uuid4()) # Update permissions for custom binaries. if fc_binary is not None: os.chmod(fc_binary, 0o555) if jailer_binary is not None: os.chmod(jailer_binary, 0o555) if fc_binary is None or jailer_binary is None: fc_binary, jailer_binary = build_tools.get_firecracker_binaries() # Make sure we always have both binaries. assert fc_binary assert jailer_binary vm = Microvm(resource_path=root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, microvm_id=microvm_id, bin_cloner_path=bin_cloner_path) vm.setup() return vm
def init_microvm(root_path, cloner_path): """Auxiliary function for instantiating a microvm and setting it up.""" microvm_id = str(uuid.uuid4()) fc_binary, jailer_binary = build_tools.get_firecracker_binaries(root_path) vm = Microvm(resource_path=root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, microvm_id=microvm_id, newpid_cloner_path=cloner_path) vm.setup() return vm
def init_microvm(root_path, aux_binary_paths, features=''): """Auxiliary function for instantiating a microvm and setting it up.""" microvm_id = str(uuid.uuid4()) fc_binary, jailer_binary = build_tools.get_firecracker_binaries( root_path, features) vm = Microvm(resource_path=root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, build_feature=features, microvm_id=microvm_id, aux_bin_paths=aux_binary_paths) vm.setup() return vm
def init_microvm(root_path, bin_cloner_path): """Auxiliary function for instantiating a microvm and setting it up.""" # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. microvm_id = str(uuid.uuid4()) fc_binary, jailer_binary = build_tools.get_firecracker_binaries() vm = Microvm(resource_path=root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, microvm_id=microvm_id, bin_cloner_path=bin_cloner_path) vm.setup() return vm
def init_microvm(root_path, aux_binary_paths, features=''): """Auxiliary function for instantiating a microvm and setting it up.""" microvm_id = str(uuid.uuid4()) fc_binary, jailer_binary = build_tools.get_firecracker_binaries( root_path, features ) vm = Microvm( resource_path=root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, build_feature=features, microvm_id=microvm_id, aux_bin_paths=aux_binary_paths ) vm.setup() return vm
def microvm(test_session_root_path, newpid_cloner_path): """Instantiate a microvm.""" # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. # Make sure the necessary binaries are there before instantiating the # microvm. fc_binary, jailer_binary = build_tools.get_firecracker_binaries( test_session_root_path) microvm_id = str(uuid.uuid4()) vm = Microvm(resource_path=test_session_root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, microvm_id=microvm_id, newpid_cloner_path=newpid_cloner_path) vm.setup() yield vm vm.kill()
def microvm(test_session_root_path, newpid_cloner_path): """Instantiate a microvm.""" # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. # Make sure the necessary binaries are there before instantiating the # microvm. fc_binary, jailer_binary = build_tools.get_firecracker_binaries( test_session_root_path ) microvm_id = str(uuid.uuid4()) vm = Microvm( resource_path=test_session_root_path, fc_binary_path=fc_binary, jailer_binary_path=jailer_binary, microvm_id=microvm_id, newpid_cloner_path=newpid_cloner_path ) vm.setup() yield vm vm.kill()