Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
10.2.5. Creating a Guest Virtual Machine Disk Backup
libvirt can communicate with qemu-ga to assure that snapshots of guest virtual machine file systems are consistent internally and ready for use on an as needed basis. Improvements in Red Hat Enterprise Linux 6 have been made to make sure that both file and application level synchronization (flushing) is done. Guest system administrators can write and install application-specific freeze/thaw hook scripts. Before freezing the filesystems, the qemu-ga invokes the main hook script (included in the qemu-ga package). The freezing process temporarily deactivates all guest virtual machine applications.
Just before filesystems are frozen, the following actions occur:
- File system applications / databases flush working buffers to the virtual disk and stop accepting client connections
- Applications bring their data files into a consistent state
- Main hook script returns
- qemu-ga freezes the filesystems and management stack takes a snapshot
- Snapshot is confirmed
- Filesystem function resumes
Thawing happens in reverse order.
Use the
snapshot-create-as
command to create a snapshot of the guest disk. See Section 14.15.2.2, “Creating a snapshot for the current domain” for more details on this command.
Note
An application-specific hook script might need various SELinux permissions in order to run correctly, as is done when the script needs to connect to a socket in order to talk to a database. In general, local SELinux policies should be developed and installed for such purposes. Accessing file system nodes should work out of the box, after issuing the
restorecon -FvvR
command listed in Table 10.1, “QEMU guest agent package contents” in the table row labeled /etc/qemu-ga/fsfreeze-hook.d/
.
The qemu-guest-agent binary RPM includes the following files:
File name | Description |
---|---|
/etc/rc.d/init.d/qemu-ga | Service control script (start/stop) for the QEMU guest agent. |
/etc/sysconfig/qemu-ga | Configuration file for the QEMU guest agent, as it is read by the /etc/rc.d/init.d/qemu-ga control script. The settings are documented in the file with shell script comments. |
/usr/bin/qemu-ga | QEMU guest agent binary file. |
/usr/libexec/qemu-ga/ | Root directory for hook scripts. |
/usr/libexec/qemu-ga/fsfreeze-hook | Main hook script. No modifications are needed here. |
/usr/libexec/qemu-ga/fsfreeze-hook.d/ | Directory for individual, application-specific hook scripts. The guest system administrator should copy hook scripts manually into this directory, ensure proper file mode bits for them, and then run restorecon -FvvR on this directory. |
/usr/share/qemu-kvm/qemu-ga/ | Directory with sample scripts (for example purposes only). The scripts contained here are not executed. |
The main hook script,
/usr/libexec/qemu-ga/fsfreeze-hook
logs its own messages, as well as the application-specific script's standard output and error messages, in the following log file: /var/log/qemu-ga/fsfreeze-hook.log
. For more information, refer to the qemu-guest-agent wiki page at wiki.qemu.org or libvirt.org.