Virtualization Guide Virtualization Guide SUSE Linux Enterprise Server 12 SP4
Total Page:16
File Type:pdf, Size:1020Kb
SUSE Linux Enterprise Server 12 SP4 Virtualization Guide Virtualization Guide SUSE Linux Enterprise Server 12 SP4 Describes virtualization technology in general, and introduces libvirt—the unied interface to virtualization—and detailed information on specic hypervisors. Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see https://www.suse.com/company/legal/ . All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its aliates. Asterisks (*) denote third-party trademarks. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Manual xvi 1 Available Documentation xvi 2 Giving Feedback xviii 3 Documentation Conventions xviii 4 Product Life Cycle and Support xx Support Statement for SUSE Linux Enterprise Server xxi • Technology Previews xxii I INTRODUCTION 1 1 Virtualization Technology 2 1.1 Overview 2 1.2 Virtualization Capabilities 3 1.3 Virtualization Benefits 3 1.4 Virtualization Modes 4 1.5 I/O Virtualization 4 2 Introduction to Xen Virtualization 7 2.1 Basic Components 7 2.2 Xen Virtualization Architecture 8 3 Introduction to KVM Virtualization 10 3.1 Basic Components 10 3.2 KVM Virtualization Architecture 10 iii Virtualization Guide 4 Introduction to Linux Containers 12 5 Virtualization Tools 13 5.1 Virtualization Console Tools 13 5.2 Virtualization GUI Tools 14 6 Installation of Virtualization Components 18 6.1 Installing KVM 18 6.2 Installing Xen 18 6.3 Installing Containers 19 6.4 Patterns 19 6.5 Installing UEFI Support 20 7 Supported Guests, Hosts and Features 21 7.1 Supported VM Guests 21 Availability of Paravirtualized Drivers 23 7.2 Supported VM Host Servers for SUSE Linux Enterprise Server 12 SP4 VM Guests 23 7.3 KVM Hardware Requirements 24 7.4 Feature Support 26 Host (Dom0) 26 • Paravirtualized Guest 27 • Fully Virtualized Guest 28 II MANAGING VIRTUAL MACHINES WITH libvirt 29 8 Starting and Stopping libvirtd 30 9 Guest Installation 32 9.1 GUI-Based Guest Installation 32 9.2 Installing from the Command Line with virt-install 34 iv Virtualization Guide 9.3 Advanced Guest Installation Scenarios 37 Memory Ballooning with Windows Guests 37 • Including Add-on Products in the Installation 38 10 Basic VM Guest Management 39 10.1 Listing VM Guests 39 Listing VM Guests with Virtual Machine Manager 39 • Listing VM Guests with virsh 40 10.2 Accessing the VM Guest via Console 40 Opening a Graphical Console 40 • Opening a Serial Console 42 10.3 Changing a VM Guest's State: Start, Stop, Pause 43 Changing a VM Guest's State with Virtual Machine Manager 44 • Changing a VM Guest's State with virsh 44 10.4 Saving and Restoring the State of a VM Guest 45 Saving/Restoring with Virtual Machine Manager 46 • Saving and Restoring with virsh 47 10.5 Creating and Managing Snapshots 47 Terminology 47 • Creating and Managing Snapshots with Virtual Machine Manager 48 • Creating and Managing Snapshots with virsh 50 10.6 Deleting a VM Guest 53 Deleting a VM Guest with Virtual Machine Manager 53 • Deleting a VM Guest with virsh 53 10.7 Migrating VM Guests 53 Migration Requirements 54 • Migrating with Virtual Machine Manager 55 • Migrating with virsh 57 • Step-by-Step Example 58 10.8 Monitoring 61 Monitoring with Virtual Machine Manager 61 • Monitoring with virt- top 62 • Monitoring with kvm_stat 63 11 Connecting and Authorizing 65 11.1 Authentication 65 libvirtd Authentication 66 • VNC Authentication 70 v Virtualization Guide 11.2 Connecting to a VM Host Server 74 “system” Access for Non-Privileged Users 75 • Managing Connections with Virtual Machine Manager 76 11.3 Configuring Remote Connections 77 Remote Tunnel over SSH (qemu+ssh or xen+ssh) 78 • Remote TLS/SSL Connection with x509 Certificate (qemu+tls or xen+tls) 78 12 Managing Storage 86 12.1 Managing Storage with Virtual Machine Manager 88 Adding a Storage Pool 89 • Managing Storage Pools 92 12.2 Managing Storage with virsh 94 Listing Pools and Volumes 94 • Starting, Stopping and Deleting Pools 96 • Adding Volumes to a Storage Pool 97 • Deleting Volumes from a Storage Pool 98 • Attaching Volumes to a VM Guest 98 • Detaching Volumes from a VM Guest 99 12.3 Locking Disk Files and Block Devices with virtlockd 100 Enable Locking 100 • Configure Locking 101 12.4 Online Resizing of Guest Block Devices 102 12.5 Sharing Directories between Host and Guests (File System Pass- Through) 103 12.6 Using RADOS Block Devices with libvirt 104 13 Managing Networks 105 13.1 Virtual Networks 105 Managing Virtual Networks with Virtual Machine Manager 105 • Managing Virtual Networks with virsh 110 13.2 Bridged Networking 115 Managing Network Bridges with YaST 116 • Managing Network Bridges with brctl 117 • Using VLAN Interfaces 118 vi Virtualization Guide 14 Configuring Virtual Machines 120 14.1 Machine Setup 121 Overview 121 • Performance 122 • Processor 123 • Memory 124 • Boot Options 125 14.2 Storage 126 14.3 Controllers 127 14.4 Networking 128 14.5 Enabling Seamless and Synchronized Mouse Pointer Movement 130 14.6 Adding a CD/DVD-ROM Device with Virtual Machine Manager 130 14.7 Adding a Floppy Device with Virtual Machine Manager 131 14.8 Ejecting and Changing Floppy or CD/DVD-ROM Media with Virtual Machine Manager 132 14.9 Editing VM Configuration with virsh 133 14.10 Changing the Machine Type with virsh 134 14.11 Assigning a Host PCI Device to a VM Guest 135 Adding a PCI Device with Virtual Machine Manager 135 • Adding a PCI Device with virsh 136 14.12 Assigning a Host USB Device to a VM Guest 139 Adding a USB Device with Virtual Machine Manager 139 • Adding a USB Device with virsh 140 14.13 Adding SR-IOV Devices 141 Requirements 142 • Loading and Configuring the SR-IOV Host Drivers 143 • Adding a VF Network Device to an Existing VM Guest 146 • Dynamic Allocation of VFs from a Pool 148 14.14 Using Macvtap to Share VM Host Server Network Interfaces 150 14.15 Managing Guest Memory Allocation (Xen only) 151 14.16 Disabling a Memory Balloon Device 152 14.17 Configuring Multiple Monitors (Dual Head) 153 vii Virtualization Guide III HYPERVISOR-INDEPENDENT FEATURES 155 15 Disk Cache Modes 156 15.1 Disk Interface Cache Modes 156 15.2 Description of Cache Modes 156 15.3 Data Integrity Implications of Cache Modes 158 15.4 Performance Implications of Cache Modes 159 15.5 Effect of Cache Modes on Live Migration 159 16 VM Guest Clock Settings 160 16.1 KVM: Using kvm_clock 160 Other Timekeeping Methods 161 16.2 Xen Virtual Machine Clock Settings 161 17 libguestfs 162 17.1 VM Guest Manipulation Overview 162 VM Guest Manipulation Risk 162 • libguestfs Design 163 17.2 Package Installation 163 17.3 Guestfs Tools 164 Modifying Virtual Machines 164 • Supported File Systems and Disk Images 164 • virt-rescue 165 • virt-resize 165 • Other virt-* Tools 167 • guestfish 169 • Converting a Physical Machine into a KVM Guest 170 17.4 Troubleshooting 172 Btrfs-related Problems 172 • Environment 173 • libguestfs-test- tool 173 17.5 External References 173 IV MANAGING VIRTUAL MACHINES WITH XEN 174 18 Setting Up a Virtual Machine Host 175 18.1 Best Practices and Suggestions 175 viii Virtualization Guide 18.2 Managing Dom0 Memory 176 Setting a Maximum Amount of Memory 177 18.3 Network Card in Fully Virtualized Guests 177 18.4 Starting the Virtual Machine Host 178 18.5 PCI Pass-Through 179 Configuring the Hypervisor for PCI Pass-Through 180 • Assigning PCI Devices to VM Guest Systems 181 • VGA Pass- Through 182 • Troubleshooting 182 • For More Information 183 18.6 USB Pass-Through 183 Identify the USB Device 183 • Emulated USB Device 184 • Paravirtualized PVUSB 184 19 Virtual Networking 186 19.1 Network Devices for Guest Systems 186 19.2 Host-Based Routing in Xen 188 19.3 Creating a Masqueraded Network Setup 191 19.4 Special Configurations 193 Bandwidth Throttling in Virtual Networks 193 • Monitoring the Network Traffic 194 20 Managing a Virtualization Environment 195 20.1 XL—Xen Management Tool 195 Guest Domain Configuration File 196 20.2 Automatic Start of Guest Domains 197 20.3 Event Actions 197 20.4 Time Stamp Counter 198 20.5 Saving Virtual Machines 199 20.6 Restoring Virtual Machines 199 20.7 Virtual Machine States 200 ix Virtualization Guide 21 Block Devices in Xen 201 21.1 Mapping Physical Storage to Virtual Disks 201 21.2 Mapping Network Storage to Virtual Disk 202 21.3 File-Backed Virtual Disks and Loopback Devices 202 21.4 Resizing Block Devices 203 21.5 Scripts for Managing Advanced Storage Scenarios 204 22 Virtualization: Configuration Options and Settings 205 22.1 Virtual CD Readers 205 Virtual CD Readers on Paravirtual Machines 205 • Virtual CD Readers on Fully Virtual Machines 205 • Adding Virtual CD Readers 206 • Removing Virtual CD Readers 207 22.2 Remote Access Methods 207 22.3 VNC Viewer 207 Assigning VNC Viewer Port Numbers to Virtual Machines 208 • Using SDL instead of a VNC Viewer 209 22.4 Virtual Keyboards