Hi Richud,
finally I had some time to take a deeper look into this again - for too long it 
was teasing me being unread in my inbox :-)

TL;DR:
- to update the machine type of a snapshot use "virsh edit <guestname>" before 
start
  Just as you'd do with a guest without snapshots after upgrade.
  virsh snapshot-revert <guestname> <snapshot>
  virsh edit <guestname> (set type)
  virsh start <guestname>

---

To test this as mentioned by richud he experienced that by 18.04->18.10 
upgrades. But if you just start on 18.04 all will work. The reason is that this 
began in zesty (or other EOL releases).
To reproduce that "today" one can start on the qemu level of Bionic (which 
still supports zesty machine type) and there create a guest. Then shut it down, 
and modify the machine type via "virsh edit <guestname>" to be 

To go back and forth on qemu versions more easily we can use the cloud archive 
[2].
To do so we can:
Well usualyl we could, but just rocky had no qemu bundled :-/
Lets use stein (which is note released yet) instead
 $ sudo add-apt-repository ppa:ubuntu-cloud-archive/stein-staging
 # now we are on a similar level as Ubuntu 18.10
 $ sudo ppa-purge  ppa:ubuntu-cloud-archive/stein-staging
 # back at the 18.04 level

With that as preparation I wanted to create the case myself to check how
one would/could update the machine types of a snapshot. I'd really hate
if we'd have to keep machine types almost indefinetly due to that and
updating them (as mentioned) is strongly recommended. But there needs to
be some reasonable way to start these old snapshots again (with new
machine types IMHO). So lets give all of that some analysis.

Virt manager does use --redefine in some cases (code has it, unclear when used 
so far).
I logged and the normal button in the UI does not set it:
 [Do, 14 Feb 2019 10:02:31 virt-manager 8383] DEBUG (domain:1233) Creating 
snapshot flags=0 xml=
 <domainsnapshot>
   <name>snapshot1-virt-manager</name>
 </domainsnapshot>
Virsh users can set that as needed) when creating the snapshot.
That said it is meant that all elements produced by snapshot-dumpxml are valid.
Well lets try with both, as one can "redefine" later if needed.

What I get with
 $ virsh snapshot-dumpxml <guest> <snapshot>
actually already LGTM

It looks like a "normal" domain XML plus some data about the snapshot itself
  <memory snapshot='no'/>
  <disks>
    <disk name='vda' snapshot='internal'/>
    <disk name='vdb' snapshot='internal'/>
  </disks>

It also has the machine type in just this XML and there even is a snapshot-edit 
command.
So one could
 $ virsh snapshot-edit <guest> <snapshot>
To modify things.
Just as you already did in the original bug report, but just change the type 
there instead of patching qemu.

That actually seems as modifiable as the normal domain definition.
There we could update the machine type to to the latest recommended (or any 
other type) as needed.
Doing so on the reporting issue.

I'd not recommend doing that with live snapshots as the virtual-machine might 
not match what the guest expects after being resumed from memory.
But for the sake of a try I did so.

Test
1. create guest
2. shut the guests down
3. set type to zesty with virsh edit
$ virsh list --all
 Id    Name                           State
 ----------------------------------------------------
 5     disco-mt-livesnap-zesty        running
 -     disco-mt-zesty                 shut off
4. take snapshots
 $ virsh snapshot-create disco-mt-zesty
 Domain snapshot 1550137482 created
 $ virsh snapshot-create disco-mt-livesnap-zesty
 Domain snapshot 1550137527 created
5. upgrade to newer qemu
 $ sudo add-apt-repository ppa:ubuntu-cloud-archive/stein-staging
 $ sudo apt upgrade
6. revert guests to snapshot
 $ virsh snapshot-revert disco-mt-zesty 1550137482
7. try to start guests (expected to not work)
 $ virsh start disco-mt-zesty
   error: internal error: process exited while connecting to monitor: 
2019-02-14T09:49:55.921906Z qemu-system-x86_64: -enable-kvm: unsupported 
machine type 'pc-i440fx-zesty'
   # fails as expected
 $ virsh snapshot-revert disco-mt-livesnap-zesty 1550137527
   # this even works, as it is still the same (old) qemu process
   # to trigger issues with the live snapshot we need to stop and start the 
guest
   # When restarting you get the expected issue just as we know and should 
follow [3]
 $ virsh shutdown disco-mt-livesnap-zesty
 $ virsh edit disco-mt-livesnap-zesty (update type)
 $ virsh start disco-mt-livesnap-zesty
   # ow we can see the issue
 $ virsh snapshot-revert disco-mt-livesnap-zesty 1550137527
   error: revert requires force: Target domain machine type pc-i440fx-zesty 
does not match source pc-i440fx-disco
7. lets fix the issue by adapting the type
There is no hope for live snapshots, as I said the kind of virtual machine just 
doesn't exist anymore
But live snapshots are rare (and unreliable) anyway, furthermore people don't 
keep them a long time.
And since the requirement to be an issue is to have restarted the guest (see 
#6) this isn't a real issue.
or the shutoff snapshots the story is different, those are nice for backup and 
upgrade management.
here adapt the machine type either in the domain after revert:
  $ virsh snapshot-revert disco-mt-zesty 1550137482
  $ virsh edit disco-mt-zesty (set type)
  $ virsh start disco-mt-zesty
The guest starts just fine and is happy.

You can even use the virt-machine-type snap [1] that helps with updating to the 
latest type.
It is experimental thou, you can get it with
 $ snap install virt-machine-type --devmode --edge

Thanks once more for the discussion Richud, I'll update the Wiki page [3] to 
have a note about snapshots as well.
But I don't think I want/need to change the package as we'd really get people 
off the old types for their own benefits.
Therefore I'll set the bug state to invalid (no action needed), but let me know 
if this helps you and in case you have other opinions - always worth a talk.


[1]: https://snapcraft.io/virt-machine-type
[2]: https://wiki.ubuntu.com/OpenStack/CloudArchive
[3]: https://wiki.ubuntu.com/QemuKVMMigration#Upgrade_machine_type

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1802944

Title:
  error: unsupported configuration: Target domain machine type

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1802944/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to