Document Information
Preface
Solaris Virtualization Product Overview
Part I Resource Management
1. Introduction to Solaris Resource Management
2. Projects and Tasks (Overview)
3. Administering Projects and Tasks
4. Extended Accounting (Overview)
5. Administering Extended Accounting (Tasks)
6. Resource Controls (Overview)
7. Administering Resource Controls (Tasks)
8. Fair Share Scheduler (Overview)
9. Administering the Fair Share Scheduler (Tasks)
10. Physical Memory Control Using the Resource Capping Daemon (Overview)
11. Administering the Resource Capping Daemon (Tasks)
12. Resource Pools (Overview)
13. Creating and Administering Resource Pools (Tasks)
14. Resource Management Configuration Example
15. Resource Control Functionality in the Solaris Management Console
Part II Zones
16. Introduction to Solaris Zones
17. Non-Global Zone Configuration (Overview)
18. Planning and Configuring Non-Global Zones (Tasks)
19. About Installing, Halting, Cloning, and Uninstalling Non-Global Zones (Overview)
20. Installing, Booting, Halting, Uninstalling, and Cloning Non-Global Zones (Tasks)
21. Non-Global Zone Login (Overview)
22. Logging In to Non-Global Zones (Tasks)
23. Moving and Migrating Non-Global Zones (Tasks)
24. About Packages and Patches on a Solaris System With Zones Installed (Overview)
25. Adding and Removing Packages and Patches on a Solaris System With Zones Installed (Tasks)
26. Solaris Zones Administration (Overview)
27. Administering Solaris Zones (Tasks)
28. Troubleshooting Miscellaneous Solaris Zones Problems
Part III Branded Zones
29. About Branded Zones and the Linux Branded Zone
30. Planning the lx Branded Zone Configuration (Overview)
31. Configuring the lx Branded Zone (Tasks)
32. About Installing, Booting, Halting, Cloning, and Uninstalling lx Branded Zones (Overview)
33. Installing, Booting, Halting, Uninstalling and Cloning lx Branded Zones (Tasks)
34. Logging In to lx Branded Zones (Tasks)
35. Moving and Migrating lx Branded Zones (Tasks)
36. Administering and Running Applications in lx Branded Zones (Tasks)
Part IV Sun xVM
37. Sun xVM Hypervisor System Requirements
38. Booting and Running the Sun xVM Hypervisor
39. Xvnc
40. Using virt-install to Install a Domain
41. xVM System Administration
Printing Kernel and Machine Information
Cloning ZFS-Based Solaris Domains
How to Use ZFS Snapshot to Clone a Solaris DomU
Communication From xVM Hypervisor to Dom0 Using xm
About Crash Dumps
42. Troubleshooting Miscellaneous Sun xVM Problems
Glossary
Index
|
virsh Command and Domain Management
The main command interface used to control both Solaris xVM and guest domains
is the virsh command. virsh provides a generic and stable interface for controlling
virtualized operating systems. Use virsh instead of xm wherever possible. Many virsh commands act asynchronously. This means that the system prompt can return
before the operation has completed. If you modify CPUs or memory by using the virsh command, these changes
will be saved in the configuration file and persist across reboots.
virsh Command Structure
Most virsh commands follow the format: # virsh subcommand domain-id | name | uuid [options] - subcommand
One of the subcommands listed in the virsh(1M) man page
- domain-id, name, or uuid
A domain identifier
- options
An option to a subcommand
Example 41-1 Using a virsh Command This line connects to a domU named sxc18. # virsh console sxc18
virshCommand
The virsh is used to manage domains. You must run the commands as
the root user or by assuming the Primary Administrator role on the host
operating system. The commands cannot be run in the guest domain. virsh Command |
Description |
virshattach-device |
Attach
device from an XML file |
virsh attach-disk |
Attach disk device |
virsh autostart |
Configure a domain
to automatically start at boot time. |
virsh capabilities |
Return capabilities of the hypervisor and
drivers. |
virsh connect |
Connect to the hypervisor. |
virsh connect--readonly |
Connect to the hypervisor in read-only mode. |
virsh
consoledomain |
Connect to a guest console |
virsh create file |
Create a domain based on the
parameters contained in the XML file, where file is an absolute pathname. Such a
file can be created using virsh dumpxml subcommand. The XML configuration file should
not be directly edited. |
virsh define file |
Define a domain from an XML file,
but do not start the domain |
virsh destroy domain-id |
Terminate a domain immediately |
virsh detach-device
domain-idfile |
Detach a device defined by the given XML file from the specified
domain. |
virsh domid domain_name |
Converts a domain name to a numeric domain ID. |
virsh dominfo
domain_id |
Return basic info about a domain |
virsh domname domain_id |
Converts a numeric domain ID
to a domain name. |
virsh domstate domain_id |
Returns the state of a running domain.
See the list subcommand. |
virsh domuuid domain |
Convert the specified domain name or ID
to a domain UUID. |
virsh dump domainfile |
Dump the core of the domain
specified by domain to the file specified by file for analysis. |
virsh dumpxml domain-id |
Obtain
domain information in XML |
virsh help |
Display descriptions of the subcommands. Include a subcommand
at the end of the command line to display help about that subcommand. |
virsh
list |
List domains. By default, only running domains are displayed. Use --inactive to display
only non-running domains. Use --all to display both running and non-running domains. |
virsh
nodeinfo |
Print basic information about a node. # virsh nodeinfo
CPU model: i86pc
CPU(s): 2
CPU frequency: 2391 MHz
CPU socket(s): 2
Core(s) per socket: 1
Thread(s) per core: 1
NUMA cell(s): 1
Memory size: 4127744 kB |
virsh quit |
Quit this interactive terminal |
virsh
reboot domain-id |
Reboot a domain. This command is identical to the effect of running init 6. The
command returns immediately, but the entire reboot process might take a minute or more. |
virsh
restore state-file |
Restore a domain from a saved state file. |
virsh resume domain-id |
Moves a
domain out of the paused state, making the domain eligible for scheduling by
the hypervisor. |
virsh reboot domain-id |
Reboot a domain |
virsh restore domain-id |
Restore a domain from a
saved state |
virsh resume domain-id |
Resume running a suspended domain. |
virsh save domain state-file |
Save a
running domain to a state file so that it can be restored
by using the restore subcommand at a later time. In this state, the domain
is not running on the system, thus the memory allocated for the domain
will be free for use br other domains. Note that network connections present before
the save operation might be severed because TCP timeouts might have expired. |
virsh setvcpus domaincount |
Change
the number of virtual CPUs active in the specified guest domain. The count
parameter is the number of virtual CPUs. |
virsh schedinfo domain |
Show or set the
scheduling paramaters for the specified domain name, ID, or UUID. This subcommand takes
the options --weight number and --cap number. |
virsh setmaxmem domain kilobytes |
Change the maximum memory allocation
limit in the specified guest domain. The kilobytes parameter is the maximum memory limit
in kilobytes. |
virsh setmem domain kilobytes |
Change the current memory allocation in the specified guest
domain. The kilobytes parameter is the number of kilobytes in memory. |
virsh setvcpus domain count |
Change
the number of virtual CPUs active in the specified guest domain. The count
parameter is the number of virtual CPUs. |
virsh shutdown domain |
Coordinates with the domain operating system
to perform graceful shutdown. The effect of this command is identical to the
effect of running init 5. The shutdown might take an unexpected length of time, depending
on the services that must be shut down in the domain. In addition,
it is possible that the subcommand will not succeed. |
virsh start domain |
Start a previously
defined inactive domain. |
virsh suspend domain |
Suspend a domain. A domain in this state
still consumes allocated resources, such as memory, but is not eligible for scheduling by
the hypervisor. |
virsh undefine domain |
Undefine the configuration for the inactive domain by specifying
either its domain name or UUID. |
virsh vcpuinfo domain |
Return basic information about the domain's
virtual CPUs. |
virsh vcpupin domain vcpu cpulist |
Pin domain's virtual CPUs to the host's
physical CPUs. The domain parameter is the domain name, ID, or UUID.
The vcpu parameter is the VCPU number. The cpulist parameter is a list of
host CPU numbers, separated by commas. |
virsh version |
Display version information. |
virsh vncdisplay domain-id |
VNC
display |
Suspend and Resume Functions and Commands
Some xVM operations are not yet implemented in the virsh command. In those
cases, the equivalent xm command can be used. Subcommand terminology differs between the
xmand virsh commands. In particular, the suspend and resume commands have different
meanings. Table 41-1 Equivalent virsh and xmCommandsvirsh |
xm |
suspend |
pause |
resume |
unpause |
save |
suspend without an output file argument |
restore |
resume without an output file argument |
|