id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
226,400 | GNS3/gns3-server | gns3server/controller/link.py | Link.update_filters | def update_filters(self, filters):
"""
Modify the filters list.
Filter with value 0 will be dropped because not active
"""
new_filters = {}
for (filter, values) in filters.items():
new_values = []
for value in values:
if isinstance... | python | def update_filters(self, filters):
"""
Modify the filters list.
Filter with value 0 will be dropped because not active
"""
new_filters = {}
for (filter, values) in filters.items():
new_values = []
for value in values:
if isinstance... | [
"def",
"update_filters",
"(",
"self",
",",
"filters",
")",
":",
"new_filters",
"=",
"{",
"}",
"for",
"(",
"filter",
",",
"values",
")",
"in",
"filters",
".",
"items",
"(",
")",
":",
"new_values",
"=",
"[",
"]",
"for",
"value",
"in",
"values",
":",
... | Modify the filters list.
Filter with value 0 will be dropped because not active | [
"Modify",
"the",
"filters",
"list",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L152-L175 |
226,401 | GNS3/gns3-server | gns3server/controller/link.py | Link.add_node | def add_node(self, node, adapter_number, port_number, label=None, dump=True):
"""
Add a node to the link
:param dump: Dump project on disk
"""
port = node.get_port(adapter_number, port_number)
if port is None:
raise aiohttp.web.HTTPNotFound(text="Port {}/{} ... | python | def add_node(self, node, adapter_number, port_number, label=None, dump=True):
"""
Add a node to the link
:param dump: Dump project on disk
"""
port = node.get_port(adapter_number, port_number)
if port is None:
raise aiohttp.web.HTTPNotFound(text="Port {}/{} ... | [
"def",
"add_node",
"(",
"self",
",",
"node",
",",
"adapter_number",
",",
"port_number",
",",
"label",
"=",
"None",
",",
"dump",
"=",
"True",
")",
":",
"port",
"=",
"node",
".",
"get_port",
"(",
"adapter_number",
",",
"port_number",
")",
"if",
"port",
"... | Add a node to the link
:param dump: Dump project on disk | [
"Add",
"a",
"node",
"to",
"the",
"link"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L193-L249 |
226,402 | GNS3/gns3-server | gns3server/controller/link.py | Link.delete | def delete(self):
"""
Delete the link
"""
for n in self._nodes:
# It could be different of self if we rollback an already existing link
if n["port"].link == self:
n["port"].link = None
n["node"].remove_link(self) | python | def delete(self):
"""
Delete the link
"""
for n in self._nodes:
# It could be different of self if we rollback an already existing link
if n["port"].link == self:
n["port"].link = None
n["node"].remove_link(self) | [
"def",
"delete",
"(",
"self",
")",
":",
"for",
"n",
"in",
"self",
".",
"_nodes",
":",
"# It could be different of self if we rollback an already existing link",
"if",
"n",
"[",
"\"port\"",
"]",
".",
"link",
"==",
"self",
":",
"n",
"[",
"\"port\"",
"]",
".",
... | Delete the link | [
"Delete",
"the",
"link"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L279-L287 |
226,403 | GNS3/gns3-server | gns3server/controller/link.py | Link.start_capture | def start_capture(self, data_link_type="DLT_EN10MB", capture_file_name=None):
"""
Start capture on the link
:returns: Capture object
"""
self._capturing = True
self._capture_file_name = capture_file_name
self._streaming_pcap = asyncio.async(self._start_streaming... | python | def start_capture(self, data_link_type="DLT_EN10MB", capture_file_name=None):
"""
Start capture on the link
:returns: Capture object
"""
self._capturing = True
self._capture_file_name = capture_file_name
self._streaming_pcap = asyncio.async(self._start_streaming... | [
"def",
"start_capture",
"(",
"self",
",",
"data_link_type",
"=",
"\"DLT_EN10MB\"",
",",
"capture_file_name",
"=",
"None",
")",
":",
"self",
".",
"_capturing",
"=",
"True",
"self",
".",
"_capture_file_name",
"=",
"capture_file_name",
"self",
".",
"_streaming_pcap",... | Start capture on the link
:returns: Capture object | [
"Start",
"capture",
"on",
"the",
"link"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L290-L300 |
226,404 | GNS3/gns3-server | gns3server/controller/link.py | Link._start_streaming_pcap | def _start_streaming_pcap(self):
"""
Dump a pcap file on disk
"""
if os.path.exists(self.capture_file_path):
try:
os.remove(self.capture_file_path)
except OSError as e:
raise aiohttp.web.HTTPConflict(text="Could not delete old capt... | python | def _start_streaming_pcap(self):
"""
Dump a pcap file on disk
"""
if os.path.exists(self.capture_file_path):
try:
os.remove(self.capture_file_path)
except OSError as e:
raise aiohttp.web.HTTPConflict(text="Could not delete old capt... | [
"def",
"_start_streaming_pcap",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"capture_file_path",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"self",
".",
"capture_file_path",
")",
"except",
"OSError",
"as",
"e",
... | Dump a pcap file on disk | [
"Dump",
"a",
"pcap",
"file",
"on",
"disk"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L303-L336 |
226,405 | GNS3/gns3-server | gns3server/controller/link.py | Link.stop_capture | def stop_capture(self):
"""
Stop capture on the link
"""
self._capturing = False
self._project.controller.notification.emit("link.updated", self.__json__()) | python | def stop_capture(self):
"""
Stop capture on the link
"""
self._capturing = False
self._project.controller.notification.emit("link.updated", self.__json__()) | [
"def",
"stop_capture",
"(",
"self",
")",
":",
"self",
".",
"_capturing",
"=",
"False",
"self",
".",
"_project",
".",
"controller",
".",
"notification",
".",
"emit",
"(",
"\"link.updated\"",
",",
"self",
".",
"__json__",
"(",
")",
")"
] | Stop capture on the link | [
"Stop",
"capture",
"on",
"the",
"link"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L339-L345 |
226,406 | GNS3/gns3-server | gns3server/controller/link.py | Link.capture_file_path | def capture_file_path(self):
"""
Get the path of the capture
"""
if self._capture_file_name:
return os.path.join(self._project.captures_directory, self._capture_file_name)
else:
return None | python | def capture_file_path(self):
"""
Get the path of the capture
"""
if self._capture_file_name:
return os.path.join(self._project.captures_directory, self._capture_file_name)
else:
return None | [
"def",
"capture_file_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"_capture_file_name",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_project",
".",
"captures_directory",
",",
"self",
".",
"_capture_file_name",
")",
"else",
":",
"r... | Get the path of the capture | [
"Get",
"the",
"path",
"of",
"the",
"capture"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/link.py#L388-L396 |
226,407 | GNS3/gns3-server | gns3server/compute/dynamips/dynamips_hypervisor.py | DynamipsHypervisor.connect | def connect(self, timeout=10):
"""
Connects to the hypervisor.
"""
# connect to a local address by default
# if listening to all addresses (IPv4 or IPv6)
if self._host == "0.0.0.0":
host = "127.0.0.1"
elif self._host == "::":
host = "::1"
... | python | def connect(self, timeout=10):
"""
Connects to the hypervisor.
"""
# connect to a local address by default
# if listening to all addresses (IPv4 or IPv6)
if self._host == "0.0.0.0":
host = "127.0.0.1"
elif self._host == "::":
host = "::1"
... | [
"def",
"connect",
"(",
"self",
",",
"timeout",
"=",
"10",
")",
":",
"# connect to a local address by default",
"# if listening to all addresses (IPv4 or IPv6)",
"if",
"self",
".",
"_host",
"==",
"\"0.0.0.0\"",
":",
"host",
"=",
"\"127.0.0.1\"",
"elif",
"self",
".",
... | Connects to the hypervisor. | [
"Connects",
"to",
"the",
"hypervisor",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/dynamips_hypervisor.py#L63-L102 |
226,408 | GNS3/gns3-server | gns3server/compute/dynamips/dynamips_hypervisor.py | DynamipsHypervisor.set_working_dir | def set_working_dir(self, working_dir):
"""
Sets the working directory for this hypervisor.
:param working_dir: path to the working directory
"""
# encase working_dir in quotes to protect spaces in the path
yield from self.send('hypervisor working_dir "{}"'.format(worki... | python | def set_working_dir(self, working_dir):
"""
Sets the working directory for this hypervisor.
:param working_dir: path to the working directory
"""
# encase working_dir in quotes to protect spaces in the path
yield from self.send('hypervisor working_dir "{}"'.format(worki... | [
"def",
"set_working_dir",
"(",
"self",
",",
"working_dir",
")",
":",
"# encase working_dir in quotes to protect spaces in the path",
"yield",
"from",
"self",
".",
"send",
"(",
"'hypervisor working_dir \"{}\"'",
".",
"format",
"(",
"working_dir",
")",
")",
"self",
".",
... | Sets the working directory for this hypervisor.
:param working_dir: path to the working directory | [
"Sets",
"the",
"working",
"directory",
"for",
"this",
"hypervisor",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/dynamips_hypervisor.py#L152-L162 |
226,409 | GNS3/gns3-server | gns3server/utils/asyncio/embed_shell.py | create_stdin_shell | def create_stdin_shell(shell, loop=None):
"""
Run a shell application with a stdin frontend
:param application: An EmbedShell instance
:param loop: The event loop
:returns: Telnet server
"""
@asyncio.coroutine
def feed_stdin(loop, reader, shell):
history = InMemoryHistory()
... | python | def create_stdin_shell(shell, loop=None):
"""
Run a shell application with a stdin frontend
:param application: An EmbedShell instance
:param loop: The event loop
:returns: Telnet server
"""
@asyncio.coroutine
def feed_stdin(loop, reader, shell):
history = InMemoryHistory()
... | [
"def",
"create_stdin_shell",
"(",
"shell",
",",
"loop",
"=",
"None",
")",
":",
"@",
"asyncio",
".",
"coroutine",
"def",
"feed_stdin",
"(",
"loop",
",",
"reader",
",",
"shell",
")",
":",
"history",
"=",
"InMemoryHistory",
"(",
")",
"completer",
"=",
"Word... | Run a shell application with a stdin frontend
:param application: An EmbedShell instance
:param loop: The event loop
:returns: Telnet server | [
"Run",
"a",
"shell",
"application",
"with",
"a",
"stdin",
"frontend"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/asyncio/embed_shell.py#L300-L335 |
226,410 | GNS3/gns3-server | gns3server/utils/asyncio/embed_shell.py | ShellConnection.reset | def reset(self):
""" Resets terminal screen"""
self._cli.reset()
self._cli.buffers[DEFAULT_BUFFER].reset()
self._cli.renderer.request_absolute_cursor_position()
self._cli._redraw() | python | def reset(self):
""" Resets terminal screen"""
self._cli.reset()
self._cli.buffers[DEFAULT_BUFFER].reset()
self._cli.renderer.request_absolute_cursor_position()
self._cli._redraw() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_cli",
".",
"reset",
"(",
")",
"self",
".",
"_cli",
".",
"buffers",
"[",
"DEFAULT_BUFFER",
"]",
".",
"reset",
"(",
")",
"self",
".",
"_cli",
".",
"renderer",
".",
"request_absolute_cursor_position",
... | Resets terminal screen | [
"Resets",
"terminal",
"screen"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/asyncio/embed_shell.py#L267-L272 |
226,411 | GNS3/gns3-server | gns3server/compute/project_manager.py | ProjectManager.get_project | def get_project(self, project_id):
"""
Returns a Project instance.
:param project_id: Project identifier
:returns: Project instance
"""
try:
UUID(project_id, version=4)
except ValueError:
raise aiohttp.web.HTTPBadRequest(text="Project ID... | python | def get_project(self, project_id):
"""
Returns a Project instance.
:param project_id: Project identifier
:returns: Project instance
"""
try:
UUID(project_id, version=4)
except ValueError:
raise aiohttp.web.HTTPBadRequest(text="Project ID... | [
"def",
"get_project",
"(",
"self",
",",
"project_id",
")",
":",
"try",
":",
"UUID",
"(",
"project_id",
",",
"version",
"=",
"4",
")",
"except",
"ValueError",
":",
"raise",
"aiohttp",
".",
"web",
".",
"HTTPBadRequest",
"(",
"text",
"=",
"\"Project ID {} is ... | Returns a Project instance.
:param project_id: Project identifier
:returns: Project instance | [
"Returns",
"a",
"Project",
"instance",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project_manager.py#L60-L76 |
226,412 | GNS3/gns3-server | gns3server/compute/project_manager.py | ProjectManager._check_available_disk_space | def _check_available_disk_space(self, project):
"""
Sends a warning notification if disk space is getting low.
:param project: project instance
"""
try:
used_disk_space = psutil.disk_usage(project.path).percent
except FileNotFoundError:
log.warni... | python | def _check_available_disk_space(self, project):
"""
Sends a warning notification if disk space is getting low.
:param project: project instance
"""
try:
used_disk_space = psutil.disk_usage(project.path).percent
except FileNotFoundError:
log.warni... | [
"def",
"_check_available_disk_space",
"(",
"self",
",",
"project",
")",
":",
"try",
":",
"used_disk_space",
"=",
"psutil",
".",
"disk_usage",
"(",
"project",
".",
"path",
")",
".",
"percent",
"except",
"FileNotFoundError",
":",
"log",
".",
"warning",
"(",
"'... | Sends a warning notification if disk space is getting low.
:param project: project instance | [
"Sends",
"a",
"warning",
"notification",
"if",
"disk",
"space",
"is",
"getting",
"low",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project_manager.py#L78-L96 |
226,413 | GNS3/gns3-server | gns3server/compute/project_manager.py | ProjectManager.create_project | def create_project(self, name=None, project_id=None, path=None):
"""
Create a project and keep a references to it in project manager.
See documentation of Project for arguments
"""
if project_id is not None and project_id in self._projects:
return self._projects[pro... | python | def create_project(self, name=None, project_id=None, path=None):
"""
Create a project and keep a references to it in project manager.
See documentation of Project for arguments
"""
if project_id is not None and project_id in self._projects:
return self._projects[pro... | [
"def",
"create_project",
"(",
"self",
",",
"name",
"=",
"None",
",",
"project_id",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"if",
"project_id",
"is",
"not",
"None",
"and",
"project_id",
"in",
"self",
".",
"_projects",
":",
"return",
"self",
"."... | Create a project and keep a references to it in project manager.
See documentation of Project for arguments | [
"Create",
"a",
"project",
"and",
"keep",
"a",
"references",
"to",
"it",
"in",
"project",
"manager",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project_manager.py#L98-L110 |
226,414 | GNS3/gns3-server | gns3server/compute/project_manager.py | ProjectManager.remove_project | def remove_project(self, project_id):
"""
Removes a Project instance from the list of projects in use.
:param project_id: Project identifier
"""
if project_id not in self._projects:
raise aiohttp.web.HTTPNotFound(text="Project ID {} doesn't exist".format(project_id)... | python | def remove_project(self, project_id):
"""
Removes a Project instance from the list of projects in use.
:param project_id: Project identifier
"""
if project_id not in self._projects:
raise aiohttp.web.HTTPNotFound(text="Project ID {} doesn't exist".format(project_id)... | [
"def",
"remove_project",
"(",
"self",
",",
"project_id",
")",
":",
"if",
"project_id",
"not",
"in",
"self",
".",
"_projects",
":",
"raise",
"aiohttp",
".",
"web",
".",
"HTTPNotFound",
"(",
"text",
"=",
"\"Project ID {} doesn't exist\"",
".",
"format",
"(",
"... | Removes a Project instance from the list of projects in use.
:param project_id: Project identifier | [
"Removes",
"a",
"Project",
"instance",
"from",
"the",
"list",
"of",
"projects",
"in",
"use",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project_manager.py#L112-L121 |
226,415 | GNS3/gns3-server | gns3server/compute/project_manager.py | ProjectManager.check_hardware_virtualization | def check_hardware_virtualization(self, source_node):
"""
Checks if hardware virtualization can be used.
:returns: boolean
"""
for project in self._projects.values():
for node in project.nodes:
if node == source_node:
continue
... | python | def check_hardware_virtualization(self, source_node):
"""
Checks if hardware virtualization can be used.
:returns: boolean
"""
for project in self._projects.values():
for node in project.nodes:
if node == source_node:
continue
... | [
"def",
"check_hardware_virtualization",
"(",
"self",
",",
"source_node",
")",
":",
"for",
"project",
"in",
"self",
".",
"_projects",
".",
"values",
"(",
")",
":",
"for",
"node",
"in",
"project",
".",
"nodes",
":",
"if",
"node",
"==",
"source_node",
":",
... | Checks if hardware virtualization can be used.
:returns: boolean | [
"Checks",
"if",
"hardware",
"virtualization",
"can",
"be",
"used",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project_manager.py#L123-L136 |
226,416 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud.ports_mapping | def ports_mapping(self, ports):
"""
Set the ports on this cloud.
:param ports: ports info
"""
if ports != self._ports_mapping:
if len(self._nios) > 0:
raise NodeError("Can't modify a cloud already connected.")
port_number = 0
... | python | def ports_mapping(self, ports):
"""
Set the ports on this cloud.
:param ports: ports info
"""
if ports != self._ports_mapping:
if len(self._nios) > 0:
raise NodeError("Can't modify a cloud already connected.")
port_number = 0
... | [
"def",
"ports_mapping",
"(",
"self",
",",
"ports",
")",
":",
"if",
"ports",
"!=",
"self",
".",
"_ports_mapping",
":",
"if",
"len",
"(",
"self",
".",
"_nios",
")",
">",
"0",
":",
"raise",
"NodeError",
"(",
"\"Can't modify a cloud already connected.\"",
")",
... | Set the ports on this cloud.
:param ports: ports info | [
"Set",
"the",
"ports",
"on",
"this",
"cloud",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L103-L119 |
226,417 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud.close | def close(self):
"""
Closes this cloud.
"""
if not (yield from super().close()):
return False
for nio in self._nios.values():
if nio and isinstance(nio, NIOUDP):
self.manager.port_manager.release_udp_port(nio.lport, self._project)
... | python | def close(self):
"""
Closes this cloud.
"""
if not (yield from super().close()):
return False
for nio in self._nios.values():
if nio and isinstance(nio, NIOUDP):
self.manager.port_manager.release_udp_port(nio.lport, self._project)
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"(",
"yield",
"from",
"super",
"(",
")",
".",
"close",
"(",
")",
")",
":",
"return",
"False",
"for",
"nio",
"in",
"self",
".",
"_nios",
".",
"values",
"(",
")",
":",
"if",
"nio",
"and",
"isins... | Closes this cloud. | [
"Closes",
"this",
"cloud",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L146-L159 |
226,418 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud._add_linux_ethernet | def _add_linux_ethernet(self, port_info, bridge_name):
"""
Use raw sockets on Linux.
If interface is a bridge we connect a tap to it
"""
interface = port_info["interface"]
if gns3server.utils.interfaces.is_interface_bridge(interface):
network_interfaces = [i... | python | def _add_linux_ethernet(self, port_info, bridge_name):
"""
Use raw sockets on Linux.
If interface is a bridge we connect a tap to it
"""
interface = port_info["interface"]
if gns3server.utils.interfaces.is_interface_bridge(interface):
network_interfaces = [i... | [
"def",
"_add_linux_ethernet",
"(",
"self",
",",
"port_info",
",",
"bridge_name",
")",
":",
"interface",
"=",
"port_info",
"[",
"\"interface\"",
"]",
"if",
"gns3server",
".",
"utils",
".",
"interfaces",
".",
"is_interface_bridge",
"(",
"interface",
")",
":",
"n... | Use raw sockets on Linux.
If interface is a bridge we connect a tap to it | [
"Use",
"raw",
"sockets",
"on",
"Linux",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L245-L265 |
226,419 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud.add_nio | def add_nio(self, nio, port_number):
"""
Adds a NIO as new port on this cloud.
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO
"""
if port_number in self._nios:
raise NodeError("Port {} isn't free".format(port_number))
... | python | def add_nio(self, nio, port_number):
"""
Adds a NIO as new port on this cloud.
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO
"""
if port_number in self._nios:
raise NodeError("Port {} isn't free".format(port_number))
... | [
"def",
"add_nio",
"(",
"self",
",",
"nio",
",",
"port_number",
")",
":",
"if",
"port_number",
"in",
"self",
".",
"_nios",
":",
"raise",
"NodeError",
"(",
"\"Port {} isn't free\"",
".",
"format",
"(",
"port_number",
")",
")",
"log",
".",
"info",
"(",
"'Cl... | Adds a NIO as new port on this cloud.
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO | [
"Adds",
"a",
"NIO",
"as",
"new",
"port",
"on",
"this",
"cloud",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L288-L317 |
226,420 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud.update_nio | def update_nio(self, port_number, nio):
"""
Update an nio on this node
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO
"""
bridge_name = "{}-{}".format(self._id, port_number)
if self._ubridge_hypervisor and self._ubridge_hypervis... | python | def update_nio(self, port_number, nio):
"""
Update an nio on this node
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO
"""
bridge_name = "{}-{}".format(self._id, port_number)
if self._ubridge_hypervisor and self._ubridge_hypervis... | [
"def",
"update_nio",
"(",
"self",
",",
"port_number",
",",
"nio",
")",
":",
"bridge_name",
"=",
"\"{}-{}\"",
".",
"format",
"(",
"self",
".",
"_id",
",",
"port_number",
")",
"if",
"self",
".",
"_ubridge_hypervisor",
"and",
"self",
".",
"_ubridge_hypervisor",... | Update an nio on this node
:param nio: NIO instance to add
:param port_number: port to allocate for the NIO | [
"Update",
"an",
"nio",
"on",
"this",
"node"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L320-L330 |
226,421 | GNS3/gns3-server | gns3server/compute/builtin/nodes/cloud.py | Cloud.remove_nio | def remove_nio(self, port_number):
"""
Removes the specified NIO as member of cloud.
:param port_number: allocated port number
:returns: the NIO that was bound to the allocated port
"""
if port_number not in self._nios:
raise NodeError("Port {} is not alloc... | python | def remove_nio(self, port_number):
"""
Removes the specified NIO as member of cloud.
:param port_number: allocated port number
:returns: the NIO that was bound to the allocated port
"""
if port_number not in self._nios:
raise NodeError("Port {} is not alloc... | [
"def",
"remove_nio",
"(",
"self",
",",
"port_number",
")",
":",
"if",
"port_number",
"not",
"in",
"self",
".",
"_nios",
":",
"raise",
"NodeError",
"(",
"\"Port {} is not allocated\"",
".",
"format",
"(",
"port_number",
")",
")",
"nio",
"=",
"self",
".",
"_... | Removes the specified NIO as member of cloud.
:param port_number: allocated port number
:returns: the NIO that was bound to the allocated port | [
"Removes",
"the",
"specified",
"NIO",
"as",
"member",
"of",
"cloud",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/cloud.py#L344-L369 |
226,422 | GNS3/gns3-server | gns3server/run.py | pid_lock | def pid_lock(path):
"""
Write the file in a file on the system.
Check if the process is not already running.
"""
if os.path.exists(path):
pid = None
try:
with open(path) as f:
try:
pid = int(f.read())
os.kill(pid, 0... | python | def pid_lock(path):
"""
Write the file in a file on the system.
Check if the process is not already running.
"""
if os.path.exists(path):
pid = None
try:
with open(path) as f:
try:
pid = int(f.read())
os.kill(pid, 0... | [
"def",
"pid_lock",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"pid",
"=",
"None",
"try",
":",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"try",
":",
"pid",
"=",
"int",
"(",
"f",
".",
"read",
... | Write the file in a file on the system.
Check if the process is not already running. | [
"Write",
"the",
"file",
"in",
"a",
"file",
"on",
"the",
"system",
".",
"Check",
"if",
"the",
"process",
"is",
"not",
"already",
"running",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/run.py#L151-L179 |
226,423 | GNS3/gns3-server | gns3server/run.py | kill_ghosts | def kill_ghosts():
"""
Kill process from previous GNS3 session
"""
detect_process = ["vpcs", "ubridge", "dynamips"]
for proc in psutil.process_iter():
try:
name = proc.name().lower().split(".")[0]
if name in detect_process:
proc.kill()
... | python | def kill_ghosts():
"""
Kill process from previous GNS3 session
"""
detect_process = ["vpcs", "ubridge", "dynamips"]
for proc in psutil.process_iter():
try:
name = proc.name().lower().split(".")[0]
if name in detect_process:
proc.kill()
... | [
"def",
"kill_ghosts",
"(",
")",
":",
"detect_process",
"=",
"[",
"\"vpcs\"",
",",
"\"ubridge\"",
",",
"\"dynamips\"",
"]",
"for",
"proc",
"in",
"psutil",
".",
"process_iter",
"(",
")",
":",
"try",
":",
"name",
"=",
"proc",
".",
"name",
"(",
")",
".",
... | Kill process from previous GNS3 session | [
"Kill",
"process",
"from",
"previous",
"GNS3",
"session"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/run.py#L182-L194 |
226,424 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.qemu_path | def qemu_path(self, qemu_path):
"""
Sets the QEMU binary path this QEMU VM.
:param qemu_path: QEMU path
"""
if qemu_path and os.pathsep not in qemu_path:
if sys.platform.startswith("win") and ".exe" not in qemu_path.lower():
qemu_path += "w.exe"
... | python | def qemu_path(self, qemu_path):
"""
Sets the QEMU binary path this QEMU VM.
:param qemu_path: QEMU path
"""
if qemu_path and os.pathsep not in qemu_path:
if sys.platform.startswith("win") and ".exe" not in qemu_path.lower():
qemu_path += "w.exe"
... | [
"def",
"qemu_path",
"(",
"self",
",",
"qemu_path",
")",
":",
"if",
"qemu_path",
"and",
"os",
".",
"pathsep",
"not",
"in",
"qemu_path",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
"and",
"\".exe\"",
"not",
"in",
"qemu_path",... | Sets the QEMU binary path this QEMU VM.
:param qemu_path: QEMU path | [
"Sets",
"the",
"QEMU",
"binary",
"path",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L146-L178 |
226,425 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._disk_setter | def _disk_setter(self, variable, value):
"""
Use by disk image setter for checking and apply modifications
:param variable: Variable name in the class
:param value: New disk value
"""
value = self.manager.get_abs_image_path(value)
if not self.linked_clone:
... | python | def _disk_setter(self, variable, value):
"""
Use by disk image setter for checking and apply modifications
:param variable: Variable name in the class
:param value: New disk value
"""
value = self.manager.get_abs_image_path(value)
if not self.linked_clone:
... | [
"def",
"_disk_setter",
"(",
"self",
",",
"variable",
",",
"value",
")",
":",
"value",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"value",
")",
"if",
"not",
"self",
".",
"linked_clone",
":",
"for",
"node",
"in",
"self",
".",
"manager",
... | Use by disk image setter for checking and apply modifications
:param variable: Variable name in the class
:param value: New disk value | [
"Use",
"by",
"disk",
"image",
"setter",
"for",
"checking",
"and",
"apply",
"modifications"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L203-L219 |
226,426 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.hdc_disk_interface | def hdc_disk_interface(self, hdc_disk_interface):
"""
Sets the hdc disk interface for this QEMU VM.
:param hdc_disk_interface: QEMU hdc disk interface
"""
self._hdc_disk_interface = hdc_disk_interface
log.info('QEMU VM "{name}" [{id}] has set the QEMU hdc disk interface... | python | def hdc_disk_interface(self, hdc_disk_interface):
"""
Sets the hdc disk interface for this QEMU VM.
:param hdc_disk_interface: QEMU hdc disk interface
"""
self._hdc_disk_interface = hdc_disk_interface
log.info('QEMU VM "{name}" [{id}] has set the QEMU hdc disk interface... | [
"def",
"hdc_disk_interface",
"(",
"self",
",",
"hdc_disk_interface",
")",
":",
"self",
".",
"_hdc_disk_interface",
"=",
"hdc_disk_interface",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU hdc disk interface to {interface}'",
".",
"format",
"(",
"name... | Sets the hdc disk interface for this QEMU VM.
:param hdc_disk_interface: QEMU hdc disk interface | [
"Sets",
"the",
"hdc",
"disk",
"interface",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L357-L367 |
226,427 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.hdd_disk_interface | def hdd_disk_interface(self, hdd_disk_interface):
"""
Sets the hdd disk interface for this QEMU VM.
:param hdd_disk_interface: QEMU hdd disk interface
"""
self._hdd_disk_interface = hdd_disk_interface
log.info('QEMU VM "{name}" [{id}] has set the QEMU hdd disk interface... | python | def hdd_disk_interface(self, hdd_disk_interface):
"""
Sets the hdd disk interface for this QEMU VM.
:param hdd_disk_interface: QEMU hdd disk interface
"""
self._hdd_disk_interface = hdd_disk_interface
log.info('QEMU VM "{name}" [{id}] has set the QEMU hdd disk interface... | [
"def",
"hdd_disk_interface",
"(",
"self",
",",
"hdd_disk_interface",
")",
":",
"self",
".",
"_hdd_disk_interface",
"=",
"hdd_disk_interface",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU hdd disk interface to {interface}'",
".",
"format",
"(",
"name... | Sets the hdd disk interface for this QEMU VM.
:param hdd_disk_interface: QEMU hdd disk interface | [
"Sets",
"the",
"hdd",
"disk",
"interface",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L380-L390 |
226,428 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.cdrom_image | def cdrom_image(self, cdrom_image):
"""
Sets the cdrom image for this QEMU VM.
:param cdrom_image: QEMU cdrom image path
"""
self._cdrom_image = self.manager.get_abs_image_path(cdrom_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU cdrom image path to {cdrom_ima... | python | def cdrom_image(self, cdrom_image):
"""
Sets the cdrom image for this QEMU VM.
:param cdrom_image: QEMU cdrom image path
"""
self._cdrom_image = self.manager.get_abs_image_path(cdrom_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU cdrom image path to {cdrom_ima... | [
"def",
"cdrom_image",
"(",
"self",
",",
"cdrom_image",
")",
":",
"self",
".",
"_cdrom_image",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"cdrom_image",
")",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU cdrom image path to {cd... | Sets the cdrom image for this QEMU VM.
:param cdrom_image: QEMU cdrom image path | [
"Sets",
"the",
"cdrom",
"image",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L403-L412 |
226,429 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.bios_image | def bios_image(self, bios_image):
"""
Sets the bios image for this QEMU VM.
:param bios_image: QEMU bios image path
"""
self._bios_image = self.manager.get_abs_image_path(bios_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU bios image path to {bios_image}'.form... | python | def bios_image(self, bios_image):
"""
Sets the bios image for this QEMU VM.
:param bios_image: QEMU bios image path
"""
self._bios_image = self.manager.get_abs_image_path(bios_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU bios image path to {bios_image}'.form... | [
"def",
"bios_image",
"(",
"self",
",",
"bios_image",
")",
":",
"self",
".",
"_bios_image",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"bios_image",
")",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU bios image path to {bios_im... | Sets the bios image for this QEMU VM.
:param bios_image: QEMU bios image path | [
"Sets",
"the",
"bios",
"image",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L425-L434 |
226,430 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.boot_priority | def boot_priority(self, boot_priority):
"""
Sets the boot priority for this QEMU VM.
:param boot_priority: QEMU boot priority
"""
self._boot_priority = boot_priority
log.info('QEMU VM "{name}" [{id}] has set the boot priority to {boot_priority}'.format(name=self._name,
... | python | def boot_priority(self, boot_priority):
"""
Sets the boot priority for this QEMU VM.
:param boot_priority: QEMU boot priority
"""
self._boot_priority = boot_priority
log.info('QEMU VM "{name}" [{id}] has set the boot priority to {boot_priority}'.format(name=self._name,
... | [
"def",
"boot_priority",
"(",
"self",
",",
"boot_priority",
")",
":",
"self",
".",
"_boot_priority",
"=",
"boot_priority",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the boot priority to {boot_priority}'",
".",
"format",
"(",
"name",
"=",
"self",
".",... | Sets the boot priority for this QEMU VM.
:param boot_priority: QEMU boot priority | [
"Sets",
"the",
"boot",
"priority",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L447-L457 |
226,431 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.adapters | def adapters(self, adapters):
"""
Sets the number of Ethernet adapters for this QEMU VM.
:param adapters: number of adapters
"""
self._ethernet_adapters.clear()
for adapter_number in range(0, adapters):
self._ethernet_adapters.append(EthernetAdapter())
... | python | def adapters(self, adapters):
"""
Sets the number of Ethernet adapters for this QEMU VM.
:param adapters: number of adapters
"""
self._ethernet_adapters.clear()
for adapter_number in range(0, adapters):
self._ethernet_adapters.append(EthernetAdapter())
... | [
"def",
"adapters",
"(",
"self",
",",
"adapters",
")",
":",
"self",
".",
"_ethernet_adapters",
".",
"clear",
"(",
")",
"for",
"adapter_number",
"in",
"range",
"(",
"0",
",",
"adapters",
")",
":",
"self",
".",
"_ethernet_adapters",
".",
"append",
"(",
"Eth... | Sets the number of Ethernet adapters for this QEMU VM.
:param adapters: number of adapters | [
"Sets",
"the",
"number",
"of",
"Ethernet",
"adapters",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L477-L490 |
226,432 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.mac_address | def mac_address(self, mac_address):
"""
Sets the MAC address for this QEMU VM.
:param mac_address: MAC address
"""
if not mac_address:
# use the node UUID to generate a random MAC address
self._mac_address = "52:%s:%s:%s:%s:00" % (self.project.id[-4:-2],... | python | def mac_address(self, mac_address):
"""
Sets the MAC address for this QEMU VM.
:param mac_address: MAC address
"""
if not mac_address:
# use the node UUID to generate a random MAC address
self._mac_address = "52:%s:%s:%s:%s:00" % (self.project.id[-4:-2],... | [
"def",
"mac_address",
"(",
"self",
",",
"mac_address",
")",
":",
"if",
"not",
"mac_address",
":",
"# use the node UUID to generate a random MAC address",
"self",
".",
"_mac_address",
"=",
"\"52:%s:%s:%s:%s:00\"",
"%",
"(",
"self",
".",
"project",
".",
"id",
"[",
"... | Sets the MAC address for this QEMU VM.
:param mac_address: MAC address | [
"Sets",
"the",
"MAC",
"address",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L527-L542 |
226,433 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.legacy_networking | def legacy_networking(self, legacy_networking):
"""
Sets either QEMU legacy networking commands are used.
:param legacy_networking: boolean
"""
if legacy_networking:
log.info('QEMU VM "{name}" [{id}] has enabled legacy networking'.format(name=self._name, id=self._id... | python | def legacy_networking(self, legacy_networking):
"""
Sets either QEMU legacy networking commands are used.
:param legacy_networking: boolean
"""
if legacy_networking:
log.info('QEMU VM "{name}" [{id}] has enabled legacy networking'.format(name=self._name, id=self._id... | [
"def",
"legacy_networking",
"(",
"self",
",",
"legacy_networking",
")",
":",
"if",
"legacy_networking",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has enabled legacy networking'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"="... | Sets either QEMU legacy networking commands are used.
:param legacy_networking: boolean | [
"Sets",
"either",
"QEMU",
"legacy",
"networking",
"commands",
"are",
"used",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L555-L566 |
226,434 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.acpi_shutdown | def acpi_shutdown(self, acpi_shutdown):
"""
Sets either this QEMU VM can be ACPI shutdown.
:param acpi_shutdown: boolean
"""
if acpi_shutdown:
log.info('QEMU VM "{name}" [{id}] has enabled ACPI shutdown'.format(name=self._name, id=self._id))
else:
... | python | def acpi_shutdown(self, acpi_shutdown):
"""
Sets either this QEMU VM can be ACPI shutdown.
:param acpi_shutdown: boolean
"""
if acpi_shutdown:
log.info('QEMU VM "{name}" [{id}] has enabled ACPI shutdown'.format(name=self._name, id=self._id))
else:
... | [
"def",
"acpi_shutdown",
"(",
"self",
",",
"acpi_shutdown",
")",
":",
"if",
"acpi_shutdown",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has enabled ACPI shutdown'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
"self",
".... | Sets either this QEMU VM can be ACPI shutdown.
:param acpi_shutdown: boolean | [
"Sets",
"either",
"this",
"QEMU",
"VM",
"can",
"be",
"ACPI",
"shutdown",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L579-L590 |
226,435 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.cpu_throttling | def cpu_throttling(self, cpu_throttling):
"""
Sets the percentage of CPU allowed.
:param cpu_throttling: integer
"""
log.info('QEMU VM "{name}" [{id}] has set the percentage of CPU allowed to {cpu}'.format(name=self._name,
... | python | def cpu_throttling(self, cpu_throttling):
"""
Sets the percentage of CPU allowed.
:param cpu_throttling: integer
"""
log.info('QEMU VM "{name}" [{id}] has set the percentage of CPU allowed to {cpu}'.format(name=self._name,
... | [
"def",
"cpu_throttling",
"(",
"self",
",",
"cpu_throttling",
")",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the percentage of CPU allowed to {cpu}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
"self",
".",
"_id",... | Sets the percentage of CPU allowed.
:param cpu_throttling: integer | [
"Sets",
"the",
"percentage",
"of",
"CPU",
"allowed",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L603-L616 |
226,436 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.process_priority | def process_priority(self, process_priority):
"""
Sets the process priority.
:param process_priority: string
"""
log.info('QEMU VM "{name}" [{id}] has set the process priority to {priority}'.format(name=self._name,
... | python | def process_priority(self, process_priority):
"""
Sets the process priority.
:param process_priority: string
"""
log.info('QEMU VM "{name}" [{id}] has set the process priority to {priority}'.format(name=self._name,
... | [
"def",
"process_priority",
"(",
"self",
",",
"process_priority",
")",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the process priority to {priority}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
"self",
".",
"_id",... | Sets the process priority.
:param process_priority: string | [
"Sets",
"the",
"process",
"priority",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L629-L639 |
226,437 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.cpus | def cpus(self, cpus):
"""
Sets the number of vCPUs this QEMU VM.
:param cpus: number of vCPUs.
"""
log.info('QEMU VM "{name}" [{id}] has set the number of vCPUs to {cpus}'.format(name=self._name, id=self._id, cpus=cpus))
self._cpus = cpus | python | def cpus(self, cpus):
"""
Sets the number of vCPUs this QEMU VM.
:param cpus: number of vCPUs.
"""
log.info('QEMU VM "{name}" [{id}] has set the number of vCPUs to {cpus}'.format(name=self._name, id=self._id, cpus=cpus))
self._cpus = cpus | [
"def",
"cpus",
"(",
"self",
",",
"cpus",
")",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the number of vCPUs to {cpus}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
"self",
".",
"_id",
",",
"cpus",
"=",
"c... | Sets the number of vCPUs this QEMU VM.
:param cpus: number of vCPUs. | [
"Sets",
"the",
"number",
"of",
"vCPUs",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L673-L681 |
226,438 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.options | def options(self, options):
"""
Sets the options for this QEMU VM.
:param options: QEMU options
"""
log.info('QEMU VM "{name}" [{id}] has set the QEMU options to {options}'.format(name=self._name,
... | python | def options(self, options):
"""
Sets the options for this QEMU VM.
:param options: QEMU options
"""
log.info('QEMU VM "{name}" [{id}] has set the QEMU options to {options}'.format(name=self._name,
... | [
"def",
"options",
"(",
"self",
",",
"options",
")",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU options to {options}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
"self",
".",
"_id",
",",
"options",
... | Sets the options for this QEMU VM.
:param options: QEMU options | [
"Sets",
"the",
"options",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L694-L714 |
226,439 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.initrd | def initrd(self, initrd):
"""
Sets the initrd path for this QEMU VM.
:param initrd: QEMU initrd path
"""
initrd = self.manager.get_abs_image_path(initrd)
log.info('QEMU VM "{name}" [{id}] has set the QEMU initrd path to {initrd}'.format(name=self._name,
... | python | def initrd(self, initrd):
"""
Sets the initrd path for this QEMU VM.
:param initrd: QEMU initrd path
"""
initrd = self.manager.get_abs_image_path(initrd)
log.info('QEMU VM "{name}" [{id}] has set the QEMU initrd path to {initrd}'.format(name=self._name,
... | [
"def",
"initrd",
"(",
"self",
",",
"initrd",
")",
":",
"initrd",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"initrd",
")",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU initrd path to {initrd}'",
".",
"format",
"(",
"name"... | Sets the initrd path for this QEMU VM.
:param initrd: QEMU initrd path | [
"Sets",
"the",
"initrd",
"path",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L727-L741 |
226,440 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.kernel_image | def kernel_image(self, kernel_image):
"""
Sets the kernel image path for this QEMU VM.
:param kernel_image: QEMU kernel image path
"""
kernel_image = self.manager.get_abs_image_path(kernel_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU kernel image path to {k... | python | def kernel_image(self, kernel_image):
"""
Sets the kernel image path for this QEMU VM.
:param kernel_image: QEMU kernel image path
"""
kernel_image = self.manager.get_abs_image_path(kernel_image)
log.info('QEMU VM "{name}" [{id}] has set the QEMU kernel image path to {k... | [
"def",
"kernel_image",
"(",
"self",
",",
"kernel_image",
")",
":",
"kernel_image",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"kernel_image",
")",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU kernel image path to {kernel_image}'"... | Sets the kernel image path for this QEMU VM.
:param kernel_image: QEMU kernel image path | [
"Sets",
"the",
"kernel",
"image",
"path",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L754-L765 |
226,441 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.kernel_command_line | def kernel_command_line(self, kernel_command_line):
"""
Sets the kernel command line for this QEMU VM.
:param kernel_command_line: QEMU kernel command line
"""
log.info('QEMU VM "{name}" [{id}] has set the QEMU kernel command line to {kernel_command_line}'.format(name=self._nam... | python | def kernel_command_line(self, kernel_command_line):
"""
Sets the kernel command line for this QEMU VM.
:param kernel_command_line: QEMU kernel command line
"""
log.info('QEMU VM "{name}" [{id}] has set the QEMU kernel command line to {kernel_command_line}'.format(name=self._nam... | [
"def",
"kernel_command_line",
"(",
"self",
",",
"kernel_command_line",
")",
":",
"log",
".",
"info",
"(",
"'QEMU VM \"{name}\" [{id}] has set the QEMU kernel command line to {kernel_command_line}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"id",
"=",
... | Sets the kernel command line for this QEMU VM.
:param kernel_command_line: QEMU kernel command line | [
"Sets",
"the",
"kernel",
"command",
"line",
"for",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L778-L788 |
226,442 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._set_process_priority | def _set_process_priority(self):
"""
Changes the process priority
"""
if self._process_priority == "normal":
return
if sys.platform.startswith("win"):
try:
import win32api
import win32con
import win32proces... | python | def _set_process_priority(self):
"""
Changes the process priority
"""
if self._process_priority == "normal":
return
if sys.platform.startswith("win"):
try:
import win32api
import win32con
import win32proces... | [
"def",
"_set_process_priority",
"(",
"self",
")",
":",
"if",
"self",
".",
"_process_priority",
"==",
"\"normal\"",
":",
"return",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"try",
":",
"import",
"win32api",
"import",
"win32con... | Changes the process priority | [
"Changes",
"the",
"process",
"priority"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L791-L842 |
226,443 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._stop_cpulimit | def _stop_cpulimit(self):
"""
Stops the cpulimit process.
"""
if self._cpulimit_process and self._cpulimit_process.returncode is None:
self._cpulimit_process.kill()
try:
self._process.wait(3)
except subprocess.TimeoutExpired:
... | python | def _stop_cpulimit(self):
"""
Stops the cpulimit process.
"""
if self._cpulimit_process and self._cpulimit_process.returncode is None:
self._cpulimit_process.kill()
try:
self._process.wait(3)
except subprocess.TimeoutExpired:
... | [
"def",
"_stop_cpulimit",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cpulimit_process",
"and",
"self",
".",
"_cpulimit_process",
".",
"returncode",
"is",
"None",
":",
"self",
".",
"_cpulimit_process",
".",
"kill",
"(",
")",
"try",
":",
"self",
".",
"_proce... | Stops the cpulimit process. | [
"Stops",
"the",
"cpulimit",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L844-L854 |
226,444 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._set_cpu_throttling | def _set_cpu_throttling(self):
"""
Limits the CPU usage for current QEMU process.
"""
if not self.is_running():
return
try:
if sys.platform.startswith("win") and hasattr(sys, "frozen"):
cpulimit_exec = os.path.join(os.path.dirname(os.path... | python | def _set_cpu_throttling(self):
"""
Limits the CPU usage for current QEMU process.
"""
if not self.is_running():
return
try:
if sys.platform.startswith("win") and hasattr(sys, "frozen"):
cpulimit_exec = os.path.join(os.path.dirname(os.path... | [
"def",
"_set_cpu_throttling",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"return",
"try",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
"and",
"hasattr",
"(",
"sys",
",",
"\"frozen\"",
")"... | Limits the CPU usage for current QEMU process. | [
"Limits",
"the",
"CPU",
"usage",
"for",
"current",
"QEMU",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L856-L874 |
226,445 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.stop | def stop(self):
"""
Stops this QEMU VM.
"""
yield from self._stop_ubridge()
with (yield from self._execute_lock):
# stop the QEMU process
self._hw_virtualization = False
if self.is_running():
log.info('Stopping QEMU VM "{}" PID... | python | def stop(self):
"""
Stops this QEMU VM.
"""
yield from self._stop_ubridge()
with (yield from self._execute_lock):
# stop the QEMU process
self._hw_virtualization = False
if self.is_running():
log.info('Stopping QEMU VM "{}" PID... | [
"def",
"stop",
"(",
"self",
")",
":",
"yield",
"from",
"self",
".",
"_stop_ubridge",
"(",
")",
"with",
"(",
"yield",
"from",
"self",
".",
"_execute_lock",
")",
":",
"# stop the QEMU process",
"self",
".",
"_hw_virtualization",
"=",
"False",
"if",
"self",
"... | Stops this QEMU VM. | [
"Stops",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L962-L992 |
226,446 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._control_vm | def _control_vm(self, command, expected=None):
"""
Executes a command with QEMU monitor when this VM is running.
:param command: QEMU monitor command (e.g. info status, stop etc.)
:param expected: An array of expected strings
:returns: result of the command (matched object or N... | python | def _control_vm(self, command, expected=None):
"""
Executes a command with QEMU monitor when this VM is running.
:param command: QEMU monitor command (e.g. info status, stop etc.)
:param expected: An array of expected strings
:returns: result of the command (matched object or N... | [
"def",
"_control_vm",
"(",
"self",
",",
"command",
",",
"expected",
"=",
"None",
")",
":",
"result",
"=",
"None",
"if",
"self",
".",
"is_running",
"(",
")",
"and",
"self",
".",
"_monitor",
":",
"log",
".",
"debug",
"(",
"\"Execute QEMU monitor command: {}\... | Executes a command with QEMU monitor when this VM is running.
:param command: QEMU monitor command (e.g. info status, stop etc.)
:param expected: An array of expected strings
:returns: result of the command (matched object or None) | [
"Executes",
"a",
"command",
"with",
"QEMU",
"monitor",
"when",
"this",
"VM",
"is",
"running",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L995-L1033 |
226,447 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.close | def close(self):
"""
Closes this QEMU VM.
"""
if not (yield from super().close()):
return False
self.acpi_shutdown = False
yield from self.stop()
for adapter in self._ethernet_adapters:
if adapter is not None:
for nio in ... | python | def close(self):
"""
Closes this QEMU VM.
"""
if not (yield from super().close()):
return False
self.acpi_shutdown = False
yield from self.stop()
for adapter in self._ethernet_adapters:
if adapter is not None:
for nio in ... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"(",
"yield",
"from",
"super",
"(",
")",
".",
"close",
"(",
")",
")",
":",
"return",
"False",
"self",
".",
"acpi_shutdown",
"=",
"False",
"yield",
"from",
"self",
".",
"stop",
"(",
")",
"for",
"... | Closes this QEMU VM. | [
"Closes",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1036-L1056 |
226,448 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._get_vm_status | def _get_vm_status(self):
"""
Returns this VM suspend status.
Status are extracted from:
https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152
:returns: status (string)
"""
result = yield from self._control_vm("info status", [
b"debug", b... | python | def _get_vm_status(self):
"""
Returns this VM suspend status.
Status are extracted from:
https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152
:returns: status (string)
"""
result = yield from self._control_vm("info status", [
b"debug", b... | [
"def",
"_get_vm_status",
"(",
"self",
")",
":",
"result",
"=",
"yield",
"from",
"self",
".",
"_control_vm",
"(",
"\"info status\"",
",",
"[",
"b\"debug\"",
",",
"b\"inmigrate\"",
",",
"b\"internal-error\"",
",",
"b\"io-error\"",
",",
"b\"paused\"",
",",
"b\"post... | Returns this VM suspend status.
Status are extracted from:
https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152
:returns: status (string) | [
"Returns",
"this",
"VM",
"suspend",
"status",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1059-L1084 |
226,449 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.suspend | def suspend(self):
"""
Suspends this QEMU VM.
"""
if self.is_running():
vm_status = yield from self._get_vm_status()
if vm_status is None:
raise QemuError("Suspending a QEMU VM is not supported")
elif vm_status == "running" or vm_statu... | python | def suspend(self):
"""
Suspends this QEMU VM.
"""
if self.is_running():
vm_status = yield from self._get_vm_status()
if vm_status is None:
raise QemuError("Suspending a QEMU VM is not supported")
elif vm_status == "running" or vm_statu... | [
"def",
"suspend",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_running",
"(",
")",
":",
"vm_status",
"=",
"yield",
"from",
"self",
".",
"_get_vm_status",
"(",
")",
"if",
"vm_status",
"is",
"None",
":",
"raise",
"QemuError",
"(",
"\"Suspending a QEMU VM is... | Suspends this QEMU VM. | [
"Suspends",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1087-L1101 |
226,450 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.resume | def resume(self):
"""
Resumes this QEMU VM.
"""
vm_status = yield from self._get_vm_status()
if vm_status is None:
raise QemuError("Resuming a QEMU VM is not supported")
elif vm_status == "paused":
yield from self._control_vm("cont")
l... | python | def resume(self):
"""
Resumes this QEMU VM.
"""
vm_status = yield from self._get_vm_status()
if vm_status is None:
raise QemuError("Resuming a QEMU VM is not supported")
elif vm_status == "paused":
yield from self._control_vm("cont")
l... | [
"def",
"resume",
"(",
"self",
")",
":",
"vm_status",
"=",
"yield",
"from",
"self",
".",
"_get_vm_status",
"(",
")",
"if",
"vm_status",
"is",
"None",
":",
"raise",
"QemuError",
"(",
"\"Resuming a QEMU VM is not supported\"",
")",
"elif",
"vm_status",
"==",
"\"p... | Resumes this QEMU VM. | [
"Resumes",
"this",
"QEMU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1113-L1125 |
226,451 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.read_stdout | def read_stdout(self):
"""
Reads the standard output of the QEMU process.
Only use when the process has been stopped or has crashed.
"""
output = ""
if self._stdout_file:
try:
with open(self._stdout_file, "rb") as file:
out... | python | def read_stdout(self):
"""
Reads the standard output of the QEMU process.
Only use when the process has been stopped or has crashed.
"""
output = ""
if self._stdout_file:
try:
with open(self._stdout_file, "rb") as file:
out... | [
"def",
"read_stdout",
"(",
"self",
")",
":",
"output",
"=",
"\"\"",
"if",
"self",
".",
"_stdout_file",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_stdout_file",
",",
"\"rb\"",
")",
"as",
"file",
":",
"output",
"=",
"file",
".",
"read",
"(",
... | Reads the standard output of the QEMU process.
Only use when the process has been stopped or has crashed. | [
"Reads",
"the",
"standard",
"output",
"of",
"the",
"QEMU",
"process",
".",
"Only",
"use",
"when",
"the",
"process",
"has",
"been",
"stopped",
"or",
"has",
"crashed",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1275-L1288 |
226,452 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.read_qemu_img_stdout | def read_qemu_img_stdout(self):
"""
Reads the standard output of the QEMU-IMG process.
"""
output = ""
if self._qemu_img_stdout_file:
try:
with open(self._qemu_img_stdout_file, "rb") as file:
output = file.read().decode("utf-8", er... | python | def read_qemu_img_stdout(self):
"""
Reads the standard output of the QEMU-IMG process.
"""
output = ""
if self._qemu_img_stdout_file:
try:
with open(self._qemu_img_stdout_file, "rb") as file:
output = file.read().decode("utf-8", er... | [
"def",
"read_qemu_img_stdout",
"(",
"self",
")",
":",
"output",
"=",
"\"\"",
"if",
"self",
".",
"_qemu_img_stdout_file",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_qemu_img_stdout_file",
",",
"\"rb\"",
")",
"as",
"file",
":",
"output",
"=",
"file... | Reads the standard output of the QEMU-IMG process. | [
"Reads",
"the",
"standard",
"output",
"of",
"the",
"QEMU",
"-",
"IMG",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1290-L1302 |
226,453 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM.is_running | def is_running(self):
"""
Checks if the QEMU process is running
:returns: True or False
"""
if self._process:
if self._process.returncode is None:
return True
else:
self._process = None
return False | python | def is_running(self):
"""
Checks if the QEMU process is running
:returns: True or False
"""
if self._process:
if self._process.returncode is None:
return True
else:
self._process = None
return False | [
"def",
"is_running",
"(",
"self",
")",
":",
"if",
"self",
".",
"_process",
":",
"if",
"self",
".",
"_process",
".",
"returncode",
"is",
"None",
":",
"return",
"True",
"else",
":",
"self",
".",
"_process",
"=",
"None",
"return",
"False"
] | Checks if the QEMU process is running
:returns: True or False | [
"Checks",
"if",
"the",
"QEMU",
"process",
"is",
"running"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1304-L1316 |
226,454 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._get_qemu_img | def _get_qemu_img(self):
"""
Search the qemu-img binary in the same binary of the qemu binary
for avoiding version incompatibily.
:returns: qemu-img path or raise an error
"""
qemu_img_path = ""
qemu_path_dir = os.path.dirname(self.qemu_path)
try:
... | python | def _get_qemu_img(self):
"""
Search the qemu-img binary in the same binary of the qemu binary
for avoiding version incompatibily.
:returns: qemu-img path or raise an error
"""
qemu_img_path = ""
qemu_path_dir = os.path.dirname(self.qemu_path)
try:
... | [
"def",
"_get_qemu_img",
"(",
"self",
")",
":",
"qemu_img_path",
"=",
"\"\"",
"qemu_path_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"qemu_path",
")",
"try",
":",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"qemu_path_dir",
")",
":"... | Search the qemu-img binary in the same binary of the qemu binary
for avoiding version incompatibily.
:returns: qemu-img path or raise an error | [
"Search",
"the",
"qemu",
"-",
"img",
"binary",
"in",
"the",
"same",
"binary",
"of",
"the",
"qemu",
"binary",
"for",
"avoiding",
"version",
"incompatibily",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1364-L1383 |
226,455 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._graphic | def _graphic(self):
"""
Adds the correct graphic options depending of the OS
"""
if sys.platform.startswith("win"):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
return []
if "-nographic" not in self._options:
return ["-nographi... | python | def _graphic(self):
"""
Adds the correct graphic options depending of the OS
"""
if sys.platform.startswith("win"):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
return []
if "-nographic" not in self._options:
return ["-nographi... | [
"def",
"_graphic",
"(",
"self",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"return",
"[",
"]",
"if",
"len",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"\"DISPLAY\"",
",",
"\"\"",
")",
")",
">",
"0",
":",... | Adds the correct graphic options depending of the OS | [
"Adds",
"the",
"correct",
"graphic",
"options",
"depending",
"of",
"the",
"OS"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1603-L1614 |
226,456 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._run_with_kvm | def _run_with_kvm(self, qemu_path, options):
"""
Check if we could run qemu with KVM
:param qemu_path: Path to qemu
:param options: String of qemu user options
:returns: Boolean True if we need to enable KVM
"""
if sys.platform.startswith("linux") and self.manag... | python | def _run_with_kvm(self, qemu_path, options):
"""
Check if we could run qemu with KVM
:param qemu_path: Path to qemu
:param options: String of qemu user options
:returns: Boolean True if we need to enable KVM
"""
if sys.platform.startswith("linux") and self.manag... | [
"def",
"_run_with_kvm",
"(",
"self",
",",
"qemu_path",
",",
"options",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"linux\"",
")",
"and",
"self",
".",
"manager",
".",
"config",
".",
"get_section_config",
"(",
"\"Qemu\"",
")",
".",
"... | Check if we could run qemu with KVM
:param qemu_path: Path to qemu
:param options: String of qemu user options
:returns: Boolean True if we need to enable KVM | [
"Check",
"if",
"we",
"could",
"run",
"qemu",
"with",
"KVM"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1616-L1638 |
226,457 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM.update_settings | def update_settings(self, settings):
"""
Update settings and will restart the VM if require
"""
new_settings = copy.copy(self._settings)
new_settings.update(settings)
if self.settings != new_settings:
yield from self._stop()
self._settings = settin... | python | def update_settings(self, settings):
"""
Update settings and will restart the VM if require
"""
new_settings = copy.copy(self._settings)
new_settings.update(settings)
if self.settings != new_settings:
yield from self._stop()
self._settings = settin... | [
"def",
"update_settings",
"(",
"self",
",",
"settings",
")",
":",
"new_settings",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"_settings",
")",
"new_settings",
".",
"update",
"(",
"settings",
")",
"if",
"self",
".",
"settings",
"!=",
"new_settings",
":",
... | Update settings and will restart the VM if require | [
"Update",
"settings",
"and",
"will",
"restart",
"the",
"VM",
"if",
"require"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L183-L198 |
226,458 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM._get_engine | def _get_engine(self, engine):
"""
Load an engine
"""
if engine in self._engines:
return self._engines[engine]
if engine == "vmware":
self._engines["vmware"] = VMwareGNS3VM(self._controller)
return self._engines["vmware"]
elif engine =... | python | def _get_engine(self, engine):
"""
Load an engine
"""
if engine in self._engines:
return self._engines[engine]
if engine == "vmware":
self._engines["vmware"] = VMwareGNS3VM(self._controller)
return self._engines["vmware"]
elif engine =... | [
"def",
"_get_engine",
"(",
"self",
",",
"engine",
")",
":",
"if",
"engine",
"in",
"self",
".",
"_engines",
":",
"return",
"self",
".",
"_engines",
"[",
"engine",
"]",
"if",
"engine",
"==",
"\"vmware\"",
":",
"self",
".",
"_engines",
"[",
"\"vmware\"",
... | Load an engine | [
"Load",
"an",
"engine"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L200-L216 |
226,459 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM.list | def list(self, engine):
"""
List VMS for an engine
"""
engine = self._get_engine(engine)
vms = []
try:
for vm in (yield from engine.list()):
vms.append({"vmname": vm["vmname"]})
except GNS3VMError as e:
# We raise error only... | python | def list(self, engine):
"""
List VMS for an engine
"""
engine = self._get_engine(engine)
vms = []
try:
for vm in (yield from engine.list()):
vms.append({"vmname": vm["vmname"]})
except GNS3VMError as e:
# We raise error only... | [
"def",
"list",
"(",
"self",
",",
"engine",
")",
":",
"engine",
"=",
"self",
".",
"_get_engine",
"(",
"engine",
")",
"vms",
"=",
"[",
"]",
"try",
":",
"for",
"vm",
"in",
"(",
"yield",
"from",
"engine",
".",
"list",
"(",
")",
")",
":",
"vms",
"."... | List VMS for an engine | [
"List",
"VMS",
"for",
"an",
"engine"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L222-L236 |
226,460 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM.auto_start_vm | def auto_start_vm(self):
"""
Auto start the GNS3 VM if require
"""
if self.enable:
try:
yield from self.start()
except GNS3VMError as e:
# User will receive the error later when they will try to use the node
try:
... | python | def auto_start_vm(self):
"""
Auto start the GNS3 VM if require
"""
if self.enable:
try:
yield from self.start()
except GNS3VMError as e:
# User will receive the error later when they will try to use the node
try:
... | [
"def",
"auto_start_vm",
"(",
"self",
")",
":",
"if",
"self",
".",
"enable",
":",
"try",
":",
"yield",
"from",
"self",
".",
"start",
"(",
")",
"except",
"GNS3VMError",
"as",
"e",
":",
"# User will receive the error later when they will try to use the node",
"try",
... | Auto start the GNS3 VM if require | [
"Auto",
"start",
"the",
"GNS3",
"VM",
"if",
"require"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L239-L255 |
226,461 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM.start | def start(self):
"""
Start the GNS3 VM
"""
engine = self.current_engine()
if not engine.running:
if self._settings["vmname"] is None:
return
log.info("Start the GNS3 VM")
engine.vmname = self._settings["vmname"]
engi... | python | def start(self):
"""
Start the GNS3 VM
"""
engine = self.current_engine()
if not engine.running:
if self._settings["vmname"] is None:
return
log.info("Start the GNS3 VM")
engine.vmname = self._settings["vmname"]
engi... | [
"def",
"start",
"(",
"self",
")",
":",
"engine",
"=",
"self",
".",
"current_engine",
"(",
")",
"if",
"not",
"engine",
".",
"running",
":",
"if",
"self",
".",
"_settings",
"[",
"\"vmname\"",
"]",
"is",
"None",
":",
"return",
"log",
".",
"info",
"(",
... | Start the GNS3 VM | [
"Start",
"the",
"GNS3",
"VM"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L269-L305 |
226,462 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM._check_network | def _check_network(self, compute):
"""
Check that the VM is in the same subnet as the local server
"""
try:
vm_interfaces = yield from compute.interfaces()
vm_interface_netmask = None
for interface in vm_interfaces:
if interface["ip_ad... | python | def _check_network(self, compute):
"""
Check that the VM is in the same subnet as the local server
"""
try:
vm_interfaces = yield from compute.interfaces()
vm_interface_netmask = None
for interface in vm_interfaces:
if interface["ip_ad... | [
"def",
"_check_network",
"(",
"self",
",",
"compute",
")",
":",
"try",
":",
"vm_interfaces",
"=",
"yield",
"from",
"compute",
".",
"interfaces",
"(",
")",
"vm_interface_netmask",
"=",
"None",
"for",
"interface",
"in",
"vm_interfaces",
":",
"if",
"interface",
... | Check that the VM is in the same subnet as the local server | [
"Check",
"that",
"the",
"VM",
"is",
"in",
"the",
"same",
"subnet",
"as",
"the",
"local",
"server"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L308-L338 |
226,463 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM._suspend | def _suspend(self):
"""
Suspend the GNS3 VM
"""
engine = self.current_engine()
if "vm" in self._controller.computes:
yield from self._controller.delete_compute("vm")
if engine.running:
log.info("Suspend the GNS3 VM")
yield from engine.s... | python | def _suspend(self):
"""
Suspend the GNS3 VM
"""
engine = self.current_engine()
if "vm" in self._controller.computes:
yield from self._controller.delete_compute("vm")
if engine.running:
log.info("Suspend the GNS3 VM")
yield from engine.s... | [
"def",
"_suspend",
"(",
"self",
")",
":",
"engine",
"=",
"self",
".",
"current_engine",
"(",
")",
"if",
"\"vm\"",
"in",
"self",
".",
"_controller",
".",
"computes",
":",
"yield",
"from",
"self",
".",
"_controller",
".",
"delete_compute",
"(",
"\"vm\"",
"... | Suspend the GNS3 VM | [
"Suspend",
"the",
"GNS3",
"VM"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L341-L350 |
226,464 | GNS3/gns3-server | gns3server/controller/gns3vm/__init__.py | GNS3VM._stop | def _stop(self):
"""
Stop the GNS3 VM
"""
engine = self.current_engine()
if "vm" in self._controller.computes:
yield from self._controller.delete_compute("vm")
if engine.running:
log.info("Stop the GNS3 VM")
yield from engine.stop() | python | def _stop(self):
"""
Stop the GNS3 VM
"""
engine = self.current_engine()
if "vm" in self._controller.computes:
yield from self._controller.delete_compute("vm")
if engine.running:
log.info("Stop the GNS3 VM")
yield from engine.stop() | [
"def",
"_stop",
"(",
"self",
")",
":",
"engine",
"=",
"self",
".",
"current_engine",
"(",
")",
"if",
"\"vm\"",
"in",
"self",
".",
"_controller",
".",
"computes",
":",
"yield",
"from",
"self",
".",
"_controller",
".",
"delete_compute",
"(",
"\"vm\"",
")",... | Stop the GNS3 VM | [
"Stop",
"the",
"GNS3",
"VM"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L353-L362 |
226,465 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router._convert_before_2_0_0_b3 | def _convert_before_2_0_0_b3(self, dynamips_id):
"""
Before 2.0.0 beta3 the node didn't have a folder by node
when we start we move the file, we can't do it in the topology
conversion due to case of remote servers
"""
dynamips_dir = self.project.module_working_directory(s... | python | def _convert_before_2_0_0_b3(self, dynamips_id):
"""
Before 2.0.0 beta3 the node didn't have a folder by node
when we start we move the file, we can't do it in the topology
conversion due to case of remote servers
"""
dynamips_dir = self.project.module_working_directory(s... | [
"def",
"_convert_before_2_0_0_b3",
"(",
"self",
",",
"dynamips_id",
")",
":",
"dynamips_dir",
"=",
"self",
".",
"project",
".",
"module_working_directory",
"(",
"self",
".",
"manager",
".",
"module_name",
".",
"lower",
"(",
")",
")",
"for",
"path",
"in",
"gl... | Before 2.0.0 beta3 the node didn't have a folder by node
when we start we move the file, we can't do it in the topology
conversion due to case of remote servers | [
"Before",
"2",
".",
"0",
".",
"0",
"beta3",
"the",
"node",
"didn",
"t",
"have",
"a",
"folder",
"by",
"node",
"when",
"we",
"start",
"we",
"move",
"the",
"file",
"we",
"can",
"t",
"do",
"it",
"in",
"the",
"topology",
"conversion",
"due",
"to",
"case... | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L121-L141 |
226,466 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.get_status | def get_status(self):
"""
Returns the status of this router
:returns: inactive, shutting down, running or suspended.
"""
status = yield from self._hypervisor.send('vm get_status "{name}"'.format(name=self._name))
if len(status) == 0:
raise DynamipsError("Can... | python | def get_status(self):
"""
Returns the status of this router
:returns: inactive, shutting down, running or suspended.
"""
status = yield from self._hypervisor.send('vm get_status "{name}"'.format(name=self._name))
if len(status) == 0:
raise DynamipsError("Can... | [
"def",
"get_status",
"(",
"self",
")",
":",
"status",
"=",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm get_status \"{name}\"'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
")",
")",
"if",
"len",
"(",
"status",
")",
"=... | Returns the status of this router
:returns: inactive, shutting down, running or suspended. | [
"Returns",
"the",
"status",
"of",
"this",
"router"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L241-L251 |
226,467 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.start | def start(self):
"""
Starts this router.
At least the IOS image must be set before it can start.
"""
status = yield from self.get_status()
if status == "suspended":
yield from self.resume()
elif status == "inactive":
if not os.path.isfile... | python | def start(self):
"""
Starts this router.
At least the IOS image must be set before it can start.
"""
status = yield from self.get_status()
if status == "suspended":
yield from self.resume()
elif status == "inactive":
if not os.path.isfile... | [
"def",
"start",
"(",
"self",
")",
":",
"status",
"=",
"yield",
"from",
"self",
".",
"get_status",
"(",
")",
"if",
"status",
"==",
"\"suspended\"",
":",
"yield",
"from",
"self",
".",
"resume",
"(",
")",
"elif",
"status",
"==",
"\"inactive\"",
":",
"if",... | Starts this router.
At least the IOS image must be set before it can start. | [
"Starts",
"this",
"router",
".",
"At",
"least",
"the",
"IOS",
"image",
"must",
"be",
"set",
"before",
"it",
"can",
"start",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L254-L304 |
226,468 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.stop | def stop(self):
"""
Stops this router.
"""
status = yield from self.get_status()
if status != "inactive":
try:
yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name))
except DynamipsError as e:
log.warn... | python | def stop(self):
"""
Stops this router.
"""
status = yield from self.get_status()
if status != "inactive":
try:
yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name))
except DynamipsError as e:
log.warn... | [
"def",
"stop",
"(",
"self",
")",
":",
"status",
"=",
"yield",
"from",
"self",
".",
"get_status",
"(",
")",
"if",
"status",
"!=",
"\"inactive\"",
":",
"try",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm stop \"{name}\"'",
".",
... | Stops this router. | [
"Stops",
"this",
"router",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L321-L337 |
226,469 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.suspend | def suspend(self):
"""
Suspends this router.
"""
status = yield from self.get_status()
if status == "running":
yield from self._hypervisor.send('vm suspend "{name}"'.format(name=self._name))
self.status = "suspended"
log.info('Router "{name}" ... | python | def suspend(self):
"""
Suspends this router.
"""
status = yield from self.get_status()
if status == "running":
yield from self._hypervisor.send('vm suspend "{name}"'.format(name=self._name))
self.status = "suspended"
log.info('Router "{name}" ... | [
"def",
"suspend",
"(",
"self",
")",
":",
"status",
"=",
"yield",
"from",
"self",
".",
"get_status",
"(",
")",
"if",
"status",
"==",
"\"running\"",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm suspend \"{name}\"'",
".",
"format",... | Suspends this router. | [
"Suspends",
"this",
"router",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L349-L358 |
226,470 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_image | def set_image(self, image):
"""
Sets the IOS image for this router.
There is no default.
:param image: path to IOS image file
"""
image = self.manager.get_abs_image_path(image)
yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._n... | python | def set_image(self, image):
"""
Sets the IOS image for this router.
There is no default.
:param image: path to IOS image file
"""
image = self.manager.get_abs_image_path(image)
yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._n... | [
"def",
"set_image",
"(",
"self",
",",
"image",
")",
":",
"image",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"image",
")",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_ios \"{name}\" \"{image}\"'",
".",
"format",
... | Sets the IOS image for this router.
There is no default.
:param image: path to IOS image file | [
"Sets",
"the",
"IOS",
"image",
"for",
"this",
"router",
".",
"There",
"is",
"no",
"default",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L491-L507 |
226,471 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_ram | def set_ram(self, ram):
"""
Sets amount of RAM allocated to this router
:param ram: amount of RAM in Mbytes (integer)
"""
if self._ram == ram:
return
yield from self._hypervisor.send('vm set_ram "{name}" {ram}'.format(name=self._name, ram=ram))
log.... | python | def set_ram(self, ram):
"""
Sets amount of RAM allocated to this router
:param ram: amount of RAM in Mbytes (integer)
"""
if self._ram == ram:
return
yield from self._hypervisor.send('vm set_ram "{name}" {ram}'.format(name=self._name, ram=ram))
log.... | [
"def",
"set_ram",
"(",
"self",
",",
"ram",
")",
":",
"if",
"self",
".",
"_ram",
"==",
"ram",
":",
"return",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_ram \"{name}\" {ram}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_... | Sets amount of RAM allocated to this router
:param ram: amount of RAM in Mbytes (integer) | [
"Sets",
"amount",
"of",
"RAM",
"allocated",
"to",
"this",
"router"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L520-L535 |
226,472 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_nvram | def set_nvram(self, nvram):
"""
Sets amount of NVRAM allocated to this router
:param nvram: amount of NVRAM in Kbytes (integer)
"""
if self._nvram == nvram:
return
yield from self._hypervisor.send('vm set_nvram "{name}" {nvram}'.format(name=self._name, nvra... | python | def set_nvram(self, nvram):
"""
Sets amount of NVRAM allocated to this router
:param nvram: amount of NVRAM in Kbytes (integer)
"""
if self._nvram == nvram:
return
yield from self._hypervisor.send('vm set_nvram "{name}" {nvram}'.format(name=self._name, nvra... | [
"def",
"set_nvram",
"(",
"self",
",",
"nvram",
")",
":",
"if",
"self",
".",
"_nvram",
"==",
"nvram",
":",
"return",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_nvram \"{name}\" {nvram}'",
".",
"format",
"(",
"name",
"=",
"self",... | Sets amount of NVRAM allocated to this router
:param nvram: amount of NVRAM in Kbytes (integer) | [
"Sets",
"amount",
"of",
"NVRAM",
"allocated",
"to",
"this",
"router"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L548-L563 |
226,473 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_clock_divisor | def set_clock_divisor(self, clock_divisor):
"""
Sets the clock divisor value. The higher is the value, the faster is the clock in the
virtual machine. The default is 4, but it is often required to adjust it.
:param clock_divisor: clock divisor value (integer)
"""
yield ... | python | def set_clock_divisor(self, clock_divisor):
"""
Sets the clock divisor value. The higher is the value, the faster is the clock in the
virtual machine. The default is 4, but it is often required to adjust it.
:param clock_divisor: clock divisor value (integer)
"""
yield ... | [
"def",
"set_clock_divisor",
"(",
"self",
",",
"clock_divisor",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_clock_divisor \"{name}\" {clock}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"clock",
"=",
"cloc... | Sets the clock divisor value. The higher is the value, the faster is the clock in the
virtual machine. The default is 4, but it is often required to adjust it.
:param clock_divisor: clock divisor value (integer) | [
"Sets",
"the",
"clock",
"divisor",
"value",
".",
"The",
"higher",
"is",
"the",
"value",
"the",
"faster",
"is",
"the",
"clock",
"in",
"the",
"virtual",
"machine",
".",
"The",
"default",
"is",
"4",
"but",
"it",
"is",
"often",
"required",
"to",
"adjust",
... | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L638-L651 |
226,474 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.get_idle_pc_prop | def get_idle_pc_prop(self):
"""
Gets the idle PC proposals.
Takes 1000 measurements and records up to 10 idle PC proposals.
There is a 10ms wait between each measurement.
:returns: list of idle PC proposal
"""
is_running = yield from self.is_running()
wa... | python | def get_idle_pc_prop(self):
"""
Gets the idle PC proposals.
Takes 1000 measurements and records up to 10 idle PC proposals.
There is a 10ms wait between each measurement.
:returns: list of idle PC proposal
"""
is_running = yield from self.is_running()
wa... | [
"def",
"get_idle_pc_prop",
"(",
"self",
")",
":",
"is_running",
"=",
"yield",
"from",
"self",
".",
"is_running",
"(",
")",
"was_auto_started",
"=",
"False",
"if",
"not",
"is_running",
":",
"yield",
"from",
"self",
".",
"start",
"(",
")",
"was_auto_started",
... | Gets the idle PC proposals.
Takes 1000 measurements and records up to 10 idle PC proposals.
There is a 10ms wait between each measurement.
:returns: list of idle PC proposal | [
"Gets",
"the",
"idle",
"PC",
"proposals",
".",
"Takes",
"1000",
"measurements",
"and",
"records",
"up",
"to",
"10",
"idle",
"PC",
"proposals",
".",
"There",
"is",
"a",
"10ms",
"wait",
"between",
"each",
"measurement",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L685-L709 |
226,475 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_idlemax | def set_idlemax(self, idlemax):
"""
Sets CPU idle max value
:param idlemax: idle max value (integer)
"""
is_running = yield from self.is_running()
if is_running: # router is running
yield from self._hypervisor.send('vm set_idle_max "{name}" 0 {idlemax}'.for... | python | def set_idlemax(self, idlemax):
"""
Sets CPU idle max value
:param idlemax: idle max value (integer)
"""
is_running = yield from self.is_running()
if is_running: # router is running
yield from self._hypervisor.send('vm set_idle_max "{name}" 0 {idlemax}'.for... | [
"def",
"set_idlemax",
"(",
"self",
",",
"idlemax",
")",
":",
"is_running",
"=",
"yield",
"from",
"self",
".",
"is_running",
"(",
")",
"if",
"is_running",
":",
"# router is running",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_idle... | Sets CPU idle max value
:param idlemax: idle max value (integer) | [
"Sets",
"CPU",
"idle",
"max",
"value"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L738-L754 |
226,476 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_idlesleep | def set_idlesleep(self, idlesleep):
"""
Sets CPU idle sleep time value.
:param idlesleep: idle sleep value (integer)
"""
is_running = yield from self.is_running()
if is_running: # router is running
yield from self._hypervisor.send('vm set_idle_sleep_time "{... | python | def set_idlesleep(self, idlesleep):
"""
Sets CPU idle sleep time value.
:param idlesleep: idle sleep value (integer)
"""
is_running = yield from self.is_running()
if is_running: # router is running
yield from self._hypervisor.send('vm set_idle_sleep_time "{... | [
"def",
"set_idlesleep",
"(",
"self",
",",
"idlesleep",
")",
":",
"is_running",
"=",
"yield",
"from",
"self",
".",
"is_running",
"(",
")",
"if",
"is_running",
":",
"# router is running",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_... | Sets CPU idle sleep time value.
:param idlesleep: idle sleep value (integer) | [
"Sets",
"CPU",
"idle",
"sleep",
"time",
"value",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L767-L784 |
226,477 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_ghost_file | def set_ghost_file(self, ghost_file):
"""
Sets ghost RAM file
:ghost_file: path to ghost file
"""
yield from self._hypervisor.send('vm set_ghost_file "{name}" {ghost_file}'.format(name=self._name,
... | python | def set_ghost_file(self, ghost_file):
"""
Sets ghost RAM file
:ghost_file: path to ghost file
"""
yield from self._hypervisor.send('vm set_ghost_file "{name}" {ghost_file}'.format(name=self._name,
... | [
"def",
"set_ghost_file",
"(",
"self",
",",
"ghost_file",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_ghost_file \"{name}\" {ghost_file}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"ghost_file",
"=",
"shl... | Sets ghost RAM file
:ghost_file: path to ghost file | [
"Sets",
"ghost",
"RAM",
"file"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L797-L811 |
226,478 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.formatted_ghost_file | def formatted_ghost_file(self):
"""
Returns a properly formatted ghost file name.
:returns: formatted ghost_file name (string)
"""
# replace specials characters in 'drive:\filename' in Linux and Dynamips in MS Windows or viceversa.
ghost_file = "{}-{}.ghost".format(os.p... | python | def formatted_ghost_file(self):
"""
Returns a properly formatted ghost file name.
:returns: formatted ghost_file name (string)
"""
# replace specials characters in 'drive:\filename' in Linux and Dynamips in MS Windows or viceversa.
ghost_file = "{}-{}.ghost".format(os.p... | [
"def",
"formatted_ghost_file",
"(",
"self",
")",
":",
"# replace specials characters in 'drive:\\filename' in Linux and Dynamips in MS Windows or viceversa.",
"ghost_file",
"=",
"\"{}-{}.ghost\"",
".",
"format",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"self",
".",
"_i... | Returns a properly formatted ghost file name.
:returns: formatted ghost_file name (string) | [
"Returns",
"a",
"properly",
"formatted",
"ghost",
"file",
"name",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L813-L823 |
226,479 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_ghost_status | def set_ghost_status(self, ghost_status):
"""
Sets ghost RAM status
:param ghost_status: state flag indicating status
0 => Do not use IOS ghosting
1 => This is a ghost instance
2 => Use an existing ghost instance
"""
yield from self._hypervisor.send('vm ... | python | def set_ghost_status(self, ghost_status):
"""
Sets ghost RAM status
:param ghost_status: state flag indicating status
0 => Do not use IOS ghosting
1 => This is a ghost instance
2 => Use an existing ghost instance
"""
yield from self._hypervisor.send('vm ... | [
"def",
"set_ghost_status",
"(",
"self",
",",
"ghost_status",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_ghost_status \"{name}\" {ghost_status}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"ghost_status",
"... | Sets ghost RAM status
:param ghost_status: state flag indicating status
0 => Do not use IOS ghosting
1 => This is a ghost instance
2 => Use an existing ghost instance | [
"Sets",
"ghost",
"RAM",
"status"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L835-L851 |
226,480 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_console | def set_console(self, console):
"""
Sets the TCP console port.
:param console: console port (integer)
"""
self.console = console
yield from self._hypervisor.send('vm set_con_tcp_port "{name}" {console}'.format(name=self._name, console=self.console)) | python | def set_console(self, console):
"""
Sets the TCP console port.
:param console: console port (integer)
"""
self.console = console
yield from self._hypervisor.send('vm set_con_tcp_port "{name}" {console}'.format(name=self._name, console=self.console)) | [
"def",
"set_console",
"(",
"self",
",",
"console",
")",
":",
"self",
".",
"console",
"=",
"console",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_con_tcp_port \"{name}\" {console}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_... | Sets the TCP console port.
:param console: console port (integer) | [
"Sets",
"the",
"TCP",
"console",
"port",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L960-L968 |
226,481 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_aux | def set_aux(self, aux):
"""
Sets the TCP auxiliary port.
:param aux: console auxiliary port (integer)
"""
self.aux = aux
yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=aux)) | python | def set_aux(self, aux):
"""
Sets the TCP auxiliary port.
:param aux: console auxiliary port (integer)
"""
self.aux = aux
yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=aux)) | [
"def",
"set_aux",
"(",
"self",
",",
"aux",
")",
":",
"self",
".",
"aux",
"=",
"aux",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm set_aux_tcp_port \"{name}\" {aux}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"aux... | Sets the TCP auxiliary port.
:param aux: console auxiliary port (integer) | [
"Sets",
"the",
"TCP",
"auxiliary",
"port",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L971-L979 |
226,482 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.get_cpu_usage | def get_cpu_usage(self, cpu_id=0):
"""
Shows cpu usage in seconds, "cpu_id" is ignored.
:returns: cpu usage in seconds
"""
cpu_usage = yield from self._hypervisor.send('vm cpu_usage "{name}" {cpu_id}'.format(name=self._name, cpu_id=cpu_id))
return int(cpu_usage[0]) | python | def get_cpu_usage(self, cpu_id=0):
"""
Shows cpu usage in seconds, "cpu_id" is ignored.
:returns: cpu usage in seconds
"""
cpu_usage = yield from self._hypervisor.send('vm cpu_usage "{name}" {cpu_id}'.format(name=self._name, cpu_id=cpu_id))
return int(cpu_usage[0]) | [
"def",
"get_cpu_usage",
"(",
"self",
",",
"cpu_id",
"=",
"0",
")",
":",
"cpu_usage",
"=",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm cpu_usage \"{name}\" {cpu_id}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"cpu_... | Shows cpu usage in seconds, "cpu_id" is ignored.
:returns: cpu usage in seconds | [
"Shows",
"cpu",
"usage",
"in",
"seconds",
"cpu_id",
"is",
"ignored",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L982-L990 |
226,483 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_mac_addr | def set_mac_addr(self, mac_addr):
"""
Sets the MAC address.
:param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh)
"""
yield from self._hypervisor.send('{platform} set_mac_addr "{name}" {mac_addr}'.format(platform=self._platform,
... | python | def set_mac_addr(self, mac_addr):
"""
Sets the MAC address.
:param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh)
"""
yield from self._hypervisor.send('{platform} set_mac_addr "{name}" {mac_addr}'.format(platform=self._platform,
... | [
"def",
"set_mac_addr",
"(",
"self",
",",
"mac_addr",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'{platform} set_mac_addr \"{name}\" {mac_addr}'",
".",
"format",
"(",
"platform",
"=",
"self",
".",
"_platform",
",",
"name",
"=",
"s... | Sets the MAC address.
:param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh) | [
"Sets",
"the",
"MAC",
"address",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1003-L1018 |
226,484 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_system_id | def set_system_id(self, system_id):
"""
Sets the system ID.
:param system_id: a system ID (also called board processor ID)
"""
yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform,
... | python | def set_system_id(self, system_id):
"""
Sets the system ID.
:param system_id: a system ID (also called board processor ID)
"""
yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform,
... | [
"def",
"set_system_id",
"(",
"self",
",",
"system_id",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'{platform} set_system_id \"{name}\" {system_id}'",
".",
"format",
"(",
"platform",
"=",
"self",
".",
"_platform",
",",
"name",
"=",
... | Sets the system ID.
:param system_id: a system ID (also called board processor ID) | [
"Sets",
"the",
"system",
"ID",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1031-L1046 |
226,485 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.get_slot_bindings | def get_slot_bindings(self):
"""
Returns slot bindings.
:returns: slot bindings (adapter names) list
"""
slot_bindings = yield from self._hypervisor.send('vm slot_bindings "{}"'.format(self._name))
return slot_bindings | python | def get_slot_bindings(self):
"""
Returns slot bindings.
:returns: slot bindings (adapter names) list
"""
slot_bindings = yield from self._hypervisor.send('vm slot_bindings "{}"'.format(self._name))
return slot_bindings | [
"def",
"get_slot_bindings",
"(",
"self",
")",
":",
"slot_bindings",
"=",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm slot_bindings \"{}\"'",
".",
"format",
"(",
"self",
".",
"_name",
")",
")",
"return",
"slot_bindings"
] | Returns slot bindings.
:returns: slot bindings (adapter names) list | [
"Returns",
"slot",
"bindings",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1049-L1057 |
226,486 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.uninstall_wic | def uninstall_wic(self, wic_slot_number):
"""
Uninstalls a WIC adapter from this router.
:param wic_slot_number: WIC slot number
"""
# WICs are always installed on adapters in slot 0
slot_number = 0
# Do not check if slot has an adapter because adapters with WI... | python | def uninstall_wic(self, wic_slot_number):
"""
Uninstalls a WIC adapter from this router.
:param wic_slot_number: WIC slot number
"""
# WICs are always installed on adapters in slot 0
slot_number = 0
# Do not check if slot has an adapter because adapters with WI... | [
"def",
"uninstall_wic",
"(",
"self",
",",
"wic_slot_number",
")",
":",
"# WICs are always installed on adapters in slot 0",
"slot_number",
"=",
"0",
"# Do not check if slot has an adapter because adapters with WICs interfaces",
"# must be inserted by default in the router and cannot be rem... | Uninstalls a WIC adapter from this router.
:param wic_slot_number: WIC slot number | [
"Uninstalls",
"a",
"WIC",
"adapter",
"from",
"this",
"router",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1193-L1224 |
226,487 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.get_slot_nio_bindings | def get_slot_nio_bindings(self, slot_number):
"""
Returns slot NIO bindings.
:param slot_number: slot number
:returns: list of NIO bindings
"""
nio_bindings = yield from self._hypervisor.send('vm slot_nio_bindings "{name}" {slot_number}'.format(name=self._name,
... | python | def get_slot_nio_bindings(self, slot_number):
"""
Returns slot NIO bindings.
:param slot_number: slot number
:returns: list of NIO bindings
"""
nio_bindings = yield from self._hypervisor.send('vm slot_nio_bindings "{name}" {slot_number}'.format(name=self._name,
... | [
"def",
"get_slot_nio_bindings",
"(",
"self",
",",
"slot_number",
")",
":",
"nio_bindings",
"=",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'vm slot_nio_bindings \"{name}\" {slot_number}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",... | Returns slot NIO bindings.
:param slot_number: slot number
:returns: list of NIO bindings | [
"Returns",
"slot",
"NIO",
"bindings",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1227-L1238 |
226,488 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.slot_add_nio_binding | def slot_add_nio_binding(self, slot_number, port_number, nio):
"""
Adds a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:param nio: NIO instance to add to the slot/port
"""
try:
adapter = self._slots[slot_number]
... | python | def slot_add_nio_binding(self, slot_number, port_number, nio):
"""
Adds a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:param nio: NIO instance to add to the slot/port
"""
try:
adapter = self._slots[slot_number]
... | [
"def",
"slot_add_nio_binding",
"(",
"self",
",",
"slot_number",
",",
"port_number",
",",
"nio",
")",
":",
"try",
":",
"adapter",
"=",
"self",
".",
"_slots",
"[",
"slot_number",
"]",
"except",
"IndexError",
":",
"raise",
"DynamipsError",
"(",
"'Slot {slot_numbe... | Adds a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:param nio: NIO instance to add to the slot/port | [
"Adds",
"a",
"slot",
"NIO",
"binding",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1241-L1285 |
226,489 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.slot_remove_nio_binding | def slot_remove_nio_binding(self, slot_number, port_number):
"""
Removes a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:returns: removed NIO instance
"""
try:
adapter = self._slots[slot_number]
except In... | python | def slot_remove_nio_binding(self, slot_number, port_number):
"""
Removes a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:returns: removed NIO instance
"""
try:
adapter = self._slots[slot_number]
except In... | [
"def",
"slot_remove_nio_binding",
"(",
"self",
",",
"slot_number",
",",
"port_number",
")",
":",
"try",
":",
"adapter",
"=",
"self",
".",
"_slots",
"[",
"slot_number",
"]",
"except",
"IndexError",
":",
"raise",
"DynamipsError",
"(",
"'Slot {slot_number} does not e... | Removes a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:returns: removed NIO instance | [
"Removes",
"a",
"slot",
"NIO",
"binding",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1299-L1339 |
226,490 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.slot_enable_nio | def slot_enable_nio(self, slot_number, port_number):
"""
Enables a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
"""
is_running = yield from self.is_running()
if is_running: # running router
yield from self._hyper... | python | def slot_enable_nio(self, slot_number, port_number):
"""
Enables a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
"""
is_running = yield from self.is_running()
if is_running: # running router
yield from self._hyper... | [
"def",
"slot_enable_nio",
"(",
"self",
",",
"slot_number",
",",
"port_number",
")",
":",
"is_running",
"=",
"yield",
"from",
"self",
".",
"is_running",
"(",
")",
"if",
"is_running",
":",
"# running router",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"... | Enables a slot NIO binding.
:param slot_number: slot number
:param port_number: port number | [
"Enables",
"a",
"slot",
"NIO",
"binding",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1342-L1359 |
226,491 | GNS3/gns3-server | gns3server/compute/dynamips/nodes/router.py | Router.set_name | def set_name(self, new_name):
"""
Renames this router.
:param new_name: new name string
"""
# change the hostname in the startup-config
if os.path.isfile(self.startup_config_path):
try:
with open(self.startup_config_path, "r+", encoding="utf-... | python | def set_name(self, new_name):
"""
Renames this router.
:param new_name: new name string
"""
# change the hostname in the startup-config
if os.path.isfile(self.startup_config_path):
try:
with open(self.startup_config_path, "r+", encoding="utf-... | [
"def",
"set_name",
"(",
"self",
",",
"new_name",
")",
":",
"# change the hostname in the startup-config",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"startup_config_path",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"startup_config_p... | Renames this router.
:param new_name: new name string | [
"Renames",
"this",
"router",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1495-L1526 |
226,492 | GNS3/gns3-server | gns3server/utils/__init__.py | parse_version | def parse_version(version):
"""
Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0
Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple
:returns: Version string as comparable tuple
"""
r... | python | def parse_version(version):
"""
Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0
Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple
:returns: Version string as comparable tuple
"""
r... | [
"def",
"parse_version",
"(",
"version",
")",
":",
"release_type_found",
"=",
"False",
"version_infos",
"=",
"re",
".",
"split",
"(",
"'(\\.|[a-z]+)'",
",",
"version",
")",
"version",
"=",
"[",
"]",
"for",
"info",
"in",
"version_infos",
":",
"if",
"info",
"... | Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0
Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple
:returns: Version string as comparable tuple | [
"Return",
"a",
"comparable",
"tuple",
"from",
"a",
"version",
"string",
".",
"We",
"try",
"to",
"force",
"tuple",
"to",
"semver",
"with",
"version",
"like",
"1",
".",
"2",
".",
"0"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/__init__.py#L52-L90 |
226,493 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM._look_for_interface | def _look_for_interface(self, network_backend):
"""
Look for an interface with a specific network backend.
:returns: interface number or -1 if none is found
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
interface = -1
f... | python | def _look_for_interface(self, network_backend):
"""
Look for an interface with a specific network backend.
:returns: interface number or -1 if none is found
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
interface = -1
f... | [
"def",
"_look_for_interface",
"(",
"self",
",",
"network_backend",
")",
":",
"result",
"=",
"yield",
"from",
"self",
".",
"_execute",
"(",
"\"showvminfo\"",
",",
"[",
"self",
".",
"_vmname",
",",
"\"--machinereadable\"",
"]",
")",
"interface",
"=",
"-",
"1",... | Look for an interface with a specific network backend.
:returns: interface number or -1 if none is found | [
"Look",
"for",
"an",
"interface",
"with",
"a",
"specific",
"network",
"backend",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L68-L86 |
226,494 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM._look_for_vboxnet | def _look_for_vboxnet(self, interface_number):
"""
Look for the VirtualBox network name associated with a host only interface.
:returns: None or vboxnet name
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
for info in result.spli... | python | def _look_for_vboxnet(self, interface_number):
"""
Look for the VirtualBox network name associated with a host only interface.
:returns: None or vboxnet name
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
for info in result.spli... | [
"def",
"_look_for_vboxnet",
"(",
"self",
",",
"interface_number",
")",
":",
"result",
"=",
"yield",
"from",
"self",
".",
"_execute",
"(",
"\"showvminfo\"",
",",
"[",
"self",
".",
"_vmname",
",",
"\"--machinereadable\"",
"]",
")",
"for",
"info",
"in",
"result... | Look for the VirtualBox network name associated with a host only interface.
:returns: None or vboxnet name | [
"Look",
"for",
"the",
"VirtualBox",
"network",
"name",
"associated",
"with",
"a",
"host",
"only",
"interface",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L89-L102 |
226,495 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM._check_dhcp_server | def _check_dhcp_server(self, vboxnet):
"""
Check if the DHCP server associated with a vboxnet is enabled.
:param vboxnet: vboxnet name
:returns: boolean
"""
properties = yield from self._execute("list", ["dhcpservers"])
flag_dhcp_server_found = False
fo... | python | def _check_dhcp_server(self, vboxnet):
"""
Check if the DHCP server associated with a vboxnet is enabled.
:param vboxnet: vboxnet name
:returns: boolean
"""
properties = yield from self._execute("list", ["dhcpservers"])
flag_dhcp_server_found = False
fo... | [
"def",
"_check_dhcp_server",
"(",
"self",
",",
"vboxnet",
")",
":",
"properties",
"=",
"yield",
"from",
"self",
".",
"_execute",
"(",
"\"list\"",
",",
"[",
"\"dhcpservers\"",
"]",
")",
"flag_dhcp_server_found",
"=",
"False",
"for",
"prop",
"in",
"properties",
... | Check if the DHCP server associated with a vboxnet is enabled.
:param vboxnet: vboxnet name
:returns: boolean | [
"Check",
"if",
"the",
"DHCP",
"server",
"associated",
"with",
"a",
"vboxnet",
"is",
"enabled",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L105-L126 |
226,496 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM._check_vbox_port_forwarding | def _check_vbox_port_forwarding(self):
"""
Checks if the NAT port forwarding rule exists.
:returns: boolean
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
for info in result.splitlines():
if '=' in info:
... | python | def _check_vbox_port_forwarding(self):
"""
Checks if the NAT port forwarding rule exists.
:returns: boolean
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
for info in result.splitlines():
if '=' in info:
... | [
"def",
"_check_vbox_port_forwarding",
"(",
"self",
")",
":",
"result",
"=",
"yield",
"from",
"self",
".",
"_execute",
"(",
"\"showvminfo\"",
",",
"[",
"self",
".",
"_vmname",
",",
"\"--machinereadable\"",
"]",
")",
"for",
"info",
"in",
"result",
".",
"splitl... | Checks if the NAT port forwarding rule exists.
:returns: boolean | [
"Checks",
"if",
"the",
"NAT",
"port",
"forwarding",
"rule",
"exists",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L129-L142 |
226,497 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM.start | def start(self):
"""
Start the GNS3 VM.
"""
# get a NAT interface number
nat_interface_number = yield from self._look_for_interface("nat")
if nat_interface_number < 0:
raise GNS3VMError("The GNS3 VM: {} must have a NAT interface configured in order to start".... | python | def start(self):
"""
Start the GNS3 VM.
"""
# get a NAT interface number
nat_interface_number = yield from self._look_for_interface("nat")
if nat_interface_number < 0:
raise GNS3VMError("The GNS3 VM: {} must have a NAT interface configured in order to start".... | [
"def",
"start",
"(",
"self",
")",
":",
"# get a NAT interface number",
"nat_interface_number",
"=",
"yield",
"from",
"self",
".",
"_look_for_interface",
"(",
"\"nat\"",
")",
"if",
"nat_interface_number",
"<",
"0",
":",
"raise",
"GNS3VMError",
"(",
"\"The GNS3 VM: {}... | Start the GNS3 VM. | [
"Start",
"the",
"GNS3",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L153-L212 |
226,498 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM._get_ip | def _get_ip(self, hostonly_interface_number, api_port):
"""
Get the IP from VirtualBox.
Due to VirtualBox limitation the only way is to send request each
second to a GNS3 endpoint in order to get the list of the interfaces and
their IP and after that match it with VirtualBox hos... | python | def _get_ip(self, hostonly_interface_number, api_port):
"""
Get the IP from VirtualBox.
Due to VirtualBox limitation the only way is to send request each
second to a GNS3 endpoint in order to get the list of the interfaces and
their IP and after that match it with VirtualBox hos... | [
"def",
"_get_ip",
"(",
"self",
",",
"hostonly_interface_number",
",",
"api_port",
")",
":",
"remaining_try",
"=",
"300",
"while",
"remaining_try",
">",
"0",
":",
"json_data",
"=",
"None",
"session",
"=",
"aiohttp",
".",
"ClientSession",
"(",
")",
"try",
":",... | Get the IP from VirtualBox.
Due to VirtualBox limitation the only way is to send request each
second to a GNS3 endpoint in order to get the list of the interfaces and
their IP and after that match it with VirtualBox host only. | [
"Get",
"the",
"IP",
"from",
"VirtualBox",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L215-L250 |
226,499 | GNS3/gns3-server | gns3server/controller/gns3vm/virtualbox_gns3_vm.py | VirtualBoxGNS3VM.stop | def stop(self):
"""
Stops the GNS3 VM.
"""
vm_state = yield from self._get_state()
if vm_state == "poweroff":
self.running = False
return
yield from self._execute("controlvm", [self._vmname, "acpipowerbutton"], timeout=3)
trial = 120
... | python | def stop(self):
"""
Stops the GNS3 VM.
"""
vm_state = yield from self._get_state()
if vm_state == "poweroff":
self.running = False
return
yield from self._execute("controlvm", [self._vmname, "acpipowerbutton"], timeout=3)
trial = 120
... | [
"def",
"stop",
"(",
"self",
")",
":",
"vm_state",
"=",
"yield",
"from",
"self",
".",
"_get_state",
"(",
")",
"if",
"vm_state",
"==",
"\"poweroff\"",
":",
"self",
".",
"running",
"=",
"False",
"return",
"yield",
"from",
"self",
".",
"_execute",
"(",
"\"... | Stops the GNS3 VM. | [
"Stops",
"the",
"GNS3",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L263-L290 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.