Virtualization Guide Virtualization Guide SUSE Linux Enterprise Server 15 SP2
Total Page:16
File Type:pdf, Size:1020Kb
SUSE Linux Enterprise Server 15 SP2 Virtualization Guide Virtualization Guide SUSE Linux Enterprise Server 15 SP2 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 xix 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 4 Virtualization Tools 12 4.1 Virtualization Console Tools 12 iii Virtualization Guide 4.2 Virtualization GUI Tools 13 5 Installation of Virtualization Components 17 5.1 Installing KVM 17 5.2 Installing Xen 17 5.3 Installing Containers 18 5.4 Patterns 18 5.5 Installing UEFI Support 19 5.6 Enable Support for Nested Virtualization in KVM 20 6 Supported Hosts, Guests, and Features 22 6.1 Host Environments (Hypervisors) 22 6.2 Guest Environments 22 Availability of Paravirtualized Drivers 23 6.3 KVM Hardware Requirements 24 6.4 Feature Support 25 Host (Dom0) 25 • Paravirtualized Guest 26 • Fully Virtualized Guest 27 II MANAGING VIRTUAL MACHINES WITH libvirt 29 7 Starting and Stopping libvirtd 30 8 Guest Installation 32 8.1 GUI-Based Guest Installation 32 8.2 Installing from the Command Line with virt-install 34 8.3 Advanced Guest Installation Scenarios 37 Memory Ballooning with Windows Guests 37 • Including Add-on Products in the Installation 38 iv Virtualization Guide 9 Basic VM Guest Management 39 9.1 Listing VM Guests 39 Listing VM Guests with Virtual Machine Manager 39 • Listing VM Guests with virsh 40 9.2 Accessing the VM Guest via Console 40 Opening a Graphical Console 40 • Opening a Serial Console 42 9.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 9.4 Saving and Restoring the State of a VM Guest 45 Saving/Restoring with Virtual Machine Manager 46 • Saving and Restoring with virsh 47 9.5 Creating and Managing Snapshots 47 Terminology 47 • Creating and Managing Snapshots with Virtual Machine Manager 48 • Creating and Managing Snapshots with virsh 50 9.6 Deleting a VM Guest 52 Deleting a VM Guest with Virtual Machine Manager 52 • Deleting a VM Guest with virsh 53 9.7 Migrating VM Guests 53 Migration Requirements 53 • Migrating with Virtual Machine Manager 55 • Migrating with virsh 56 • Step-by-Step Example 58 9.8 Monitoring 60 Monitoring with Virtual Machine Manager 60 • Monitoring with virt- top 61 • Monitoring with kvm_stat 62 10 Connecting and Authorizing 64 10.1 Authentication 64 libvirtd Authentication 65 • VNC Authentication 69 10.2 Connecting to a VM Host Server 73 “system” Access for Non-Privileged Users 74 • Managing Connections with Virtual Machine Manager 75 v Virtualization Guide 10.3 Configuring Remote Connections 76 Remote Tunnel over SSH (qemu+ssh or xen+ssh) 77 • Remote TLS/SSL Connection with x509 Certificate (qemu+tls or xen+tls) 77 11 Managing Storage 85 11.1 Managing Storage with Virtual Machine Manager 87 Adding a Storage Pool 88 • Managing Storage Pools 91 11.2 Managing Storage with virsh 93 Listing Pools and Volumes 93 • Starting, Stopping and Deleting Pools 95 • Adding Volumes to a Storage Pool 96 • Deleting Volumes from a Storage Pool 97 • Attaching Volumes to a VM Guest 97 • Detaching Volumes from a VM Guest 98 11.3 Locking Disk Files and Block Devices with virtlockd 99 Enable Locking 99 • Configure Locking 100 11.4 Online Resizing of Guest Block Devices 101 11.5 Sharing Directories between Host and Guests (File System Pass- Through) 102 11.6 Using RADOS Block Devices with libvirt 103 12 Managing Networks 104 12.1 Network Bridge 104 Managing Network Bridges with YaST 104 • Managing Network Bridges from the Command Line 105 • Using VLAN Interfaces 107 12.2 Virtual Networks 108 Managing Virtual Networks with Virtual Machine Manager 109 • Managing Virtual Networks with virsh 113 13 Configuring Virtual Machines with Virtual Machine Manager 120 13.1 Machine Setup 121 Overview 121 • Performance 122 • Processor 123 • Memory 124 • Boot Options 125 vi Virtualization Guide 13.2 Storage 126 13.3 Controllers 127 13.4 Networking 128 13.5 Input Devices 130 13.6 Video 131 13.7 USB Redirectors 133 13.8 Miscellaneous 134 13.9 Adding a CD/DVD-ROM Device with Virtual Machine Manager 134 13.10 Adding a Floppy Device with Virtual Machine Manager 135 13.11 Ejecting and Changing Floppy or CD/DVD-ROM Media with Virtual Machine Manager 136 13.12 Assigning a Host PCI Device to a VM Guest 137 Adding a PCI Device with Virtual Machine Manager 137 13.13 Assigning a Host USB Device to a VM Guest 139 Adding a USB Device with Virtual Machine Manager 139 14 Configuring Virtual Machines with virsh 141 14.1 Editing the VM Configuration 141 14.2 Changing the Machine Type 142 14.3 Configuring Hypervisor Features 143 14.4 Configuring CPU Allocation 144 14.5 Changing Boot Options 145 Changing Boot Order 145 • Using Direct Kernel Boot 146 14.6 Configuring Memory Allocation 146 14.7 Adding a PCI Device 147 PCI Pass-Through for IBM Z 150 14.8 Adding a USB Device 151 vii Virtualization Guide 14.9 Adding SR-IOV Devices 152 Requirements 152 • Loading and Configuring the SR-IOV Host Drivers 153 • Adding a VF Network Device to a VM Guest 156 • Dynamic Allocation of VFs from a Pool 159 14.10 Listing Attached Devices 160 14.11 Configuring Storage Devices 161 14.12 Configuring Controller Devices 162 14.13 Configuring Video Devices 164 Changing the Amount of Allocated VRAM 164 • Changing the State of 2D/3D Acceleration 164 14.14 Configuring Network Devices 165 Scaling Network Performance with Multiqueue virtio-net 165 14.15 Using Macvtap to Share VM Host Server Network Interfaces 165 14.16 Disabling a Memory Balloon Device 167 14.17 Configuring Multiple Monitors (Dual Head) 167 14.18 Crypto adapter pass-through to KVM guests on IBM Z 169 Introduction 169 • What is covered 169 • Requirements 169 • Dedicate a crypto adapter to a KVM host 169 • Further reading 172 15 Managing Virtual Machines with Vagrant 173 15.1 Introduction to Vagrant 173 Vagrant Concepts 173 • Vagrant Example 174 15.2 Vagrant Boxes for SUSE Linux Enterprise 174 15.3 Further Reading 175 III HYPERVISOR-INDEPENDENT FEATURES 176 16 Disk Cache Modes 177 16.1 Disk Interface Cache Modes 177 viii Virtualization Guide 16.2 Description of Cache Modes 177 16.3 Data Integrity Implications of Cache Modes 179 16.4 Performance Implications of Cache Modes 180 16.5 Effect of Cache Modes on Live Migration 180 17 VM Guest Clock Settings 181 17.1 KVM: Using kvm_clock 181 Other Timekeeping Methods 182 17.2 Xen Virtual Machine Clock Settings 182 18 libguestfs 183 18.1 VM Guest Manipulation Overview 183 VM Guest Manipulation Risk 183 • libguestfs Design 184 18.2 Package Installation 184 18.3 Guestfs Tools 185 Modifying Virtual Machines 185 • Supported File Systems and Disk Images 185 • virt-rescue 186 • virt-resize 186 • Other virt-* Tools 188 • guestfish 190 • Converting a Physical Machine into a KVM Guest 191 18.4 Troubleshooting 193 Btrfs-related Problems 193 • Environment 194 • libguestfs-test- tool 194 18.5 External References 194 19 QEMU Guest Agent 195 19.1 Running QEMU GA Commands 195 19.2 virsh Commands that Require QEMU GA 195 19.3 Enhancing libvirt Commands 196 19.4 For More Information 197 ix Virtualization Guide IV MANAGING VIRTUAL MACHINES WITH XEN 198 20 Setting Up a Virtual Machine Host 199 20.1 Best Practices and Suggestions 199 20.2 Managing Dom0 Memory 200 Setting Dom0 Memory Allocation 201 20.3 Network Card in Fully Virtualized Guests 201 20.4 Starting the Virtual Machine Host 202 20.5 PCI Pass-Through 204 Configuring the Hypervisor for PCI Pass-Through 204 • Assigning PCI Devices to VM Guest Systems 205 • VGA Pass- Through 206 • Troubleshooting 206 • For More Information 207 20.6 USB Pass-Through 207 Identify the USB Device 208 • Emulated USB Device 208 • Paravirtualized PVUSB 208 21 Virtual Networking 211 21.1 Network Devices for Guest Systems 211 21.2 Host-Based Routing in Xen 213 21.3 Creating a Masqueraded Network Setup 216 21.4 Special Configurations 218