[Libguestfs] [PATCH v4 3/9] v2v: linux: Replace 'ki_supports_virtio' field.
Richard W.M. Jones
rjones at redhat.com
Thu Apr 6 15:11:56 UTC 2017
On Thu, Apr 06, 2017 at 05:06:08PM +0200, Pino Toscano wrote:
> On Thursday, 6 April 2017 12:04:21 CEST Richard W.M. Jones wrote:
> > Previously the kernel_info field 'ki_supports_virtio' really meant
> > that the kernel supports virtio-net. That was used as a proxy to mean
> > the kernel supports virtio in general.
> >
> > This change splits the field so we explicitly test for both virtio-blk
> > and virtio-net drivers, and store the results as separate fields.
> >
> > The patch is straightforward, except for the change to the
> > 'rebuild_initrd' function. Instead of making the module list
> > conditional on whether virtio-net is available and using the old
> > (probably wrong) fallback if it happens to be unavailable, this now
> > tries to enable the common virtio kernel modules (just the ones needed
> > for virtio-blk and virtio-net to work). The fallback is only used if
> > none of the common virtio modules can be found.
> > ---
> > [...]
> > let best_kernel =
> > let compare_best_kernels k1 k2 =
> > - let i = compare k1.ki_supports_virtio k2.ki_supports_virtio in
> > + let i = compare k1.ki_supports_virtio_net k2.ki_supports_virtio_net in
>
> Should this consider both virtio-net+virtio-blk to determine that a
> kernel "supports virtio"?
TBH "supports virtio" is not really a thing. Supports the virtio bus?
That's not useful unless it also supports specific virtio devices.
In any case it turns out we don't need to know if a kernel supports
virtio except in one place: sorting the kernels. Arguably that would
be better if it weighted kernels by how many virtio devices they
support or something like that. I might just add that in fact.
> > -let string_of_kernel_info ki =
> > - sprintf "(%s, %s, %s, %s, %s, %s, virtio=%b, xen=%b, debug=%b)"
> > - ki.ki_name ki.ki_version ki.ki_arch ki.ki_vmlinuz
> > - (match ki.ki_initrd with None -> "None" | Some f -> f)
> > - (match ki.ki_config_file with None -> "None" | Some f -> f)
> > - ki.ki_supports_virtio ki.ki_is_xen_pv_only_kernel ki.ki_is_debug
> > +let print_kernel_info chan prefix ki =
>
> Can you please expose this function (as interface in linux_kernels.mli)
> in this patch already (instead of patch #9)?
Will do, thanks for the review.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list