XM list source code analysis

Source: Internet
Author: User

XM list source code analysis

Xenapi. py: 442 parseserver ():


Read the configuration from/etc/xen/xm-config.xml and get
Servertype: xen-API Serveruri: http: // localhost: 9363/ Username: Me Password: mypassword

Python \ xen \ XM \ main. py: 2979
2979: Main () determines whether to print help
2956: xm_lookup_cmd () Find the function corresponding to the command --> xm_list ()
3003: _ run_cmd according to servertype:
If xen-API:
Server = xenapi. Session (serveruri)
Parseauthentication ()
* Server. login_with_password ()
If XMLRPC: Server = serverproxy (serveruri) <------ Xmlrpclib. serverproxy
Jump to xm_list () and execute

Python \ xen \ XM \ main. py: 853 xm_list ()
Command Line Parameter Parsing
If show_vcpus --> jumps to xm_vcpu_list ()
801: getdomains ()
If xen-API:
* All VMS: Server. xenapi. VM. get_all_records ()
* Metrics of all VMS: Server. xenapi. vm_metrics.get_all_records ()
Obtain information about all virtual machines based on the two.
Filter and convert the parameter to the SXP format map2sxp Based on the VM name
If XMLRPC:
Server. xend. domain (DOM, full)
Or server. xend. domains_with_state (true, state, full)
If the -- long parameter map (prettyprint. prettyprint, DOMS)
If the -- Label Parameter
Xm_label_list-> parse_doms_info-> server. xend. Security. get_domain_label-> output
Otherwise: xm_brief_list-> parse_doms_info-> output

* server. login_with_password () logon process:
getattr (self, 'session. % s' % method) (* Params) --> _ getattr _ --> xmlrpcclient. serverproxy. _ getattr _ (self, name) --> xmlprc server execution
* All VMS: Server. xenapi. VM. get_all_records () Process
using XM. xenapi (xmlrpcclient) sends an RPC request to the server
xmlprcserver. the handler server registered on the py server. register_instance (xendapi. xendapiasyncproxy (self. xenapi ))-----> Synchronous interface ??
Create and start a task using xendtaskmanager. The specific processing is in xendapi.
VM. get_all_records obtains all UUID through _ get_all_records (): vm_get_all (), and obtains the final information based on UUID and vm_get_record (). O (N * n)

Vm_get_all (): xenddomain. instance (). list ('all') to get all UUID update domains (data in xen store daemon needs to be updated) traverse domains and managed_domains cyclically to get the uuid vm_get_record (): xenddomain of all virtual machines. instance (). get_vm_by_uuid () cyclically traverses domains and managed_domains. If the uuid is the same, the output is Note: Domains andThe managed_domains information is overlapped. You can use UUID as the key to obtain the dictionary values. HoweverProgramAnd then compare the UUID. Is the uuid stored in values inconsistent with the uuid used as the key ??

* Vm_metrics requests are forwarded to xendv1_rics.
Call the GET _ * method of xendvmmetrics to merge to obtain metrics.

Related Classes:

VM: A Virtual Machine (or 'guest ')
VM metrics: the metrics associated with a VM

Libxc

Libxc (libxenctrl): libxc is a C language library. It provides easy-to-use APIs that allow your programs to communicate with hypervisor conveniently. It mainly encapsulates/proc/xen/privcmd,/dev/xen/evtchn in dom0, and IOCTL interfaces provided by/dev/xen/gntdev.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.