本文整理匯總了Python中gns3server.compute.vmware.VMware.instance方法的典型用法代碼示例。如果您正苦於以下問題:Python VMware.instance方法的具體用法?Python VMware.instance怎麽用?Python VMware.instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gns3server.compute.vmware.VMware
的用法示例。
在下文中一共展示了VMware.instance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: stop_capture
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def stop_capture(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
yield from vm.stop_capture(adapter_number)
response.set_status(204)
示例2: stream_pcap_file
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
async def stream_pcap_file(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
nio = vm.get_nio(adapter_number)
await vmware_manager.stream_pcap_file(nio, vm.project.id, request, response)
示例3: delete_nio
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
async def delete_nio(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
await vm.adapter_remove_nio_binding(adapter_number)
response.set_status(204)
示例4: start_capture
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def start_capture(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
pcap_file_path = os.path.join(vm.project.capture_working_directory(), request.json["capture_file_name"])
yield from vm.start_capture(adapter_number, pcap_file_path)
response.json({"pcap_file_path": pcap_file_path})
示例5: allocate_vmnet
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def allocate_vmnet(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
vmware_manager.refresh_vmnet_list(ubridge=False)
vmnet = vmware_manager.allocate_vmnet()
vm.vmnets.append(vmnet)
response.set_status(201)
response.json({"vmnet": vmnet})
示例6: update_nio
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def update_nio(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = vm.ethernet_adapters[int(request.match_info["adapter_number"])]
if "filters" in request.json and nio:
nio.filters = request.json["filters"]
yield from vm.adapter_update_nio_binding(int(request.match_info["adapter_number"]), nio)
response.set_status(201)
response.json(request.json)
示例7: start
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def start(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
if vm.check_hw_virtualization():
pm = ProjectManager.instance()
if pm.check_hardware_virtualization(vm) is False:
raise HTTPConflict(text="Cannot start VM because hardware virtualization (VT-x/AMD-V) is already used by another software like VirtualBox or KVM (on Linux)")
yield from vm.start()
response.set_status(204)
示例8: update
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def update(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
for name, value in request.json.items():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
vm.updated()
response.json(vm)
示例9: update_nio
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
async def update_nio(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
adapter_number = int(request.match_info["adapter_number"])
nio = vm.get_nio(adapter_number)
if "filters" in request.json:
nio.filters = request.json["filters"]
await vm.adapter_update_nio_binding(adapter_number, nio)
response.set_status(201)
response.json(request.json)
示例10: create_nio
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def create_nio(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio_type = request.json["type"]
if nio_type not in ("nio_udp", "nio_vmnet", "nio_nat", "nio_tap"):
raise HTTPConflict(text="NIO of type {} is not supported".format(nio_type))
nio = vmware_manager.create_nio(request.json)
yield from vm.adapter_add_nio_binding(int(request.match_info["adapter_number"]), nio)
response.set_status(201)
response.json(nio)
示例11: update
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def update(request, response):
vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
# update the console first to avoid issue if updating console type
vm.console = request.json.pop("console", vm.console)
for name, value in request.json.items():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
vm.updated()
response.json(vm)
示例12: create
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def create(request, response):
vmware_manager = VMware.instance()
vm = yield from vmware_manager.create_node(request.json.pop("name"),
request.match_info["project_id"],
request.json.get("node_id"),
request.json.pop("vmx_path"),
linked_clone=request.json.pop("linked_clone"),
console=request.json.get("console", None))
for name, value in request.json.items():
if name != "node_id":
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
response.set_status(201)
response.json(vm)
示例13: get_vms
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def get_vms(request, response):
vmware_manager = VMware.instance()
vms = yield from vmware_manager.list_vms()
response.json(vms)
示例14: get_vms
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
async def get_vms(request, response):
vmware_manager = VMware.instance()
vms = await vmware_manager.list_vms()
response.json(vms)
示例15: delete
# 需要導入模塊: from gns3server.compute.vmware import VMware [as 別名]
# 或者: from gns3server.compute.vmware.VMware import instance [as 別名]
def delete(request, response):
# check the project_id exists
ProjectManager.instance().get_project(request.match_info["project_id"])
yield from VMware.instance().delete_node(request.match_info["node_id"])
response.set_status(204)