<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 6, 2018 at 11:03 AM Daniel P. Berrangé <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Aug 06, 2018 at 07:04:32AM +0200, Christian Ehrhardt wrote:<br>
> On Sun, Aug 5, 2018 at 10:53 AM Daniel P. Berrangé <<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>><br>
> wrote:<br>
> <br>
> > It is increasingly likely that some distro is going to change the<br>
> > default "x86" machine type in QEMU from "pc" to "q35". This will<br>
> > certainly break existing applications which write their XML on the<br>
> > assumption that its using a "pc" machine by default. For example they'll<br>
> > lack a IDE CDROM and get PCI-X instad of PCI which changes the topology<br>
> > radically.<br>
> ><br>
> <br>
> Hi,<br>
> Distributions carry custom manchine types for quite a while now to<br>
> encapsulate differences of backports and similar [1][2].<br>
> That said, in all those "pc" isn't the default for a long time and it was<br>
> actually quite comfortable to be able to switch the default from qemu where<br>
> changes take place and not having to touch libvirt in that regard.<br>
> <br>
> I agree that pc->q35 is a "bigger" switch in terms of default behavior than<br>
> default enabling a single new feature out of the i440fx scope, therefore I<br>
> understand the preference of libvirt to preserve the old default.<br>
> But with the change proposed here the "default" machine type of qemu looses<br>
> a lot of its (benficial) implications that that so far.<br>
> <br>
> Ideally we'd not switch just back to "pc" here, but to something qemu can<br>
> mark like a certain i400fx-abcd type.<br>
> I know qemu can only have one default, and it is about to change - which<br>
> from a pure qemu's POV makes sense.<br>
> We always carried an alias "ubuntu" that changed with each release and<br>
> pointed to the preferred default type, just like "pc" pointed to the most<br>
> recent pc-i440 type.<br>
> So maybe I just modify the patch proposed here for Ubuntu to pick "ubuntu"<br>
> instead of "pc" - no sure yet?<br>
> <br>
> Or we can carry a revert of the patch discussed here (but then would get<br>
> all the pain of old working XML tools failing, doesn't sound like a good<br>
> option),<br>
> but I wanted to know if there were some more complex considerations have<br>
> been done already how those cases are supposed to be handled?<br>
> <br>
> [1]: <a href="https://bugzilla.redhat.com/show_bug.cgi?id=895959" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=895959</a><br>
> [2]: <a href="https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1294823" rel="noreferrer" target="_blank">https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1294823</a><br>
<br>
There's multiple things at play. First all the canonical machine type<br>
names which are versioned<br>
<br>
  pc-i440fx-2.5.0<br>
  pc-i440fx-2.6.0<br>
  pc-i440fx-2.7.0<br>
  ...<br>
  pc-i440fx-2.10.0<br>
  pc-q35-2.5.0<br>
  pc-q35-2.6.0<br>
  pc-q35-2.7.0<br>
  ...<br>
  pc-q35-2.10.0<br>
<br>
Then there are the convenient aliases mapping to the most recent versioned<br>
machine type<br>
<br>
  pc  -> pc-i440fx-2.10.0<br>
  q35 -> pc-q35-2.10.0<br>
<br>
Finally, the versioned machine type that is resolved by the "pc" alias<br>
is listed as the default.<br>
<br>
Even when distros ship custom machine types this has little to no impact<br>
on applications. It generally just means the version number part of the<br>
machine type changes. 'pc' still resolves to the most recent versioned<br>
machine type, and is listed as the default.<br>
<br>
The key thing is that applicatons (virt-install, virt-manager, oVirt,<br>
OpenStack, etc) need to know whether they're using "pc" or "q35" when<br>
building guest XML, as that difference is used to trigger different<br>
code paths.<br>
<br>
In looking at the code for various mgmt apps we see alot of patterns<br>
like<br>
<br>
   if machine != NULL & strstr(machine, "q35")<br>
      ...write XML suitable for q35...<br>
   else<br>
      ...write XML suitable for pc...<br>
