Red_Hat_Enterprise_Linux-6-Virtualization_Administration_Guide-en-US.pdf

(5845 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Red Hat Enterprise Linux 6
Virtualization
Administration Guide
Virtualization Documentation
817139147.015.png 817139147.016.png 817139147.017.png 817139147.018.png 817139147.001.png 817139147.002.png
Virtualization Administration Guide
Red Hat Enterprise Linux 6 Virtualization Administration Guide
Virtualization Documentation
Edition 0.1
Author
Copyright © 2011 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available
at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this
document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity
Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
Java ® is a registered trademark of Oracle and/or its affiliates.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other
countries.
All other trademarks are the property of their respective owners.
1801 Varsity Drive
Raleigh, NC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701
The Virtualization Administration Guide covers administration of hosts, networking, storage, device
and guest management, and troubleshooting.
817139147.003.png 817139147.004.png 817139147.005.png
1. Document Conventions .................................................................................................. vii
1.1. Typographic Conventions .................................................................................... vii
1.2. Pull-quote Conventions ....................................................................................... viii
1.3. Notes and Warnings ............................................................................................ ix
2. Getting Help and Giving Feedback .................................................................................. ix
2.1. Do You Need Help? ............................................................................................. ix
2.2. We Need Feedback! ............................................................................................. x
2.1. Storage security issues ................................................................................................ 3
2.2. SELinux and virtualization ............................................................................................. 3
2.3. SELinux ....................................................................................................................... 4
2.4. Virtualization firewall information ................................................................................... 5
3.1. Security and Virtualization ............................................................................................ 8
3.2. sVirt labeling ................................................................................................................ 8
4.1. Live migration requirements ........................................................................................ 11
4.2. Shared storage example: NFS for a simple migration ................................................... 12
4.3. Live KVM migration with virsh ..................................................................................... 13
4.4. Migrating with virt-manager ......................................................................................... 14
5.1. Remote management with SSH .................................................................................. 25
5.2. Remote management over TLS and SSL ..................................................................... 27
5.3. Transport modes ........................................................................................................ 27
8.1. Control Groups (cgroups) ............................................................................................ 37
8.2. Hugepage support ...................................................................................................... 37
9.1. Automatically starting guests ....................................................................................... 39
9.2. Using qemu-img ......................................................................................................... 39
9.3. Verifying virtualization extensions ................................................................................ 42
9.4. Setting KVM processor affinities .................................................................................. 43
9.5. Generating a new unique MAC address ...................................................................... 47
9.6. Improving guest response time ................................................................................... 48
9.7. Disable SMART disk monitoring for guests .................................................................. 49
9.8. Configuring a VNC Server .......................................................................................... 49
9.9. Gracefully shutting down guests .................................................................................. 50
9.10. Virtual machine timer management with libvirt ............................................................ 51
10.1. Storage pools ........................................................................................................... 55
10.2. Volumes .................................................................................................................. 55
11.1. Creating storage pools ............................................................................................. 59
11.1.1. Dedicated storage device-based storage pools ................................................ 59
iii
817139147.006.png 817139147.007.png 817139147.008.png
Virtualization Administration Guide
11.1.2. Partition-based storage pools .......................................................................... 61
11.1.3. Directory-based storage pools ......................................................................... 68
11.1.4. LVM-based storage pools ............................................................................... 76
11.1.5. iSCSI-based storage pools ............................................................................. 85
11.1.6. NFS-based storage pools ............................................................................... 95
12.1. Creating volumes .................................................................................................... 101
12.2. Cloning volumes ..................................................................................................... 101
12.3. Adding storage devices to guests ............................................................................ 102
12.3.1. Adding file based storage to a guest ............................................................. 102
12.4. Deleting and removing volumes ............................................................................... 105
13.1. Enabling NPIV on the switch ................................................................................... 107
13.1.1. Identifying HBAs in a Host System ................................................................ 107
13.1.2. Verify NPIV is used on the HBA .................................................................... 108
14.1. Installing vhostmd on the host ................................................................................. 111
14.2. Configuration of vhostmd ........................................................................................ 111
14.3. Starting and stopping the daemon ........................................................................... 112
14.4. Verifying that vhostmd is working from the host ........................................................ 112
14.5. Configuring guests to see the metrics ...................................................................... 112
15.1. virsh command quick reference ............................................................................... 115
15.2. Attaching and updating a device with virsh ............................................................... 119
15.3. Connecting to the hypervisor ................................................................................... 119
15.4. Creating a virtual machine XML dump (configuration file) .......................................... 119
15.5. Suspending, resuming, saving and restoring a guest ................................................. 121
15.6. Shutting down, rebooting and force-shutdown of a guest ........................................... 122
15.7. Retrieving guest information .................................................................................... 122
15.8. Retrieving host information ...................................................................................... 123
15.9. Storage pool information ......................................................................................... 124
15.10. Displaying per-guest information ............................................................................ 124
15.11. Managing virtual networks ..................................................................................... 126
15.12. Migrating guests with virsh .................................................................................... 127
15.13. Guest CPU model configuration ............................................................................. 128
15.13.1. Introduction ................................................................................................ 128
15.13.2. Learning about the host CPU model ............................................................ 128
15.13.4. Configuring the guest CPU model ............................................................... 131
16.1. Starting virt-manager ............................................................................................... 133
16.2. The Virtual Machine Manager main window ............................................................. 135
16.3. The virtual hardware details window ........................................................................ 136
16.4. Virtual Machine graphical console ............................................................................ 137
16.5. Adding a remote connection .................................................................................... 139
16.6. Displaying guest details .......................................................................................... 141
16.7. Performance monitoring .......................................................................................... 149
16.8. Displaying CPU usage ............................................................................................ 150
16.9. Displaying Disk I/O ................................................................................................. 152
iv
817139147.009.png 817139147.010.png 817139147.011.png
16.10. Displaying Network I/O .......................................................................................... 154
17.1. Introduction ............................................................................................................ 157
17.2. Terminology ............................................................................................................ 157
17.3. Installation .............................................................................................................. 158
17.4. The guestfish shell .................................................................................................. 158
17.4.1. Viewing file systems with guestfish ................................................................ 159
17.4.2. Modifying files with guestfish ........................................................................ 161
17.4.3. Other actions with guestfish .......................................................................... 161
17.4.4. Shell scripting with guestfish ......................................................................... 161
17.4.5. Augeas and libguestfs scripting ..................................................................... 162
17.5. Other commands .................................................................................................... 163
17.6. virt-rescue: The rescue shell ................................................................................... 163
17.6.1. Introduction .................................................................................................. 163
17.6.2. Running virt-rescue ...................................................................................... 164
17.7. virt-df: Monitoring disk usage ................................................................................... 165
17.7.1. Introduction .................................................................................................. 165
17.7.2. Running virt-df ............................................................................................. 165
17.8. virt-resize: resizing guests offline ............................................................................. 166
17.8.1. Introduction .................................................................................................. 166
17.8.2. Expanding a disk image ............................................................................... 166
17.9. virt-inspector: inspecting guests ............................................................................... 168
17.9.1. Introduction .................................................................................................. 168
17.9.2. Installation ................................................................................................... 168
17.9.3. Running virt-inspector ................................................................................... 168
17.10. virt-win-reg: Reading and editing the Windows Registry ........................................... 170
17.10.1. Introduction ................................................................................................ 170
17.10.2. Installation ................................................................................................. 170
17.10.3. Using virt-win-reg ....................................................................................... 170
17.11. Using the API from Programming Languages .......................................................... 171
17.11.1. Interaction with the API via a C program ...................................................... 172
17.12. Troubleshooting .................................................................................................... 175
17.13. Where to find further documentation ...................................................................... 175
18.1. Virtual network switches .......................................................................................... 177
18.1.1. Network Address Translation ........................................................................ 178
18.2. DNS and DHCP ..................................................................................................... 179
18.3. Other virtual network switch routing types ................................................................ 180
18.4. The default configuration ......................................................................................... 182
18.5. Examples of common scenarios .............................................................................. 183
18.5.1. Routed mode ............................................................................................... 184
18.5.2. NAT mode ................................................................................................... 186
18.5.3. Isolated mode .............................................................................................. 186
18.6. Managing a virtual network ..................................................................................... 186
18.7. Creating a virtual network ....................................................................................... 189
18.8. Attaching virtual network to host .............................................................................. 198
20.1. Using XML configuration files with virsh ................................................................... 205
21.1. Introduction ............................................................................................................ 207
v
817139147.012.png 817139147.013.png 817139147.014.png
Zgłoś jeśli naruszono regulamin