On Thu, Jul 23, 2009 at 06:34:42PM +0100, Mark McLoughlin wrote: > In qemu-0.11 there is a 'pc-0.10' machine type which allows you to run > guests with a machine which is compatible with the pc machine in > qemu-0.10 - e.g. using the original PCI class for virtio-blk and > virtio-console and disabling MSI support in virtio-net. The idea here > is that we don't want to suprise guests by changing the hardware when > qemu is updated. > > I've just posted some patches for qemu-0.11 which allows libvirt to > canonicalize the 'pc' machine alias to the latest machine version. > > This patches makes us use that so that when a guest is configured to > use the 'pc' machine type, we resolve that to 'pc-0.11' machine and > save that in the guest XML. > > See also: > > https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI > > * src/qemu_conf.c: add qemudCanonicalizeMachine() to canonicalize > the machine type according to the machine aliases in capabilities > [...] > /* Format is: > - * <machine> <desc> [(default)] > + * <machine> <desc> [(default)|(alias of <canonical>)] > */ > static int > qemudParseMachineTypesStr(const char *output, > @@ -319,6 +319,15 @@ qemudParseMachineTypesStr(const char *output, > list[0] = machine; > nitems++; > } > + > + if ((t = strstr(p, "(alias of ")) && (!next || t < next)) { > + p = t + strlen("(alias of "); > + if (!(t = strchr(p, ')')) || (next && t >= next)) > + continue; > + > + if (!(machine->canonical = strndup(p, t - p))) > + goto error; > + } > } while ((p = next)); hum, if you get (alias of foo ) your canonical will end up being " foo " instead of "foo" maybe spaces should be stripped before and after the name (i.e. it would have been perfect in an XML attribute but well ...) [...] > +static int > +qemudCanonicalizeMachineFromInfo(virDomainDefPtr def, > + virCapsGuestDomainInfoPtr info, > + char **canonical) > +{ > + int i; > + > + *canonical = NULL; > + > + for (i = 0; i < info->nmachines; i++) { > + virCapsGuestMachinePtr machine = info->machines[i]; > + > + if (!machine->canonical) > + continue; > + > + if (strcmp(def->os.machine, machine->name) != 0) > + continue; > + > + if (!(*canonical = strdup(machine->canonical))) virReportOOMError(NULL) please :-) > + return -1; > + > + break; ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list