Linux Virtualization Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(73 intermediate revisions by the same user not shown)
Line 20: Line 20:
| [[qemu-img]]
| [[qemu-img]]
|}
|}
=Guest Operations=
* [[Linux KVM Virtualization Guest Operations#List_Available_Guests|List Available Guests]]
* [[Linux KVM Virtualization Guest Operations#Information_about_a_Guest|Information about a Guest]]
* [[Linux_KVM_Virtualization_Guest_Operations#Create_a_Guest_Virtual_Machine|Create a Guest]]
* [[Linux_KVM_Virtualization_Guest_Operations#Start.2FStop_Guest_Virtual_Machines|Start/Stop Guests]]
* [[Virsh_autostart#Configure_to_Automatically_Start_at_Boot|Configure a Guest to Automatically Start at Boot]]
* [[Linux_KVM_Virtualization_Guest_Operations#Connect_to_the_Guest_Virtual_Machine|Connect to Guest]]
* [[Linux Virtualization Adding Storage to Guests|Add Storage to Guests]]
* [[Linux Virtualization Reconfigure Guest Memory|Reconfigure Guest Memory]]
* [[Linux KVM Virtualization Reconfigure Guest CPUs|Reconfigure Guest CPUs]]
* [[Linux Virtualization Remove Storage from Guest|Remove Storage from Guest]]
* [[Linux Virtualization Reconfigure Guest Network|Reconfigure Guest Network]]
* [[Linux Virtualization Cloning a KVM Guest Virtual Machine|Clone a Guest]]
* Snapshot:
** [[Linux KVM Virtualization Manual Low-Level Guest Export/Import Procedure|Manual Low-Level Export/Import]]
** [[Linux_KVM_Virtualization_Guest_Snapshot_Using_virsh_snapshot_Functionality|Snapshot with virsh shapshot]]
* [[Linux_KVM_Virtualization_Guest_Operations#Remove_a_Guest|Remove a Guest]]


=Virtualization Host Storage Operations=
=Virtualization Host Storage Operations=


==Storage Pool Operations==
==Virtualization Host Storage Pool Operations==
<span id='Storage_Pool_Configuration'></span>


* [[KVM Virtualization Storage Pool Info|Storage Pool Info]]
* [[KVM Virtualization Disk-Based Storage Pool Configuration|Disk-Based Storage Pool Configuration]]
* [[KVM Virtualization Disk-Based Storage Pool Configuration|Disk-Based Storage Pool Configuration]]
* [[KVM Virtualization Partition-Based Storage Pool Configuration|Partition-Based Storage Pool Configuration]]
* [[KVM Virtualization Partition-Based Storage Pool Configuration|Partition-Based Storage Pool Configuration]]
Line 32: Line 51:
* [[KVM Virtualization Storage Pool Deletion|Storage Pool Deletion]]
* [[KVM Virtualization Storage Pool Deletion|Storage Pool Deletion]]


==Storage Volume Operations==
==Virtualization Host Storage Volume Operations==
<span id='Storage_Volume_Configuration'></span>


* [[Virsh_vol-create-as|Storage Volume Creation]]
* [[KVM Virtualization Storage Volume Info|Storage Volume Info]]
* [[libvirt Storage Volume Rename|Storage Volume Rename]]
* Storage Volume Creation:
* [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Storage_Volumes-Cloning_volumes.html Storage Volume Cloning]
** [[Virsh_vol-create-as|With vol-create-as]]
** [[Virsh vol-create|With vol-create]]
** [[KVM Virtualization Placing an ISO Image in a Directory-Based Storage Pool|Placing an ISO Image in a Directory-Based Storage Pool]]
* [[virsh vol-clone|Storage Volume Cloning]]
* [[Qemu-img#Take_a_Snapshot|Storage Volume Snapshot with qemu-img]]
* [[libvirt Storage Volume Renaming|Storage Volume Renaming]]
* [[virsh vol-delete|Storage Volume Deletion]]
* [[virsh vol-delete|Storage Volume Deletion]]
* [[KVM Virtualization Storage Volume Removal, Off-Line Archival and Restoration|Storage Volume Removal, Off-Line Archival and Restoration]]


=Virtualization Host Network Operations=
=Virtualization Host Network Operations=


* [[KVM Virtualization Attaching a Guest Directly to a Virtualization Host Network Interface|Attaching a Guest Directly to a Virtualization Host Network Interface]]
* [[libvirt Virtual Network Info Operation|Virtual Network Info]]
* [[Virsh_net-edit#Modify_DHCP_Range|Modifying the Range of the DHCP Server for a Virtual Network]]
* [[libvirt Virtual Network Creation Operation|Virtual Network Creation]]
* [[Virsh_net-edit#Overview|Virtual Network Configuration]]
** [[Virsh_net-edit#Modify_DHCP_Range|Modifying the Range of the DHCP Server for a Virtual Network]]
* [[libvirt Virtual Network Lifecycle Operation|Virtual Network Lifecycle (Start/Stop)]]
* [[Attaching_a_Guest_Directly_to_a_Virtualization_Host_Network_Interface_with_a_macvtap_Driver#Overview|Attaching a Guest Directly to a Virtualization Host Network Interface with a macvtap Driver]]
* [[KVM Virtualization Bridged Networking Configuration|Bridged Networking Configuration]]
* [[KVM Virtualization Bridged Networking Configuration|Bridged Networking Configuration]]
=Create a Guest Virtual Machine=
Virtualization host storage and host-level networking must be configured as a prerequisite to creating guest virtual machines. Once storage pools and storage volumes are made available, and the networking is configured, guest virtual machines can be created with
{{Internal|Virt-install#Overviewl|virt-install}}
If the XML definition of a virtual machine is available, it can be created with: {{Internal|virsh define|virsh define}}
=Start/Stop Guest VMs=
    [[virsh start]]
    [[virsh shutdown]]
=Connect to the Guest VM=
   
    [[virsh console]]
=Adding Storage to Guests=
{{Internal|Linux Virtualization Adding Storage to Guests|Adding Storage to Guests}}
=Cloning a Guest VM=
* Shut down the guest with [[virsh shutdown]].
* Export the XML configuration with [[virsh dumpxml]].
* Copy the XML definition under a new name, conventionally the name of the guest being built.
* Edit the XML as needed. Things you may want to change:
** The name of the guest.
** Remove the [[KVM_Virtual_Machine_XML_Configuration_Example#uuid|<uuid>]] line, a new UUID will be generated.
** The amount of memory, specified as [[KVM_Virtual_Machine_XML_Configuration_Example#memory|<memory>]]. Remove the  [[KVM_Virtual_Machine_XML_Configuration_Example#currentMemory|<currentMemory>]] line.
** The number of [[KVM_Virtual_Machine_XML_Configuration_Example#vcpu|vCPUs]] allocated to the guest.
** Remove the "cdrom" disk(s), if it is not going to be used.
** Edit the <disk> definitions and adjust the names for the new storage volumes that will be provisioned for the new virtual machine. The virtual machine will definitely need a [[Linux_Virtualization_Concepts#Virtual_Machine_Image|virtual machine image]], stored in (usually) [[Linux_Virtualization_Concepts#qcow2|qcow2]] format, end possible other block storage devices in [[Linux_Virtualization_Concepts#raw|raw]] format. Conventionally, the virtual machine image is stored in the main storage pool and it is named based on the name of the VM:
<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2'/>
  &lt;source file='/main-storage-pool/''new-vm-name''.qcow2'/>
  <target dev='vda' bus='virtio'/>
  ...
</disk>
* Clone the virtual machine image with the new name.
* Create any other storage volume that may be needed.
* Define the guest with [[virsh define]].

Latest revision as of 00:07, 30 July 2023

Internal

Commands

virsh
virt-install guestmount guestunmount virt-builder virt-cat virt-filesystems virt-inspector
libguestfs virt-copy-in virt-copy-out virt-customize virt-df virt-diff virt-edit virt-format
virt-log virt-ls virt-make-fs virt-p2v virt-rescue virt-resize virt-sparsify virt-sysprep
virt-tar-out virt-tar-in virt-top virt-v2v virt-viewer virt-what virt-who virt-xml-validate
qemu-img

Guest Operations

Virtualization Host Storage Operations

Virtualization Host Storage Pool Operations

Virtualization Host Storage Volume Operations

Virtualization Host Network Operations