First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Virtualization
Which Intel CPU feature must be enabled in the host firmware and kernel module for KVM to run fully virtualized x86 guests?
- VT-d
- SR-IOV
- AMD-V
- VT-x Correct answer.
Explanation
Intel VT-x is the x86 hardware virtualization extension that KVM uses through the kvm_intel module and /dev/kvm. VT-d provides directed I/O remapping for device assignment, while AMD-V is the competing AMD implementation and SR-IOV partitions PCIe devices. Without VT-x enabled, KVM cannot expose the hardware-assisted virtualization CPU flags a fully virtualized guest needs.
Question 2Virtualization
Which disk image format used by QEMU and libvirt supports internal snapshots, backing files, and copy-on-write allocation?
- raw
- vmdk
- iso
- qcow2 Correct answer.
Explanation
qcow2 is QEMU's copy-on-write image format and stores snapshot metadata and backing-file references inside the image. A raw image is a plain block-for-block file without that metadata, while vmdk is a VMware format and iso is an optical image. libvirt uses qcow2 by default for many local storage pools because of these features.
Question 3Virtualization
Which virsh subcommand displays every libvirt domain on the local hypervisor, including domains that are currently shut off?
- virsh list --state-running
- virsh dumpxml --inactive
- virsh list
- virsh list --all Correct answer.
Explanation
By default virsh list shows only running domains; adding --all includes inactive and shut-off domains. --state-running filters the list to running domains only, and dumpxml --inactive prints XML for one inactive domain. Therefore --all changes the listing scope to include shut-off domains.
Question 4Virtualization
A Linux guest running under KVM needs paravirtualized block and network drivers to avoid emulated hardware overhead. Which driver family should be installed in the guest?
- VirtualBox Guest Additions
- Hyper-V integration services
- VMware Tools
- VirtIO Correct answer.
Explanation
VirtIO is the paravirtualized device framework for KVM/QEMU, providing virtio-blk or virtio-scsi and virtio-net front ends in the guest. The host exposes these devices through QEMU, and the guest kernel's virtio drivers handle them with less overhead than emulated IDE or e1000 hardware. VMware Tools and VirtualBox Guest Additions target their respective hypervisors.
Question 5Virtualization
Which libvirt virtual network mode lets guests reach external networks through host NAT while keeping them off the physical LAN by default?
- NAT mode Correct answer.
- Bridged mode
- Isolated mode
- Routed mode
Explanation
libvirt's default NAT network uses a host bridge with dnsmasq and masquerades guest traffic, so guests can initiate outbound connections without appearing directly on the LAN. Bridged mode attaches guests to a physical bridge and exposes them on the LAN, routed mode forwards without NAT, and isolated mode has no external forwarding. NAT is therefore the mode that provides outbound access with LAN isolation by default.
Question 6Virtualization
For a live migration between two libvirt/KVM hosts that uses shared storage and does not use block migration, which condition is required?
- Identical CPU models on both hosts
- Matching hostnames on both hosts
- The same MAC address on both hosts
- Shared storage at the same path Correct answer.
Explanation
Without block migration, libvirt expects the guest's disk images to be available to both source and destination, typically via shared storage mounted at the same path. CPU models may differ if the guest CPU definition is migratable, and MAC addresses and hostnames do not need to match. Shared access to the disk is what lets the destination resume the domain after memory transfer.
Question 7Virtualization
When snapshotting a running libvirt guest, which snapshot-create-as option specifies how to capture the guest's RAM state so the domain can be resumed at that exact point?
- --disk-only
- --memspec Correct answer.
- --quiesce
- --no-metadata
Explanation
The --memspec option supplies the memory snapshot specification, including whether memory is stored internally or in an external file, where supported. Capturing RAM alongside disk state permits restoration of the running execution state. System snapshots can include memory by default, and available modes depend on the hypervisor.
Question 8Virtualization
Which kernel driver is normally bound to a PCI device so that it can be assigned to a KVM guest through VFIO passthrough?
- vhost-net
- virtio-pci
- kvm-intel
- vfio-pci Correct answer.
Explanation
VFIO passthrough requires the host to unbind the device from its normal driver and bind it to vfio-pci, which enforces IOMMU-based isolation for the guest. kvm-intel is the CPU virtualization module, vhost-net accelerates virtio networking in the host, and virtio-pci is a paravirtualized guest device driver. The vfio-pci driver is the one that makes the physical PCI device assignable.
Question 9Virtualization
In a libvirt domain XML definition, which element restricts the domain's emulator thread to a specific set of host CPUs?
- <memnode cellid='0' nodeset='0'/>
- <iothreadpin iothread='1' cpuset='0-1'/>
- <emulatorpin cpuset='0-1'/> Correct answer.
- <vcpupin vcpu='0' cpuset='0-1'/>
Explanation
The emulatorpin element controls affinity for QEMU's main emulator thread, separate from the vCPU threads. vcpupin pins individual virtual CPUs, iothreadpin pins I/O threads, and memnode sets NUMA memory binding. Therefore emulatorpin is the element that targets the emulator thread itself.
Question 10Virtualization
Which KVM feature allows the host to reclaim unused memory from a running guest by coordinating with a driver inside the guest?
- Transparent huge pages
- Memory ballooning Correct answer.
- Kernel same-page merging (KSM)
- Memory overcommit
Explanation
Memory ballooning uses the virtio_balloon driver in the guest; when the host inflates the balloon, the guest returns pages and the host can reuse that RAM. KSM deduplicates identical pages, huge pages change backing page size, and overcommit is an allocation policy rather than a cooperative reclaim mechanism. Ballooning is therefore the dynamic, guest-cooperative reclaim feature.
Question 11Virtualization
An administrator has a raw disk image named base.img and needs a qcow2 copy named base.qcow2 so that libvirt can later create copy-on-write overlays from it. Which command performs this conversion?
- qemu-img create -f qcow2 -b base.img -F raw base.qcow2
- qemu-img convert -f raw -O qcow2 base.img base.qcow2 Correct answer.
- qemu-img resize --preallocation=metadata base.img 20G
- qemu-img snapshot -c initial base.img
Explanation
qemu-img convert reads the source with the format given by -f and writes a new image in the format given by -O; the result is an independent qcow2 copy. qemu-img create -b creates an overlay that depends on the backing file rather than copying its contents. resize changes virtual size and snapshot records internal state, so neither produces the requested standalone conversion.
Question 12Virtualization
A host already has a directory /var/lib/libvirt/images that contains disk images. An administrator wants libvirt to manage volumes in that directory as a storage pool. Which pool type should be defined?
- dir Correct answer.
- logical
- iscsi
- netfs
Explanation
The dir pool type uses an existing host directory as its target path and lets libvirt create and track volume files inside it. logical pools allocate LVM logical volumes from a volume group, netfs pools mount a network filesystem, and iscsi pools connect to an iSCSI target. For a local directory of image files, dir is the appropriate type.
Question 13Virtualization
An administrator has a prepared qcow2 disk with a bootable OS and wants virt-install to create a libvirt domain from it without launching an OS installer. Which option is required?
- --cdrom /isos/install.iso
- --location /isos/install.iso
- --import Correct answer.
- --pxe
Explanation
--import tells virt-install to build the domain around an existing disk image and boot it directly instead of starting an installation. --cdrom, --pxe, and --location all select an installation source and cause virt-install to expect an OS install. The disk is supplied with --disk path=... alongside --import.
Question 14Virtualization
A domain XML uses <cpu mode='host-passthrough'/>. What is the main operational consequence for a cluster that relies on live migration?
- The guest is prevented from using hardware virtualization extensions, so nested virtualization cannot be enabled.
- The guest CPU is masked down to a cluster-wide baseline feature set that every host in the cluster supports.
- The guest sees the host CPU model exactly, so migration requires compatible host CPUs. Correct answer.
- The guest sees a generic qemu64 CPU model, which maximizes live migration compatibility across unrelated hosts.
Explanation
host-passthrough exposes the host's CPU model and feature flags directly to the guest. Live migration then requires a destination host whose CPU provides at least the same features; otherwise the migration can fail. Modes such as custom with a baseline model are used when a cluster needs a common migratable CPU definition.
Question 15Virtualization
A database VM needs its disk I/O to bypass the host page cache and use direct I/O to the backing file. Which libvirt disk cache mode should be configured?
- cache='writeback'
- cache='none' Correct answer.
- cache='unsafe'
- cache='writethrough'
Explanation
cache='none' opens the backing file with O_DIRECT and bypasses the host page cache, which is the usual choice when the guest or application manages caching. writeback and writethrough both use the host page cache, and unsafe also ignores flush requests. Direct I/O therefore maps to cache='none'.
Question 16Virtualization
Which Linux kernel module provides an in-kernel virtio-net backend that reduces QEMU userspace overhead for guest network traffic?
- tun
- macvtap
- bridge
- vhost_net Correct answer.
Explanation
vhost_net moves the virtio-net data plane into the host kernel, so packet handling for a guest's virtio NIC does not require as many QEMU userspace exits. tun supplies the tap character device, bridge provides Layer 2 forwarding, and macvtap combines a tap interface with bridge-like switching. The acceleration module specifically is vhost_net.
Question 17Virtualization
An administrator wants to run a custom script automatically whenever any QEMU domain on the host starts or stops. Where should the executable hook script be placed on a standard libvirt installation?
- /var/lib/libvirt/hooks/network
- /etc/libvirt/hooks/qemu Correct answer.
- /usr/share/libvirt/hooks/domain
- /etc/libvirt/qemu/hooks.d/global
Explanation
libvirt invokes /etc/libvirt/hooks/qemu for domain lifecycle events, passing the operation and domain name as arguments. Hook scripts must be executable and are called for QEMU domains; network events use a separate network hook. Placing a script in a documentation directory or a per-domain hooks.d directory does not register it as the global QEMU hook.
Question 18Virtualization
A live migration of a busy guest is progressing too slowly because the guest keeps dirtying memory. Which virsh migrate option asks libvirt to throttle guest vCPUs so the migration can converge?
- --auto-converge Correct answer.
- --tunnelled
- --compressed
- --postcopy
Explanation
--auto-converge detects that migration is not converging and slows the guest's vCPUs so fewer pages are dirtied during the final copy phase. --compressed enables memory compression, --postcopy switches to transferring pages after the guest resumes on the destination, and --tunnelled changes the transport encapsulation. Only auto-converge throttles vCPU execution.
Question 19Virtualization
A KVM guest must use preallocated 2 MiB hugepages from the host. Which domain XML fragment enables hugepage-backed guest memory?
- <memoryBacking><hugepages><page size='2048' unit='KiB'/></hugepages></memoryBacking> Correct answer.
- <memoryBacking><locked/><nosharepages/><source type='file'/><access mode='shared'/></memoryBacking>
- <numatune><memory mode='strict' nodeset='0'/><memnode cellid='0' mode='strict' nodeset='0'/></numatune>
- <cpu><topology sockets='2' cores='2' threads='1'/><cache mode='passthrough'/><feature policy='require' name='vmx'/></cpu>
Explanation
The memoryBacking/hugepages element tells libvirt to back the guest's RAM with host hugepages, and page size='2048' unit='KiB' selects 2 MiB pages. locked and nosharepages control swapping and page sharing but do not request hugepages. numatune binds memory to NUMA nodes, while cpu topology only describes virtual CPUs.
Question 20Virtualization
A host uses Intel VT-x and must allow KVM guests to run their own KVM guests after a reboot. Which persistent change enables nested virtualization?
- Enable Intel VT-d in the guest firmware and load the vfio-pci module with the guest's PCI device IDs.
- Set <cpu mode='host-model'/> in the guest domain XML and then restart the libvirtd service on the host.
- Add options kvm_intel nested=1 to /etc/modprobe.d/kvm.conf and reload kvm_intel. Correct answer.
- Add options kvm nested=1 to /etc/modprobe.d/kvm.conf and reload the kvm module.
Explanation
For Intel hosts, nested virtualization is controlled by the nested parameter of the kvm_intel module. Writing options kvm_intel nested=1 to a file under /etc/modprobe.d and reloading the module makes the setting persist across reboots. Loading kvm without the vendor-specific parameter, using host-model CPU XML, or enabling VT-d does not turn on nested VMX.
Question 21Virtualization
An administrator wants libvirt to allocate disk volumes directly from an LVM volume group on the host. Which storage pool type should be defined?
- iscsi
- logical Correct answer.
- dir
- netfs
Explanation
A logical storage pool uses an existing LVM volume group as its source and creates logical volumes as pool volumes. The dir type manages plain files in a directory, while netfs and iscsi are used for network-backed storage.
Question 22Virtualization
Which virsh subcommand starts a persistent domain that is defined in libvirt but currently shut off?
- virsh resume
- virsh start Correct answer.
- virsh create
- virsh define
Explanation
virsh start boots an already defined persistent domain from its stored XML configuration. virsh create starts a transient domain from an XML file, and virsh resume only unpauses a paused domain.
Question 23Virtualization
Which libvirt virtual network forward mode creates an isolated bridge that provides no forwarding to a physical network, allowing guests to communicate only with each other and the host?
- isolated Correct answer.
- nat
- route
- bridge
Explanation
The isolated forward mode creates a virtual bridge with no uplink, so guest traffic stays on that bridge and cannot reach external networks. NAT and route modes forward traffic through the host, while bridge mode attaches to an existing host bridge.
Question 24Virtualization
An administrator needs a new qcow2 overlay named snap1.qcow2 whose backing file is base.qcow2. Which command creates that overlay?
- qemu-img create -f qcow2 -b base.qcow2 -F qcow2 snap1.qcow2 Correct answer.
- qemu-img snapshot -c snap1 base.qcow2
- qemu-img resize --object backing=base.qcow2 snap1.qcow2
- qemu-img convert -O qcow2 -o backing_file=base.qcow2 base.qcow2 snap1.qcow2
Explanation
The qemu-img create command with -b sets the backing file, and -F records the backing file format so qcow2 metadata is interpreted correctly. This produces a copy-on-write overlay that stores only changed clusters.
Question 25Virtualization
A cluster must live-migrate guests between hosts whose CPU models are compatible but not identical. Which CPU mode in domain XML advertises a host-like CPU model while limiting features to those libvirt considers safely migratable?
- host-model Correct answer.
- custom
- qemu64
- host-passthrough
Explanation
host-model builds a CPU definition that closely matches the host but is constrained by libvirt's migration compatibility rules. host-passthrough exposes the host CPU exactly and can prevent migration to hosts with different CPU capabilities.
Question 26Virtualization
Which virsh subcommand reports the progress, remaining data, and status of an active live migration job?
- domstats
- domifstat
- domblkstat
- domjobinfo Correct answer.
Explanation
domjobinfo queries libvirt about an active job, including migration progress, dirty memory remaining, and job state. domblkstat and domifstat report block and interface statistics, while domstats collects broad resource statistics.
Question 27Virtualization
Which domain XML fragment assigns a fixed MAC address to a guest network interface?
- <mac address='52:54:00:12:34:56'/> Correct answer.
- <interface type='network'><source network='default'/></interface>
- <target dev='vnet0'/>
- <model type='virtio'/>
Explanation
The <mac address='...'/> element inside an <interface> definition sets the guest NIC's MAC address. The <source> element selects the network, <model> selects the device model, and <target> suggests the host-side interface name.
Question 28Virtualization
An administrator needs to replace the ISO image in a running guest's virtual CD-ROM drive without rebooting the guest. Which virsh subcommand is designed for this operation?
- blockcommit
- attach-disk
- change-media Correct answer.
- update-device
Explanation
change-media updates the backing file of a removable media device, such as a CD-ROM, and can apply the change to a running domain. attach-disk adds a new disk device instead of swapping media in an existing drive.
Question 29Virtualization
A qcow2 overlay has accumulated changes that must be merged into its backing file, after which the overlay can be discarded. Which qemu-img operation performs this merge?
- qemu-img check
- qemu-img rebase
- qemu-img commit Correct answer.
- qemu-img amend
Explanation
qemu-img commit copies the changes from an overlay image into its backing file, allowing the overlay to be removed afterward. amend changes image format options, rebase changes the backing file reference, and check verifies image consistency.
Question 30Virtualization
Which domain XML fragment pins vCPU 0 of a KVM guest to host CPUs 2 and 3?
- <cputune><vcpupin vcpu='0' cpuset='2-3'/></cputune> Correct answer.
- <cputune><emulatorpin cpuset='2-3'/></cputune>
- <cpu><topology sockets='2' cores='2'/></cpu>
- <numatune><memnode cellid='0' nodeset='2-3'/></numatune>
Explanation
The vcpupin element inside cputune maps a specific vCPU to a host CPU set, so vcpu='0' cpuset='2-3' pins vCPU 0 to host CPUs 2 and 3. emulatorpin controls the emulator thread, topology describes virtual CPU layout, and numatune constrains memory nodes.
Question 31Virtualization
An administrator must inspect a qcow2 disk image to learn its virtual size, its backing file, and its cluster size before deciding whether to clone it. Which command reports this metadata?
- qemu-img check base.qcow2
- qemu-img snapshot -l base.qcow2
- qemu-img resize base.qcow2
- qemu-img info base.qcow2 Correct answer.
Explanation
qemu-img info reports the image format, virtual size, on-disk size, backing file, and format-specific details such as the qcow2 cluster size. It is read-only, so it is safe to run against an image before cloning or converting it.
Question 32Virtualization
A guest NIC must connect directly to host interface eth1 through a macvtap device, with no software bridge involved. Which interface type in the domain XML provides this?
- <interface type='direct'> Correct answer.
- <interface type='network'>
- <interface type='user'>
- <interface type='bridge'>
Explanation
An interface with type='direct' creates a macvtap device on the host NIC named by the source dev attribute, and its mode attribute selects bridge, private, or vepa behavior. It bypasses a software bridge and is commonly used for direct guest connectivity to a physical network.
Question 33Virtualization
Which virsh subcommand asks a running domain to perform a graceful ACPI shutdown instead of terminating its QEMU process immediately?
- virsh undefine web
- virsh shutdown Correct answer.
- virsh destroy
- virsh suspend web
Explanation
virsh shutdown sends an ACPI shutdown request to the guest, allowing the guest OS to stop services and unmount filesystems cleanly. It requires the guest to honor ACPI and does not immediately kill the QEMU process.
Question 34Virtualization
A non-network PCI device has been bound to the vfio-pci driver on the host. Which domain XML element assigns that device directly to a KVM guest?
- <disk type='pci' device='disk'><source dev='/dev/sda'/></disk>
- <hostdev mode='subsystem' type='pci' managed='yes'/> Correct answer.
- <controller type='pci' model='pci-root' index='0'/>
- <interface type='hostdev' managed='yes'><source/></interface>
Explanation
A generic PCI device is assigned with hostdev mode='subsystem' type='pci'; the source element gives the host PCI address, and managed='yes' lets libvirt detach and reattach the device from the host driver. vfio-pci binding must be in place so the guest can drive the device directly.
Question 35Virtualization
An administrator boots a generic cloud image with virt-install and needs to set the guest hostname and inject an SSH public key on first boot without editing the image. Which virt-install option supplies this configuration?
- --extra-args
- --cloud-init Correct answer.
- --noautoconsole
- --import
Explanation
--cloud-init generates a NoCloud seed image containing user-data and meta-data, which cloud-init inside the guest reads on first boot to set the hostname, create users, and install SSH keys. The option works with an existing cloud image disk and does not require image modification.
Question 36Virtualization
Which domain XML fragment adds the virtio serial channel that qemu-guest-agent uses for communication with libvirt?
- <serial type='pty'><target port='0'/><address type='isa' iobase='0x3f8'/><alias name='serial0'/></serial>
- <console type='pty'><target type='serial' port='0'/><alias name='serial0'/></console>
- <rng model='virtio'><backend model='random'>/dev/urandom</backend><address type='pci'/></rng>
- <channel type='unix'><target type='virtio' name='org.qemu.guest_agent.0'/></channel> Correct answer.
Explanation
The qemu-guest-agent channel is a virtio serial channel whose target name is org.qemu.guest_agent.0; libvirt uses that name to find the agent socket. The guest must have qemu-guest-agent installed and running for commands such as virsh domfsfreeze to work.
Question 37Virtualization
A guest's memory must be allocated only from host NUMA nodes 0 and 1, and the allocation must fail rather than fall back to other nodes. Which domain XML fragment enforces this?
- <cputune><vcpupin vcpu='0' cpuset='0-1'/></cputune>
- <cpu><numa><cell id='0' cpus='0-1'/></numa></cpu>
- <memoryBacking><hugepages><page size='2048' unit='KiB'/></hugepages></memoryBacking>
- <numatune><memory mode='strict' nodeset='0-1'/></numatune> Correct answer.
Explanation
The numatune element binds guest RAM to host NUMA nodes; mode='strict' makes allocation fail if the specified nodes cannot satisfy it, while nodeset='0-1' names the allowed host nodes. This is separate from vCPU pinning and from defining guest NUMA topology.
Question 38Virtualization
After a base qcow2 image was moved to a new path, an existing overlay still points to the old backing file location. Which qemu-img subcommand rewrites the overlay's backing file reference without copying its data?
- qemu-img commit -b base.qcow2 overlay.qcow2
- qemu-img check overlay.qcow2
- qemu-img rebase -u -b /new/base.qcow2 overlay.qcow2 Correct answer.
- qemu-img convert -O qcow2 overlay.qcow2 /new/path/new.qcow2
Explanation
qemu-img rebase changes the backing file recorded in a qcow2 overlay. The -u flag updates the backing file reference without reading or rewriting the image data, which is safe only when the backing file contents are unchanged and just the path moved.
Question 39Virtualization
An administrator wants an external disk-only snapshot of a running guest so that the original qcow2 file becomes read-only and new writes go to a fresh overlay, without saving RAM state. Which command accomplishes this?
- virsh snapshot-create-as web snap1 --memspec file=/var/lib/libvirt/save/mem
- virsh snapshot-create-as web snap1 --disk-only --atomic Correct answer.
- virsh snapshot-create web --internal
- virsh snapshot-create-as web snap1 --quiesce
Explanation
snapshot-create-as with --disk-only creates an external snapshot: the current disk image is made read-only and a new overlay receives subsequent writes. Because no memory state is saved, the snapshot is a disk checkpoint rather than a complete running-state restore point.
Question 40Virtualization
An administrator wants libvirt to mount an NFS export itself and use it as a storage pool for disk images, rather than relying on a pre-mounted directory. Which pool type should be defined?
- dir
- netfs Correct answer.
- iscsi
- logical
Explanation
A netfs storage pool describes a network filesystem source-host, export path, and format-and libvirt mounts it at the pool target path. This differs from a dir pool, which only uses a directory that is already mounted on the host.
Question 41Virtualization
An administrator wants to manage the host-wide KVM instance and its persistent domains with virsh. Which connection URI selects the system libvirt instance on the local host?
- qemu+ssh://remote/system
- qemu:///system Correct answer.
- qemu:///session
- lxc:///system
Explanation
qemu:///system connects to the privileged libvirt instance that manages host-wide KVM domains, typically as root. qemu:///session creates a per-user unprivileged instance whose domains are not visible to other users. The SSH URI targets a remote host, and lxc:///system selects the LXC driver rather than QEMU/KVM.
Question 42Virtualization
An administrator already has a bootable qcow2 image and wants virt-install to define a KVM guest that boots from it directly, without running an OS installer. Which virt-install option requests this behavior?
- --import Correct answer.
- --location
- --cdrom
- --pxe
Explanation
The --import option tells virt-install to treat the supplied disk image as an existing boot disk and skip the installation phase. In contrast, --cdrom and --location start an installer from installation media, and --pxe makes the guest boot from the network.
Question 43Virtualization
A raw disk image must be converted to qcow2 format so that it can be used as a libvirt volume. Which command performs this conversion?
- qemu-img resize -f raw disk.raw qcow2
- qemu-img convert -f raw -O qcow2 disk.raw disk.qcow2 Correct answer.
- qemu-img create -f qcow2 disk.raw disk.qcow2
- qemu-img amend -f raw -O qcow2 disk.raw
Explanation
qemu-img convert reads the source in the format given by -f and writes a new image in the format given by -O, so a raw image becomes qcow2. By contrast, create builds an empty image, amend modifies an existing image's format-specific options, and resize changes capacity rather than converting format.
Question 44Virtualization
A running guest uses a virtio-blk disk backed by /var/lib/libvirt/images/data.qcow2, and the qcow2 file has already been enlarged with qemu-img resize. Which virsh subcommand notifies the running guest of the new disk capacity?
- virsh pool-refresh
- virsh domblkinfo
- virsh blockresize Correct answer.
- virsh vol-resize
Explanation
virsh blockresize updates the size of a block device as seen by a running domain, allowing the guest to notice that its backing file has grown. vol-resize changes a storage volume's allocation, domblkinfo only reports block device information, and pool-refresh re-reads a storage pool's contents.
Question 45Virtualization
An administrator attaches a network interface to a running domain with virsh attach-device web --file nic.xml; the interface works until the domain is restarted, after which it is gone. Which flag added to the same command makes the change part of the domain's persistent configuration?
- --current
- --live
- --config Correct answer.
- --persistent
Explanation
The --config flag writes the attached device into the persistent domain XML that libvirt uses the next time the domain is started. --live affects only the running domain state, and attach-device has no --persistent flag. The observed loss after restart shows that only the live state was changed.
Question 46Virtualization
An administrator needs to run a custom host-side script before and after each QEMU domain starts. In which directory must the script be placed so libvirt invokes it as the qemu hook?
- /etc/libvirt/hooks/ Correct answer.
- /var/lib/libvirt/hooks/
- /usr/share/libvirt/hooks/
- /etc/qemu/hooks/
Explanation
libvirt runs hook scripts from /etc/libvirt/hooks, naming each file after the driver, such as qemu for the QEMU/KVM driver. The script receives the operation, sub-operation, and domain name as arguments. Paths under /usr/share, /var/lib/libvirt, and /etc/qemu are not libvirt's hook location.
Question 47Virtualization
An Intel-based KVM host must allow its guests to run their own KVM virtual machines. Which host-side change enables nested virtualization?
- Set options kvm_intel nested=1 in /etc/modprobe.d/kvm_intel.conf and reload the kvm_intel module. Correct answer.
- Set <cpu mode='host-passthrough'/> in the guest XML without changing host modules.
- Set options kvm nested=1 in /etc/modprobe.d/kvm.conf and reload the kvm module.
- Run virsh setvcpus --nested on the guest domain.
Explanation
On Intel hosts, nested virtualization is controlled by the kvm_intel module parameter nested, enabled through a modprobe.d file followed by reloading that module. host-passthrough exposes host CPU features to the guest but does not enable nested support when the module parameter is off. virsh setvcpus --nested does not exist.
Question 48Virtualization
A domain has an internal snapshot named before-upgrade that captures disk contents and VM state. Which virsh subcommand returns the domain to exactly that snapshot?
- virsh snapshot-current before-upgrade
- virsh restore before-upgrade
- virsh snapshot-delete before-upgrade
- virsh snapshot-revert before-upgrade Correct answer.
Explanation
snapshot-revert restores a domain's disks and, for snapshots that include memory state, its running state to the named snapshot. snapshot-delete removes the snapshot, snapshot-current only displays the current snapshot, and restore loads a save-image file rather than a libvirt snapshot.
Question 49Virtualization
An administrator must obtain a value exposed only by the QEMU monitor, not by any standard virsh subcommand, from a running domain named web. Which command sends a human-monitor command to that domain's monitor?
- virsh send-key web "info block"
- virsh domcontrol web "info block"
- virsh qemu-monitor-command web --hmp "info block" Correct answer.
- virsh qemu-monitor-event web "info block"
Explanation
qemu-monitor-command passes a command to the QEMU monitor, and --hmp specifies human-monitor-command syntax such as info block. qemu-monitor-event waits for monitor events, domcontrol reports control channel state, and send-key injects keyboard events.
Question 50Virtualization
An administrator must convert a running VMware vSphere guest named app01 into a local libvirt/KVM guest, using vCenter at vcenter.example.com. Which command performs this conversion with virt-v2v?
- virt-p2v -ic vpx://[email protected]/Datacenter/esxi01 app01
- virt-v2v -i disk /vmfs/volumes/app01 -o qcow2
- virt-install --import --disk /vmfs/app01.vmdk
- virt-v2v -ic vpx://[email protected]/Datacenter/esxi01 -o libvirt -os default app01 Correct answer.
Explanation
virt-v2v with -ic vpx:// connects to vCenter as the input source, and -o libvirt writes a converted guest to a libvirt storage pool selected with -os. virt-p2v converts physical machines, virt-install --import only defines a guest from an existing disk, and -i disk expects a local disk path.