<br>
IOW, the application is assuming that if the user hasn't requested an<br>
explicit type, they'll get "i440fx" based "pc".<br>
<br>
If QEMU changes its default so that the "q35" alias is marked as the<br>
default, then this will break every single mgmt application that we<br>
have looked at. This is exactly the kind of thing that libvirt promises<br>
will not happen to mgmt apps, so we must guarantee that if no machine<br>
type is listed in the XML, then app will always get the i440fx based<br>
"pc" machine, and not "q35".<br>
<br>
WRT your point about the "ubuntu" machine type. I think using such a<br>
machine type name is not a desirable thing todo. No application that<br>
I've looked at, nor libvirt itself, has logic to know whether "ubuntu"<br>
machine type is based on i440fx or q35 chipsets. I expect that, by<br>
luck, they'll mostly end up treating it as i440fx based, since most<br>
apps do an explicit check for "q35" in the name and assume everything<br>
else is i440fx.<br>
<br>
So the general guidance we give is it that distros should honour the<br>
QEMU machine type name prefixes "pc-q35-" and "pc-i440fx-", and only<br>
ever change the version suffix if they want to add custom distro<br>
specific variants. ie don't invent new prefixes, nor new aliases,<br>
as no application will know what todo with those.<br></blockquote><div><br></div><div>IMHO new aliases are actually fine, as they will never stay the alias but be resolve on first definition.</div><div>If a management App/User knows about them it is free to pass them, but then gets mapped to the more defined names automatically.</div><div>If App/User didn't know about them, then hopefully they won't specify it and use the full definitions.</div><div><br></div><div>The real Distribution machine types in the Ubuntu case already follow the preferred prefix-known like pc-i440fx-... and pc-q35-... pattern.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On that basis I'd ecourage you to look at whether you can phase out<br>
the "ubuntu" machine type alias.</blockquote><div><br></div><div>The type was invented before my time, it might have been intended to NOT imply machine types.</div><div>We kept "pc" pointing to the upstream types like pc-i440fx-2.11 and "ubuntu" was pointing to the latest Distro type like pc-i440fx-bionic.<span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style=""><br></span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">We could instead of the alias "ubuntu" modify the "pc" alias to alias the particular Distro Type we want, but I always liked that we did not touch the existing types at all :-/</span><br></span></div><div><span style="font-family:monospace"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Eventually we will need the same that your patch implements here, to not break the default.</span></span></div><div><span style="font-family:monospace"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">But we need that to point to the most recent Distribution type - so I have to pick one of</span></span></div><div><span style="font-family:monospace"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> - keep ubuntu alias, use that to fall back to from libvirt</span></span></div><div><span style="font-family:monospace"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> - phase out ubuntu alias, but then "pc" would have to point to the Distro type - I can't guarantee that back in time (new libvirt + old qemu remote)</span></span></div><div><span style="font-family:monospace"><br></span></div>At least it is no real type that has to be kept and "only" an alias.</div><div class="gmail_quote">I'll look at phasing out ubuntu or not - starting with an internal discussion on the next sprint - thanks!</div><div class="gmail_quote"><div><br></div><div>Thanks also for the Big picture reply - keeping the defaults sane and establishing an per-guest opt-in via metadata sounds fine.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards,<br>
Daniel<br>
-- <br>
|: <a href="https://berrange.com" rel="noreferrer" target="_blank">https://berrange.com</a>      -o-    <a href="https://www.flickr.com/photos/dberrange" rel="noreferrer" target="_blank">https://www.flickr.com/photos/dberrange</a> :|<br>
|: <a href="https://libvirt.org" rel="noreferrer" target="_blank">https://libvirt.org</a>         -o-            <a href="https://fstop138.berrange.com" rel="noreferrer" target="_blank">https://fstop138.berrange.com</a> :|<br>
|: <a href="https://entangle-photo.org" rel="noreferrer" target="_blank">https://entangle-photo.org</a>    -o-    <a href="https://www.instagram.com/dberrange" rel="noreferrer" target="_blank">https://www.instagram.com/dberrange</a> :|<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(136,136,136);font-size:12.8px">Christian Ehrhardt</span><div style="color:rgb(136,136,136);font-size:12.8px">Software Engineer, Ubuntu Server</div><div style="color:rgb(136,136,136);font-size:12.8px">Canonical Ltd</div></div></div></div></div></div>