Creating and Managing Domains with xm
You can use the xm application to create and manage domains.
Connecting to a Domain
You can use xm to connect to a domain or virtual machine:
xm console domain-id
This causes the console to attach to the domain-id's text console.
Creating a Domain
You can use xm to make a domain:
xm create domain001 [-c]
This creates a domain named domain001 with the file residing in the /etc/xen/ directory. The [-c]option aids with troubleshooting by allowing you to connect to the text console.
Saving a Domain
You can use xm to save a domain:
xm save [domain-id] [statefile]
Terminating a Domain ID
You can use xm to terminate a domain-id:
xm destroy [domain-id]
This instantly terminates the domain-id. If you prefer another method of safely terminating your session, you can use the shutdown parameter instead.
Shutting Down a Domain
You can use xm to shut down any domain:
xm shutdown [domain-id] [ -a | -w ]
The [ -a] option shuts down all domains on your system. The [-w] option waits for a domain to completely shut down.
Restoring a Domain
You can use xm to restore a previously saved domain.
xm restore [state-file]
Suspending a Domain
You can use xm to suspend a domain:
xm suspend [domain-id]
Resuming a Domain
You can use xm to resume a previously suspended session:
xm resume [domain-id]
Rebooting a Domain
You can use xm to reboot a domain:
xm reboot [domain-id] [ -a | -w ]
The [ -a] option reboots all domains on your system. The [-w]option waits for a domain to completely reboot. You can control the behavior of the rebooting domain by modifying the on_boot parameter of the xmdomain.cfg file.
Renaming a Domain
You can use xm to assign a new name to an existing domain:
xm rename [domain-name] [new domain-name]
Domain renaming will keep the same settings (same hard disk, same memory, etc.).
Pausing a Domain
You can use xm to pause a domain:
xm pause [domain-id]
Unpausing a Domain
You can use xm to unpause a domain:
xm unpause [domain-id]
This makes the domain available for scheduling by a hypervisor.
Converting a Domain Name to Domain ID
You can use xm to convert a domain name to a domain ID:
xm domid [domain-name]
Converting a Domain ID to Domain Name
You can use xm to convert a domain ID to a domain name:
xm domname [domain-id]
Configuring Memory Allocation
You can use xm to modify a domain's memory allocation:
xm mem-set [domain-id] [count]
Note
You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.
Configuring Maximum Memory
You can use xm to modify a domain's maximum memory:
xm mem-max [domain-id] [count]
You must specify the [count] in megabytes.
Configuring VCPU Count
You can use xm to modify a domain's VCPU count:
xm vcpu-set [domain-id] [count]
You must specify the [count] in megabytes.
Note
You cannot grow a domain's memory beyond the maximum amount you specified when you first created the domain.
Pinning a VCPU
You can use xm to pin a VCPU:
xm vcpu-pin [domain-id] [vcpu] [cpus]
Where [vcpu] is the VCPU that you want to attach to, and [cpus] is the target. Pinning ensures that certain VCPUs can only run on certain CPUs.
Migrating a Domain
You can use xm to migrate a domain:
xm migrate [domain-id] [host] [options]
Where [domain-id] is the domain you want to migrate, and [host] is the target. The [options] include ——live (or -l) for a live migration, or ——resource (or -r) to specify maximum speed of the migration (in Mbs).
To ensure a successful migration, you must ensure that the xend daemon is running on all hosts domains. All hosts must also be running Red Hat RHEL 5.0+ and have migration TCP ports open to accept connections from the source hosts.
Monitoring and Diagnostics
Performing a Core Dump
You can use xm to perform a memory dump of an existing virtual machine.
xm dump-core [-C] [domain-id]
This command dumps the virtual machine's memory to the xendump file located in the /var/xen/dump/ directory. You can terminate the virtual machine by including the -C option.
Monitoring Domains in Real Time
You can use xm to monitor domains and hosts in real time:
xm top [domain-id]
Displaying Domain States
You can use xm to display the domain activity states of one or more domains:
xm list [domain-id] [ ——long | ——label]
You can specify a specific domain(s) by name (s). The [——long] option provides a more detailed breakdown of the domain you specified. The [——label] domain adds an additional column that displays label status. The outputs displays:
Name ID Mem(MiB) VCPUs State Time Label
————————————————
Domain0 0 927 8 r—————— 204.9 INACTIVE
Domain202 1 927 8 s—————— 205.0/command ACTIVE
DomainQ/A 2 927 8 b—————— INACTIVE
Domain9600 3 927 8 c—————— 205.1 ACTIVE
Here are the six domain states per VCPU:
State |
Description |
running |
lists domains currently active on a CPU |
blocked |
lists domains that are blocked (a domain becomes blocked when the vcpu is awaiting for an external event to happen) |
paused |
lists domains that are suspended |
shutdown |
lists domains that are in process of shutting down |
shutoff |
lists domains that are completely down. |
crashed |
lists domains that are crashed |
inactive |
lists domains that are inactive instances |
——all |
lists domains that are both active and inactive vcpu instances |
Table The Domain States
문서 출처 : http://www.wideopen.com/docs/manuals/enterprise/RHEL-5-manual/Virtualization-en-US/task-virt-xm-monitoring-diag.html
[출처] Xen - xm 명령어|작성자 바람소리
댓글 없음:
댓글 쓰기