[libvirt] Tracking VM installations

Hi, We have a requirement in Boxes for showing progress bars on VMs under installation: https://github.com/gnome-design-team/gnome-mockups/raw/master/boxes/boxes-in... https://bugzilla.gnome.org/show_bug.cgi?id=679107 However, we are bit clueless on how that could be achieved. The only idea I have is to know the number of passes (reboots) and typical disk usage in each pass for "every" (we only do this for express installs so we don't need this for all) OS and estimate the progress based on that knowledge. If that idea is worth looking into, we'll need this information in libosinfo and hence me cross-posting this to virt-tools-list. Other ideas welcome! Keep in mind that we don't need to be very accurate, just accurate enough to not annoy the user. -- Regards, Zeeshan Ali (Khattak) FSF member#5124

On Wed, Jul 04, 2012 at 10:45:29PM +0300, Zeeshan Ali (Khattak) wrote:
Hi,
We have a requirement in Boxes for showing progress bars on VMs under installation:
https://github.com/gnome-design-team/gnome-mockups/raw/master/boxes/boxes-in... https://bugzilla.gnome.org/show_bug.cgi?id=679107
However, we are bit clueless on how that could be achieved. The only idea I have is to know the number of passes (reboots) and typical disk usage in each pass for "every" (we only do this for express installs so we don't need this for all) OS and estimate the progress based on that knowledge. If that idea is worth looking into, we'll need this information in libosinfo and hence me cross-posting this to virt-tools-list.
Other ideas welcome! Keep in mind that we don't need to be very accurate, just accurate enough to not annoy the user.
It's a tricky one :-) You can take a screenshot of the guest (assuming a visual installation). Oz does this. Displaying an icon-sized screenshot might be a surrogate for displaying a progress bar, since many installers will display a progress bar themselves. https://github.com/clalancette/oz/blob/74d99497840e3bade4d679ed94cf9a4628827... You can use libguestfs (specifically, virt-df) to display the amount of disk space used in the guest. For many installers, disk space will monotonically increase as it proceeds, although of course you've no idea what the final disk usage will be. You can turn this into a pulse-mode progress bar. http://libguestfs.org/virt-df.1.html Oz also uses network and disk activity to tell if the installer is making progress. This again doesn't tell you when the installer is going to finish, but it allows you to do a pulse-mode bar. https://github.com/clalancette/oz/blob/74d99497840e3bade4d679ed94cf9a4628827... Finally I've always thought it would be a good idea if guests communicated information down to the host about progress, whether that is progress booting or progress installing. There is (on PC hardware) even an I/O port reserved for this purpose (port 0x80)! You'd have to get buy-in and get it upstream in qemu and every installer out there. ttp://stackoverflow.com/questions/6793899/what-does-the-0x80-port-address-connects/6796109#6796109 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

On Thu, Jul 5, 2012 at 12:09 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Wed, Jul 04, 2012 at 10:45:29PM +0300, Zeeshan Ali (Khattak) wrote:
Hi,
Hey Richard,
We have a requirement in Boxes for showing progress bars on VMs under installation:
https://github.com/gnome-design-team/gnome-mockups/raw/master/boxes/boxes-in... https://bugzilla.gnome.org/show_bug.cgi?id=679107
However, we are bit clueless on how that could be achieved. The only idea I have is to know the number of passes (reboots) and typical disk usage in each pass for "every" (we only do this for express installs so we don't need this for all) OS and estimate the progress based on that knowledge. If that idea is worth looking into, we'll need this information in libosinfo and hence me cross-posting this to virt-tools-list.
Other ideas welcome! Keep in mind that we don't need to be very accurate, just accurate enough to not annoy the user.
It's a tricky one :-)
Indeed. :)
You can take a screenshot of the guest (assuming a visual installation). Oz does this. Displaying an icon-sized screenshot might be a surrogate for displaying a progress bar, since many installers will display a progress bar themselves. https://github.com/clalancette/oz/blob/74d99497840e3bade4d679ed94cf9a4628827...
Well they usually don't do it from start to finish. E.g Anaconda show separate progress bars at different stages but mainly at package installations. Although our progressbar won't be very different from that if we base it on disk allocation but a. ours will be a lot more visible and it'll be there from the start.
You can use libguestfs (specifically, virt-df) to display the amount of disk space used in the guest.
For target disk, we use libvirt's storage volume API and that provides us API to get current allocation.
For many installers, disk space will monotonically increase as it proceeds, although of course you've no idea what the final disk usage will be. You can turn this into a pulse-mode progress bar. http://libguestfs.org/virt-df.1.html
Well, that would be too easy then. :) If we fail to find any way to do what we want, we can think about doing pulsemode progressbar instead.
Oz also uses network and disk activity to tell if the installer is making progress. https://github.com/clalancette/oz/blob/74d99497840e3bade4d679ed94cf9a4628827...
Oh, this would be another thing we'd want to do as well: Inform the user if installer is hung for too long and provide option to delete the VM or ignore..
Finally I've always thought it would be a good idea if guests communicated information down to the host about progress, whether that is progress booting or progress installing. There is (on PC hardware) even an I/O port reserved for this purpose (port 0x80)! You'd have to get buy-in and get it upstream in qemu and every installer out there. ttp://stackoverflow.com/questions/6793899/what-does-the-0x80-port-address-connects/6796109#6796109
That would indeed be awesome but it seems way too much work and fight (not to mention, its impossible to fix this in proprietary OSs if they don't already support this) for just one progress bar. Thanks for your input btw! -- Regards, Zeeshan Ali (Khattak) FSF member#5124

On Thu, Jul 05, 2012 at 04:49:49AM +0300, Zeeshan Ali (Khattak) wrote:
On Thu, Jul 5, 2012 at 12:09 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
You can use libguestfs (specifically, virt-df) to display the amount of disk space used in the guest.
For target disk, we use libvirt's storage volume API and that provides us API to get current allocation.
libvirt storage API gives you a different number (blocks allocated) so it won't work for VMs backed with LVs or preallocated files. virt-df looks inside the filesystem(s). However a guest agent will give you the most accurate figures when the guest is running, and I imagine a guest agent may even be able to query the installer somehow.
Finally I've always thought it would be a good idea if guests communicated information down to the host about progress, whether that is progress booting or progress installing. There is (on PC hardware) even an I/O port reserved for this purpose (port 0x80)! You'd have to get buy-in and get it upstream in qemu and every installer out there. http://stackoverflow.com/questions/6793899/what-does-the-0x80-port-address-c...
That would indeed be awesome but it seems way too much work and fight (not to mention, its impossible to fix this in proprietary OSs if they don't already support this) for just one progress bar.
I wouldn't necessarily discount this one. It's a standard of sorts, and useful in other scenarios that we very much care about, eg. getting a libvirt event when a guest has started booting, finished booting, is ready for login, etc. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw

On Thu, Jul 05, 2012 at 08:54:20AM +0100, Richard W.M. Jones wrote:
On Thu, Jul 05, 2012 at 04:49:49AM +0300, Zeeshan Ali (Khattak) wrote:
On Thu, Jul 5, 2012 at 12:09 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
You can use libguestfs (specifically, virt-df) to display the amount of disk space used in the guest.
For target disk, we use libvirt's storage volume API and that provides us API to get current allocation.
libvirt storage API gives you a different number (blocks allocated) so it won't work for VMs backed with LVs or preallocated files. virt-df looks inside the filesystem(s). However a guest agent will give you the most accurate figures when the guest is running, and I imagine a guest agent may even be able to query the installer somehow.
Finally I've always thought it would be a good idea if guests communicated information down to the host about progress, whether that is progress booting or progress installing. There is (on PC hardware) even an I/O port reserved for this purpose (port 0x80)! You'd have to get buy-in and get it upstream in qemu and every installer out there. http://stackoverflow.com/questions/6793899/what-does-the-0x80-port-address-c...
That would indeed be awesome but it seems way too much work and fight (not to mention, its impossible to fix this in proprietary OSs if they don't already support this) for just one progress bar.
I wouldn't necessarily discount this one. It's a standard of sorts, and useful in other scenarios that we very much care about, eg. getting a libvirt event when a guest has started booting, finished booting, is ready for login, etc.
IMHO this is all a job for a guest agent to do using virtio-serial. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Wed, Jul 04, 2012 at 10:45:29PM +0300, Zeeshan Ali (Khattak) wrote:
Hi,
We have a requirement in Boxes for showing progress bars on VMs under installation:
https://github.com/gnome-design-team/gnome-mockups/raw/master/boxes/boxes-in... https://bugzilla.gnome.org/show_bug.cgi?id=679107
However, we are bit clueless on how that could be achieved. The only idea I have is to know the number of passes (reboots) and typical disk usage in each pass for "every" (we only do this for express installs so we don't need this for all) OS and estimate the progress based on that knowledge. If that idea is worth looking into, we'll need this information in libosinfo and hence me cross-posting this to virt-tools-list.
Other ideas welcome! Keep in mind that we don't need to be very accurate, just accurate enough to not annoy the user.
I don't see any general purpose way todo a progress feedback. The best you can do is to show whether /something/ is happening (by looking at disk & net I/O stats). If you want actual progress feedback then you're looking at modifying the guest OS init process / installer to send feedback over a virtio-serial device directly, or indirectly via a guest agent. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Richard W.M. Jones
-
Zeeshan Ali (Khattak)