m create对应的Xen-API
vcpu-list:
server.xenapi.VM.get_all()
server.xenapi.VM.get_record
server.xenapi.VM_metrics.get_record
server.xend.domains_with_state(False, 'all', False)
server.xend.domain.getVCPUInfo
对power_state过滤,得到最终的b----状态
console:
console.execConsole(domid)
xen.util.auxbin.execute("xenconsole", [str(domid)])
执行 /usr/lib64/xen/bin/xenconsole domid命令
VNC:
console.runVncViewer(domid, vncviewer_autopass, True)
从xenstore中读:/local/domain/domid/device/vfb/0/backend/vnclisten
/local/domain/domid/console/vnc-port
执行vncviewer localhost:58
start:
server.xenapi.VM.start(domid, paused)
或server.xend.domain(dom)
delete:
server.xenapi.VM.destroy(domid)
或server.xend.domain.delete(dom)
suspend:
server.xenapi.VM.suspend(get_single_vm(dom))
resume:
server.xenapi.VM.resume(get_single_vm(dom), paused)
rest:
server.xenapi.VM.hard_reboot(get_single_vm(dom))
pause:
server.xenapi.VM.pause(get_single_vm(dom))
shutdown:
server.xenapi.VM.clean_shutdown(d)
reboot:
server.xenapi.VM.clean_reboot(d)
destroy:
server.xenapi.VM.hard_shutdown(get_single_vm(dom))
rename:
server.xenapi.VM.set_name_label(get_single_vm(args[0]), args[1])
domid:
server.xenapi.VM.get_domid(get_single_vm(name))
domname:
server.xenapi.VM.get_name_label(get_single_vm(name))
vcpu-pin:
server.xenapi.VM.add_to_VCPUs_params_live(
get_single_vm(dom), "cpumap%i" % int(vcpu), cpumap)
mem-max:
server.xenapi.VM.set_memory_static_max(get_single_vm(dom), mem)
mem-set:
server.xenapi.VM.set_memory_dynamic_max_live(get_single_vm(dom),
mem_target)
server.xenapi.VM.set_memory_dynamic_min_live(get_single_vm(dom),
mem_target)
usb-add:(usb-del)
server.xend.domain.usb_add(args[0],args[1])
vcpu-set:
server.xenapi.VM.set_VCPUs_number_live(get_single_vm(dom), vcpus)
xm info:
host_record = server.xenapi.host.get_record(
server.xenapi.session.get_this_host(server.getSession()))
host_cpu_records = map(server.xenapi.host_cpu.get_record, host_record["host_CPUs"])
host_metrics_record = server.xenapi.host_metrics.get_record(host_record["metrics"])
xm uptime:
dom_recs = server.xenapi.VM.get_all_records()
dom_metrics_recs = server.xenapi.VM_metrics.get_all_records()
筛出up_time
xm sysrq:
server.xenapi.VM.send_sysrq(get_single_vm(dom), req)
xm trigger:
server.xenapi.VM.send_trigger(get_single_vm(dom), trigger, vcpu)
xm debug-keys:
server.xenapi.host.send_debug_keys(
server.xenapi.session.get_this_host(server.getSession()),
keys)
xm top:
xentop
xm dmesg:
server.xend.node.dmesg.info()
xm log:
server.xenapi.host.get_log(
server.xenapi.session.get_this_host(server.getSession()))
xm serve:
可以向xend发送一些命令,但还不清楚具体的参数
xm network-list:
server.xenapi.VM.get_VIFs(get_single_vm(dom))
xm block-list:
server.xenapi.VM.get_VBDs(get_single_vm(dom))
xm vtpm-list:
server.xenapi.VM.get_VTPMs(get_single_vm(dom))
xm pci-list:
server.xenapi.VM.get_DPCIs(get_single_vm(dom)
xm pci-list-assignable-devices:
server.xend.nod.pciinfo()
xm scsi-list:
server.xenapi.VM.get_DSCSIs(get_single_vm(dom))
xm block-attach:
server.xenapi.VDI.create(vdi_record)
server.xenapi.VBD.create(vbd_record)
或者server.xend.domain.device_create(dom, vbd)
xm block-configure:
server.xend.domain.device_configure(dom, vbd)
xm network-attach:
server.xenapi.VIF.create(vif_record)
xm pci-attach:
server.xenapi.DPCI.create(dpci_record)
xm scsi-attach:
server.xenapi.DSCSI.create(dscsi_record)
xm vnet-list:
server.xend_vnets()
xm network-show: 只支持 Xen-API
networks = server.xenapi.network.get_all_records()
pifs = server.xenapi.PIF.get_all_records()
vifs = server.xenapi.VIF.get_all_records()
server.xenapi.VM.get_all()
server.xenapi.VM.get_record
server.xenapi.VM_metrics.get_record
server.xend.domains_with_state(False, 'all', False)
server.xend.domain.getVCPUInfo
对power_state过滤,得到最终的b----状态
console:
console.execConsole(domid)
xen.util.auxbin.execute("xenconsole", [str(domid)])
执行 /usr/lib64/xen/bin/xenconsole domid命令
VNC:
console.runVncViewer(domid, vncviewer_autopass, True)
从xenstore中读:/local/domain/domid/device/vfb/0/backend/vnclisten
/local/domain/domid/console/vnc-port
执行vncviewer localhost:58
start:
server.xenapi.VM.start(domid, paused)
或server.xend.domain(dom)
delete:
server.xenapi.VM.destroy(domid)
或server.xend.domain.delete(dom)
suspend:
server.xenapi.VM.suspend(get_single_vm(dom))
resume:
server.xenapi.VM.resume(get_single_vm(dom), paused)
rest:
server.xenapi.VM.hard_reboot(get_single_vm(dom))
pause:
server.xenapi.VM.pause(get_single_vm(dom))
shutdown:
server.xenapi.VM.clean_shutdown(d)
reboot:
server.xenapi.VM.clean_reboot(d)
destroy:
server.xenapi.VM.hard_shutdown(get_single_vm(dom))
rename:
server.xenapi.VM.set_name_label(get_single_vm(args[0]), args[1])
domid:
server.xenapi.VM.get_domid(get_single_vm(name))
domname:
server.xenapi.VM.get_name_label(get_single_vm(name))
vcpu-pin:
server.xenapi.VM.add_to_VCPUs_params_live(
get_single_vm(dom), "cpumap%i" % int(vcpu), cpumap)
mem-max:
server.xenapi.VM.set_memory_static_max(get_single_vm(dom), mem)
mem-set:
server.xenapi.VM.set_memory_dynamic_max_live(get_single_vm(dom),
mem_target)
server.xenapi.VM.set_memory_dynamic_min_live(get_single_vm(dom),
mem_target)
usb-add:(usb-del)
server.xend.domain.usb_add(args[0],args[1])
vcpu-set:
server.xenapi.VM.set_VCPUs_number_live(get_single_vm(dom), vcpus)
xm info:
host_record = server.xenapi.host.get_record(
server.xenapi.session.get_this_host(server.getSession()))
host_cpu_records = map(server.xenapi.host_cpu.get_record, host_record["host_CPUs"])
host_metrics_record = server.xenapi.host_metrics.get_record(host_record["metrics"])
xm uptime:
dom_recs = server.xenapi.VM.get_all_records()
dom_metrics_recs = server.xenapi.VM_metrics.get_all_records()
筛出up_time
xm sysrq:
server.xenapi.VM.send_sysrq(get_single_vm(dom), req)
xm trigger:
server.xenapi.VM.send_trigger(get_single_vm(dom), trigger, vcpu)
xm debug-keys:
server.xenapi.host.send_debug_keys(
server.xenapi.session.get_this_host(server.getSession()),
keys)
xm top:
xentop
xm dmesg:
server.xend.node.dmesg.info()
xm log:
server.xenapi.host.get_log(
server.xenapi.session.get_this_host(server.getSession()))
xm serve:
可以向xend发送一些命令,但还不清楚具体的参数
xm network-list:
server.xenapi.VM.get_VIFs(get_single_vm(dom))
xm block-list:
server.xenapi.VM.get_VBDs(get_single_vm(dom))
xm vtpm-list:
server.xenapi.VM.get_VTPMs(get_single_vm(dom))
xm pci-list:
server.xenapi.VM.get_DPCIs(get_single_vm(dom)
xm pci-list-assignable-devices:
server.xend.nod.pciinfo()
xm scsi-list:
server.xenapi.VM.get_DSCSIs(get_single_vm(dom))
xm block-attach:
server.xenapi.VDI.create(vdi_record)
server.xenapi.VBD.create(vbd_record)
或者server.xend.domain.device_create(dom, vbd)
xm block-configure:
server.xend.domain.device_configure(dom, vbd)
xm network-attach:
server.xenapi.VIF.create(vif_record)
xm pci-attach:
server.xenapi.DPCI.create(dpci_record)
xm scsi-attach:
server.xenapi.DSCSI.create(dscsi_record)
xm vnet-list:
server.xend_vnets()
xm network-show: 只支持 Xen-API
networks = server.xenapi.network.get_all_records()
pifs = server.xenapi.PIF.get_all_records()
vifs = server.xenapi.VIF.get_all_records()
本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2012/01/17/2325023.html,如需转载请自行联系原作者