Is it possible to insert and eject a USB image in kvm/qemu/libvirt or are the only dynamically changeable devices cdroms and floppies? I've searched the web and I'm either not looking for the right terms or it's obscure. I should mention that I'm not talking about a connecting a physical host USB drive to a guest image, I want to be able to use a qcow image as the source. The context is that I want to be able to revert a VM image back to a prior state (internal snapshot) when testing but be able to retain some data without having to go to the effort of transferring it across the network. I've excluded cdroms as an option because they are read-only (correct me if I'm wrong on this) and require some effort to (re)build. Floppy drives appear to be limited to 1.44M which makes sense but is very limiting. Network mounts (NFS, Samba, etc.) require a server supporting the selected style of filesystem sharing over the network. I'm not sure I want to find out what happens to filesystem passthrough when a revert is done (unless someone knows and it's beneficial). I tried creating a partition associated with the VM but not auto-mounted, even if I unmounted the partition before reverting its state was rolled back. I possibly could get exotic here by setting the immutable attribute after unmounting the partition but, again, I'm hoping for something a little simpler and more straightforward. If there's a workable option I haven't considered I'm open to that. Thanks for any input.
On Sat, Mar 04, 2017 at 01:14:39AM -0600, Leroy Tennison wrote:>Is it possible to insert and eject a USB image in kvm/qemu/libvirt or >are the only dynamically changeable devices cdroms and floppies? I've >searched the web and I'm either not looking for the right terms or it's >obscure. I should mention that I'm not talking about a connecting a >physical host USB drive to a guest image, I want to be able to use a >qcow image as the source. > >The context is that I want to be able to revert a VM image back to a >prior state (internal snapshot) when testing but be able to retain some >data without having to go to the effort of transferring it across the >network. I've excluded cdroms as an option because they are read-only >(correct me if I'm wrong on this) and require some effort to (re)build. >Floppy drives appear to be limited to 1.44M which makes sense but is >very limiting. Network mounts (NFS, Samba, etc.) require a server >supporting the selected style of filesystem sharing over the network. >I'm not sure I want to find out what happens to filesystem passthrough >when a revert is done (unless someone knows and it's beneficial). >I'm probably misunderstanding what you want precisely. What I understood at first was that you just want to get some data back from a VM before restoring it to a previous state. And I wondered what's the effort there since you can just use scp, rsync or just netcat =) Reading the mail third time I think I got it, but I need you to confirm so that I'm sure I did understand it right. You probably want to have a filesystem attached all the time, do stuff on the machine, have stuff saved on that filesystem and then revert it without the aforementioned filesystem being touched in any way. And probably doing this multiple times, that's why copying it every time is time-consuming in a long run.>I tried creating a partition associated with the VM but not >auto-mounted, even if I unmounted the partition before reverting its >state was rolled back. I possibly could get exotic here by setting the >immutable attribute after unmounting the partition but, again, I'm >hoping for something a little simpler and more straightforward. If >there's a workable option I haven't considered I'm open to that. >How are you "reverting back" the state? If you have a snapshot for the machine you can specify which disks are supposed to be part of that snapshot so that you can revert everything except one disk that you use for some results, for example. Would that be an option for you?>Thanks for any input. > >_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
On Sat, Mar 04, 2017 at 01:14:39AM -0600, Leroy Tennison wrote:> Is it possible to insert and eject a USB image in kvm/qemu/libvirt or are > the only dynamically changeable devices cdroms and floppies? I've searched > the web and I'm either not looking for the right terms or it's obscure. I > should mention that I'm not talking about a connecting a physical host USB > drive to a guest image, I want to be able to use a qcow image as the source.It depends on what kind of USB device you attach. If you attach a USB hard disk, then to dynamically change the backing store image, you would need to do USB hotunplug+hotplug to remove the "old" drive & add a "new" drive. If you were to attacha USB cdrom, then you have the choice of simply ejecting the media, but can still also do hotunplug+hotplug.> > The context is that I want to be able to revert a VM image back to a prior > state (internal snapshot) when testing but be able to retain some data > without having to go to the effort of transferring it across the network. > I've excluded cdroms as an option because they are read-only (correct me if > I'm wrong on this) and require some effort to (re)build. Floppy drives > appear to be limited to 1.44M which makes sense but is very limiting.Correct wrt cdroms & floppies.> Network mounts (NFS, Samba, etc.) require a server supporting the selected > style of filesystem sharing over the network. I'm not sure I want to find > out what happens to filesystem passthrough when a revert is done (unless > someone knows and it's beneficial). > > I tried creating a partition associated with the VM but not auto-mounted, > even if I unmounted the partition before reverting its state was rolled > back. I possibly could get exotic here by setting the immutable attribute > after unmounting the partition but, again, I'm hoping for something a little > simpler and more straightforward. If there's a workable option I haven't > considered I'm open to that.It sounds like you should want to be using qcow2 internals snapshots to capture memory+disk state, or if you wnt to get more advanced libvirt has APIs to allow fine grained creation of snapshots in standalone files. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|