VM_build micro-op
Overview
On Xen, Xenctrl.domain_create
creates an empty domain and
returns the domain ID (domid
) of the new domain to xenopsd
.
In the build
phase, the xenguest
program is called to create
the system memory layout of the domain, set vCPU affinity and a
lot more.
The VM_build micro-op collects the VM build parameters and calls VM.build, which calls VM.build_domain, which calls VM.build_domain_exn which calls Domain.build:
flowchart subgraph xenopsd VM_build[xenopsd: VM_build micro#8209;op] direction LR VM_build --> VM.build VM.build --> VM.build_domain VM.build_domain --> VM.build_domain_exn VM.build_domain_exn --> Domain.build click VM_build " https://github.com/xapi-project/xen-api/blob/83555067/ocaml/xenopsd/lib/xenops_server.ml#L2255-L2271" _blank click VM.build " https://github.com/xapi-project/xen-api/blob/83555067/ocaml/xenopsd/xc/xenops_server_xen.ml#L2290-L2291" _blank click VM.build_domain " https://github.com/xapi-project/xen-api/blob/83555067/ocaml/xenopsd/xc/xenops_server_xen.ml#L2250-L2288" _blank click VM.build_domain_exn " https://github.com/xapi-project/xen-api/blob/83555067/ocaml/xenopsd/xc/xenops_server_xen.ml#L2024-L2248" _blank click Domain.build " https://github.com/xapi-project/xen-api/blob/83555067/ocaml/xenopsd/xc/domain.ml#L1111-L1210" _blank end
The function VM.build_domain_exn must:
Run pygrub (or eliloader) to extract the kernel and initrd, if necessary
Call Domain.build to
- optionally run NUMA placement and
- invoke xenguest to set up the domain memory.
See the walk-through of the Domain.build function for more details on this phase.
Apply the
cpuid
configurationStore the current domain configuration on disk – it’s important to know the difference between the configuration you started with and the configuration you would use after a reboot because some properties (such as maximum memory and vCPUs) as fixed on create.