sanity-meta-virt.bbclass: add class for bbappend files checking
PATCH v3 1/3 sanity-meta-virt.bbclass: add class for bbappend files checking
Add a new class, sanity-meta-virt.bbclass, to check for whether necessary settings are available for bbappend files in this layer to be effective, and warn users if not.
In addition, a variable SKIP_SANITY_BBAPPEND_CHECK is added to enable users to explicitly skip the checking to avoid unwanted warnings.
--- classes/sanity-meta-virt.bbclass | 10 ++++++++++ conf/layer.conf | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 classes/sanity-meta-virt.bbclass
classes/sanity-meta-virt.bbclass new file +10 -0
@@ -0,0 +1,10 @@ +addhandler virt_bbappend_distrocheck +virt_bbappend_distrocheck[eventmask] = "bb.event.ConfigParsed" +python virt_bbappend_distrocheck() { + skip_check = e.data.getVar('SKIP_SANITY_BBAPPEND_CHECK') == "1" + if 'virtualization' not in e.data.getVar('DISTRO_FEATURES').split() and not skip_check: + bb.warn("You have included the meta-virtualization layer, but \ +'virtualization' has not been enabled in your DISTRO_FEATURES. Some bbappend files \ +may not take effect. See the meta-virtualization README for details on enabling \ +virtualization support.") +}
conf/layer.conf +4 -0
@@ -22,3 +22,7 @@ require conf/distro/include/virt_security_flags.inc PREFERRED_PROVIDER_virtual/runc ?= "runc-docker" PREFERRED_PROVIDER_virtual/containerd ?= "containerd-docker" + +# Sanity check for meta-virtualization layer. +# Setting SKIP_SANITY_BBAPPEND_CHECK to "1" would skip the bbappend files check. +INHERIT += "sanity-meta-virt"
Signature · 1 line
2.11.0
PATCH v3 2/3 linux-yocto: make bbappend have effect conditionally
Make these bbappend files to take effect only when DISTRO_FEATURES contain 'virtualization'. Otherwise, we would meet failure failure at system booting up qemux86. Related logs are as below.
systemd-modules-load[113]: Failed to insert 'kvm_amd': Operation not supported systemd-modules-load[113]: Failed to insert 'kvm_intel': Operation not supported
--- recipes-kernel/linux/linux-yocto_4.10.bbappend | 21 +-------------------- recipes-kernel/linux/linux-yocto_4.12.bbappend | 21 +-------------------- recipes-kernel/linux/linux-yocto_4.4.bbappend | 21 +-------------------- recipes-kernel/linux/linux-yocto_4.9.bbappend | 21 +-------------------- recipes-kernel/linux/linux-yocto_virtualization.inc | 20 ++++++++++++++++++++ 5 files changed, 24 insertions(+), 80 deletions(-) create mode 100644 recipes-kernel/linux/linux-yocto_virtualization.inc
recipes-kernel/linux/linux-yocto_4.10.bbappend +1 -20
@@ -1,20 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://xt-checksum.scc \ - file://ebtables.scc \ - file://vswitch.scc \ - file://lxc.scc \ - file://docker.scc \ - " -KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" - -KERNEL_MODULE_AUTOLOAD += "openvswitch" -KERNEL_MODULE_AUTOLOAD += "kvm" -KERNEL_MODULE_AUTOLOAD += "kvm-amd" -KERNEL_MODULE_AUTOLOAD += "kvm-intel" - -# aufs kernel support required for xen-image-minimal -KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" - -# xen kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_4.12.bbappend +1 -20
@@ -1,20 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://xt-checksum.scc \ - file://ebtables.scc \ - file://vswitch.scc \ - file://lxc.scc \ - file://docker.scc \ - " -KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" - -KERNEL_MODULE_AUTOLOAD += "openvswitch" -KERNEL_MODULE_AUTOLOAD += "kvm" -KERNEL_MODULE_AUTOLOAD += "kvm-amd" -KERNEL_MODULE_AUTOLOAD += "kvm-intel" - -# aufs kernel support required for xen-image-minimal -KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" - -# xen kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_4.4.bbappend +1 -20
@@ -1,20 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://xt-checksum.scc \ - file://ebtables.scc \ - file://vswitch.scc \ - file://lxc.scc \ - file://docker.scc \ - " -KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" - -KERNEL_MODULE_AUTOLOAD += "openvswitch" -KERNEL_MODULE_AUTOLOAD += "kvm" -KERNEL_MODULE_AUTOLOAD += "kvm-amd" -KERNEL_MODULE_AUTOLOAD += "kvm-intel" - -# aufs kernel support required for xen-image-minimal -KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" - -# xen kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_4.9.bbappend +1 -20
@@ -1,20 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://xt-checksum.scc \ - file://ebtables.scc \ - file://vswitch.scc \ - file://lxc.scc \ - file://docker.scc \ - " -KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" - -KERNEL_MODULE_AUTOLOAD += "openvswitch" -KERNEL_MODULE_AUTOLOAD += "kvm" -KERNEL_MODULE_AUTOLOAD += "kvm-amd" -KERNEL_MODULE_AUTOLOAD += "kvm-intel" - -# aufs kernel support required for xen-image-minimal -KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" - -# xen kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)}
recipes-kernel/linux/linux-yocto_virtualization.inc new file +20 -0
@@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" + +SRC_URI += "file://xt-checksum.scc \ + file://ebtables.scc \ + file://vswitch.scc \ + file://lxc.scc \ + file://docker.scc \ + " +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" + +KERNEL_MODULE_AUTOLOAD += "openvswitch" +KERNEL_MODULE_AUTOLOAD += "kvm" +KERNEL_MODULE_AUTOLOAD += "kvm-amd" +KERNEL_MODULE_AUTOLOAD += "kvm-intel" + +# aufs kernel support required for xen-image-minimal +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" + +# xen kernel support +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}"
Signature · 1 line
2.11.0
Re: [PATCH V3 2/3] linux-yocto: make bbappend have effect conditionally
Quoted 8 lines · Chen Qi
Make these bbappend files to take effect only when
DISTRO_FEATUREScontain 'virtualization'. Otherwise, we would meet failure failure at system booting up qemux86. Related logs are as below.systemd-modules-load[113]: Failed to insert '
kvm_amd': Operation not supported systemd-modules-load[113]: Failed to insert 'kvm_intel': Operation not supportedSigned-off-by Chen Qi <[email protected]>
...
Quoted 29 lines
recipes-kernel/linux/linux-yocto_virtualization.inc new file +20
-1@@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" + +SRC_URI += "file://xt-checksum.scc \ + file://ebtables.scc \ + file://vswitch.scc \ + file://lxc.scc \ + file://docker.scc \ + " +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" + +KERNEL_MODULE_AUTOLOAD += "openvswitch" +KERNEL_MODULE_AUTOLOAD += "kvm" +KERNEL_MODULE_AUTOLOAD += "kvm-amd" +KERNEL_MODULE_AUTOLOAD += "kvm-intel" + +# aufs kernel support required for xen-image-minimal +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" + +# xen kernel support +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" --2.11.0
Quoted 1 line
--
Suggestion for a preferred change: make the KVM features depend on DISTRO_FEATURES containing 'kvm', in the same way that the Xen features do for DISTRO_FEATURES containing 'xen'.
Here's why: those KVM kernel modules are not of interest on Xen systems. With this change, you're removing the KVM features from the qemu build to solve your bug in hand, by making it conditional on 'virtualization', but is still leaves them present when only Xen is needed.
With that change, I'm not sure whether a 'virtualization' disto feature is immediately useful. It could make sense for features that are hypervisor-agnostic but I don't have an immediate example to point to.
Christopher
Re: [PATCH V3 2/3] linux-yocto: make bbappend have effect conditionally
Quoted 56 lines · Christopher Clark
Quoted 5 lines · Chen Qi
Make these bbappend files to take effect only when
DISTRO_FEATUREScontain 'virtualization'. Otherwise, we would meet failure failure at system booting up qemux86. Related logs are as below.systemd-modules-load[113]: Failed to insert '
kvm_amd': Operation notsupported
Quoted 1 line
systemd-modules-load[113]: Failed to insert '
kvm_intel': Operation notsupported
Quoted 2 lines
Signed-off-by Chen Qi <[email protected]>...
Review
Quoted 1 line
(quoted diff) +0
-0b/recipes-kernel/linux/linux-yocto_virtualization.inc
Quoted 12 lines
new file mode 100644
index 0000000..8b296d7recipes-kernel/linux/linux-yocto_virtualization.inc new file +7
-0@@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" + +SRC_URI += "file://xt-checksum.scc \ + file://ebtables.scc \ + file://vswitch.scc \ + file://lxc.scc \ + file://docker.scc \recipes-kernel/linux/linux-yocto_virtualization.inc line 17
Quoted 10 lines
recipes-kernel/linux/linux-yocto_virtualization.inc new file +10
-0+ " +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" + +KERNEL_MODULE_AUTOLOAD += "openvswitch" +KERNEL_MODULE_AUTOLOAD += "kvm" +KERNEL_MODULE_AUTOLOAD += "kvm-amd" +KERNEL_MODULE_AUTOLOAD += "kvm-intel" + +# aufs kernel support required for xen-image-minimal +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES','aufs', ' features/aufs/aufs-enable.scc', '', d)}"
recipes-kernel/linux/linux-yocto_virtualization.inc
Quoted 3 lines
recipes-kernel/linux/linux-yocto_virtualization.inc new file +3
-0+ +# xen kernel support +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'file://xen.scc', '', d)}"
Quoted 4 lines
--
2.11.0--
Suggestion for a preferred change: make the KVM features depend on
DISTRO_FEATUREScontaining 'kvm', in the same way that the Xen features do forDISTRO_FEATUREScontaining 'xen'.Here's why: those KVM kernel modules are not of interest on Xen systems. With this change, you're removing the KVM features from the qemu build to solve your bug in hand, by making it conditional on 'virtualization', but is still leaves them present when only Xen is needed.
Quoted 5 lines
With that change, I'm not sure whether a 'virtualization' disto feature is immediately useful. It could make sense for features that are hypervisor-agnostic but I don't have an immediate example to point to.
I like the suggestion as well. I'd like to future proof this a bit, and we should keep the
virtualization feature around, but make the KVM features depend on kvm in theDISTRO_FEATURES. Less churn on distro flags is a good thing.
Chen Qi, can you rework the check and warning message to reflect that 'kvm' is the distro feature to set ?
Bruce
Quoted 8 lines
Christopher
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Re: [PATCH V3 2/3] linux-yocto: make bbappend have effect conditionally
Quoted 69 lines · Bruce Ashfield
On Tue, Sep 26, 2017 at 4:57 PM, Christopher Clark <[email protected] <mailto:[email protected]>> wrote:
On Mon, Sep 25, 2017 at 8:31 PM, Chen Qi <[email protected] <mailto:[email protected]>> wrote: > Make these bbappend files to take effect only when DISTRO_FEATURES > contain 'virtualization'. Otherwise, we would meet failure failure > at system booting up qemux86. Related logs are as below. > > systemd-modules-load[113]: Failed to insert 'kvm_amd': Operation not supported > systemd-modules-load[113]: Failed to insert 'kvm_intel': Operation not supported > > Signed-off-by: Chen Qi <[email protected] <mailto:[email protected]>> ... > diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc > new file mode 100644 > index 0000000..8b296d7 > --- /dev/null > +++ b/recipes-kernel/linux/linux-yocto_virtualization.inc > @@ -0,0 +1,20 @@ > +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" > + > +SRC_URI += "file://xt-checksum.scc \ > + file://ebtables.scc \ > + file://vswitch.scc \ > + file://lxc.scc \ > + file://docker.scc \ > + " > +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" > + > +KERNEL_MODULE_AUTOLOAD += "openvswitch" > +KERNEL_MODULE_AUTOLOAD += "kvm" > +KERNEL_MODULE_AUTOLOAD += "kvm-amd" > +KERNEL_MODULE_AUTOLOAD += "kvm-intel" > + > +# aufs kernel support required for xen-image-minimal > +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" > + > +# xen kernel support > +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" > -- > 2.11.0 > > -- Suggestion for a preferred change: make the KVM features depend on DISTRO_FEATURES containing 'kvm', in the same way that the Xen features do for DISTRO_FEATURES containing 'xen'. Here's why: those KVM kernel modules are not of interest on Xen systems. With this change, you're removing the KVM features from the qemu build to solve your bug in hand, by making it conditional on 'virtualization', but is still leaves them present when only Xen is needed. With that change, I'm not sure whether a 'virtualization' disto feature is immediately useful. It could make sense for features that are hypervisor-agnostic but I don't have an immediate example to point to.
Quoted 9 lines
I like the suggestion as well. I'd like to future proof this a bit, and we should keep the virtualization feature around, but make the KVM features depend on kvm in the
DISTRO_FEATURES. Less churn on distro flags is a good thing.Chen Qi, can you rework the check and warning message to reflect that 'kvm' is the distro feature to set ?
Bruce
Hi Bruce and Christopher,
The status of 'kvm' in yocto (in specific, oe-core layer) is a little different from that of 'xen'.
'xen' has been accepted as a distro feature, and the qemu recipe deals with it like below. meta/recipes-devtools/qemu/qemu.inc: ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
meta/recipes-devtools/qemu/qemu.inc:PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest"
However, for 'kvm', things are different.
It's enabled by default for the qemu (native, nativesdk and target) like below.
PACKAGECONFIG ??= " \
fdt sdl \
fdt sdl kvm \
${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
"PACKAGECONFIG_class-native ??= "fdt alsa kvm"
PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
To make things more complicated, our runqemu script, and the related oeqa parts also deal with the 'kvm' parameter.
When talking about 'kvm' above, I'm talking about it from the view of treating 'kvm' as a distro feature. I know that enabling kvm for qemu and enabling kvm related configs for kernel are two different things, although they are somewhat related.
Given the above situation, I'd like to suggest we don't deal with 'kvm' in meta-virtualization for now. I'll find time to see if we can make 'kvm' as a distro feature in oe-core. And we deal with 'kvm' in this layer after that.
Best Regards,
Chen Qi
Quoted 16 lines
Christopher -- _______________________________________________ meta-virtualization mailing list [email protected] <mailto:[email protected]> https://lists.yoctoproject.org/listinfo/meta-virtualization <https://lists.yoctoproject.org/listinfo/meta-virtualization>Signature · 1 line
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Re: [PATCH V3 2/3] linux-yocto: make bbappend have effect conditionally
Quoted 113 lines · ChenQi
On 09/27/2017 08:43 PM, Bruce Ashfield wrote:
Quoted 57 lines · Christopher Clark
Quoted 10 lines · Chen Qi
Make these bbappend files to take effect only when
DISTRO_FEATUREScontain 'virtualization'. Otherwise, we would meet failure failure at system booting up qemux86. Related logs are as below.systemd-modules-load[113]: Failed to insert '
kvm_amd': Operation not
supported
systemd-modules-load[113]: Failed to insert 'kvm_intel': Operation not
supportedSigned-off-by Chen Qi <[email protected]>...
Quoted 32 lines
recipes-kernel/linux/linux-yocto_virtualization.inc new file +17
-0@@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" + +SRC_URI += "file://xt-checksum.scc \ + file://ebtables.scc \ + file://vswitch.scc \ + file://lxc.scc \ + file://docker.scc \ + " +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" + +KERNEL_MODULE_AUTOLOAD += "openvswitch" +KERNEL_MODULE_AUTOLOAD += "kvm" +KERNEL_MODULE_AUTOLOAD += "kvm-amd" +KERNEL_MODULE_AUTOLOAD += "kvm-intel" + +# aufs kernel support required for xen-image-minimal +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES','aufs', ' features/aufs/aufs-enable.scc', '', d)}"
recipes-kernel/linux/linux-yocto_virtualization.inc new file +3
-0+ +# xen kernel support +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'file://xen.scc', '', d)}"
--
2.11.0Quoted 1 line
--
Suggestion for a preferred change: make the KVM features depend on
DISTRO_FEATUREScontaining 'kvm', in the same way that the Xen features do forDISTRO_FEATUREScontaining 'xen'.Here's why: those KVM kernel modules are not of interest on Xen systems. With this change, you're removing the KVM features from the qemu build to solve your bug in hand, by making it conditional on 'virtualization', but is still leaves them present when only Xen is needed.
Quoted 4 lines
With that change, I'm not sure whether a 'virtualization' disto feature is immediately useful. It could make sense for features that are hypervisor-agnostic but I don't have an immediate example to point to.
I like the suggestion as well. I'd like to future proof this a bit, and we should keep the
virtualization feature around, but make the KVM features depend on kvm in theDISTRO_FEATURES. Less churn on distro flags is a good thing.Chen Qi, can you rework the check and warning message to reflect that 'kvm' is the distro feature to set ?
Bruce
Hi Bruce and Christopher,
The status of 'kvm' in yocto (in specific, oe-core layer) is a little different from that of 'xen'.
'xen' has been accepted as a distro feature, and the qemu recipe deals with it like below.
meta/recipes-devtools/qemu/qemu.inc:
${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
meta/recipes-devtools/qemu/qemu.inc:PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest"However, for 'kvm', things are different.
It's enabled by default for the qemu (native, nativesdk and target) like below.PACKAGECONFIG ??= " \ fdt sdl \ fdt sdl kvm \ ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ "PACKAGECONFIG_class-native ??= "fdt alsa kvm" PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm" PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
To make things more complicated, our runqemu script, and the related oeqa parts also deal with the 'kvm' parameter.When talking about 'kvm' above, I'm talking about it from the view of treating 'kvm' as a distro feature. I know that enabling kvm for qemu and enabling kvm related configs for kernel are two different things, although they are somewhat related.
Quoted 4 lines
Given the above situation, I'd like to suggest we don't deal with 'kvm' in meta-virtualization for now.
I'll find time to see if we can make 'kvm' as a distro feature in oe-core. And we deal with 'kvm' in this layer after that.
I'm actually not concerned about the oe-core part for now, getting this name into meta-virt correctly .. the first time .. is my concern. I don't want to only use
'virtualization' now, and then switch it later to match a new (more widely used) KVM distro feature.
I had forgotten about the xen distro feature, and now that it has been pointed out, calling this 'virtualization' while it only impacts KVM build options to the
kernel, doesn't make sense.
So at a minimum, the kernel module autoload of kvm* should look for a kvm distro feature, but having the .inc included via the general 'virtualization' distro feature is still fine. Within the .inc, we have the xen and kvm differences
.. which is fine.
Bruce
Quoted 23 lines
Best Regards,
Chen QiQuoted 8 lines
Christopher
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Re: [PATCH V3 2/3] linux-yocto: make bbappend have effect conditionally
Quoted 126 lines · Bruce Ashfield
Quoted 110 lines · ChenQi
On 09/27/2017 08:43 PM, Bruce Ashfield wrote:
Quoted 55 lines · Christopher Clark
Quoted 10 lines · Chen Qi
Make these bbappend files to take effect only when
DISTRO_FEATUREScontain 'virtualization'. Otherwise, we would meet failure failure at system booting up qemux86. Related logs are as below.systemd-modules-load[113]: Failed to insert '
kvm_amd': Operation not
supported
systemd-modules-load[113]: Failed to insert 'kvm_intel': Operation not
supportedSigned-off-by Chen Qi <[email protected]>...
Quoted 32 lines
recipes-kernel/linux/linux-yocto_virtualization.inc new file +17
-0@@ -0,0 +1,20 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" + +SRC_URI += "file://xt-checksum.scc \ + file://ebtables.scc \ + file://vswitch.scc \ + file://lxc.scc \ + file://docker.scc \ + " +KERNEL_FEATURES_append = " features/kvm/qemu-kvm-enable.scc" + +KERNEL_MODULE_AUTOLOAD += "openvswitch" +KERNEL_MODULE_AUTOLOAD += "kvm" +KERNEL_MODULE_AUTOLOAD += "kvm-amd" +KERNEL_MODULE_AUTOLOAD += "kvm-intel" + +# aufs kernel support required for xen-image-minimal +KERNEL_FEATURES_append += "${@bb.utils.contains('DISTRO_FEATURES','aufs', ' features/aufs/aufs-enable.scc', '', d)}"
recipes-kernel/linux/linux-yocto_virtualization.inc new file +3
-0+ +# xen kernel support +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'file://xen.scc', '', d)}"
--
2.11.0Quoted 1 line
--
Suggestion for a preferred change: make the KVM features depend on
DISTRO_FEATUREScontaining 'kvm', in the same way that the Xen features do forDISTRO_FEATUREScontaining 'xen'.Here's why: those KVM kernel modules are not of interest on Xen systems. With this change, you're removing the KVM features from the qemu build to solve your bug in hand, by making it conditional on 'virtualization', but is still leaves them present when only Xen is needed.
Quoted 4 lines
With that change, I'm not sure whether a 'virtualization' disto feature is immediately useful. It could make sense for features that are hypervisor-agnostic but I don't have an immediate example to point to.
I like the suggestion as well. I'd like to future proof this a bit, and we should keep the
virtualization feature around, but make the KVM features depend on kvm in theDISTRO_FEATURES. Less churn on distro flags is a good thing.Chen Qi, can you rework the check and warning message to reflect that 'kvm' is the distro feature to set ?
Bruce
Hi Bruce and Christopher,
The status of 'kvm' in yocto (in specific, oe-core layer) is a little different from that of 'xen'.
'xen' has been accepted as a distro feature, and the qemu recipe deals with it like below.
meta/recipes-devtools/qemu/qemu.inc:
${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
meta/recipes-devtools/qemu/qemu.inc:PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest"However, for 'kvm', things are different.
It's enabled by default for the qemu (native, nativesdk and target) like below.PACKAGECONFIG ??= " \ fdt sdl \ fdt sdl kvm \ ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ "PACKAGECONFIG_class-native ??= "fdt alsa kvm" PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm" PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
To make things more complicated, our runqemu script, and the related oeqa parts also deal with the 'kvm' parameter.When talking about 'kvm' above, I'm talking about it from the view of treating 'kvm' as a distro feature. I know that enabling kvm for qemu and enabling kvm related configs for kernel are two different things, although they are somewhat related.
Quoted 4 lines
Given the above situation, I'd like to suggest we don't deal with 'kvm' in meta-virtualization for now.
I'll find time to see if we can make 'kvm' as a distro feature in oe-core. And we deal with 'kvm' in this layer after that.I'm actually not concerned about the oe-core part for now, getting this name into meta-virt correctly .. the first time .. is my concern. I don't want to only use
'virtualization' now, and then switch it later to match a new (more widely used) KVM distro feature.I had forgotten about the xen distro feature, and now that it has been pointed out, calling this 'virtualization' while it only impacts KVM build options to the
kernel, doesn't make sense.
Quoted 8 lines
So at a minimum, the kernel module autoload of kvm* should look for a kvm distro feature, but having the .inc included via the general 'virtualization' distro feature is still fine. Within the .inc, we have the xen and kvm differences
.. which is fine.Bruce
Got it.
I had a sick leave yesterday.
I'll send out V4 soon.
Best Regards,
Chen Qi
Quoted 22 lines
Quoted 20 lines
Best Regards,
Chen QiQuoted 7 lines
Christopher
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
PATCH v3 3/3 README: update to include information about bbappend inclusion
In reply to Chen QiUpdate README file to include information about bbappend file inclusion, telling the users that 'virtualization' needs to be in DISTRO_FEATURES to make some bbappend files to be effective.
--- README | 5 +++++ 1 file changed, 5 insertions(+)
README +5 -0
@@ -4,6 +4,11 @@ meta-virtualization This layer provides support for building Xen, KVM, Libvirt, and associated packages necessary for constructing OE-based virtualized solutions. +The bbappend files for some recipe (e.g. linux-yocto) in this layer need to +have 'virtualization' in DISTRO_FEATURES to have effect. To enable them, add +in configuration file the following line. +DISTRO_FEATURES_append = " virtualization" + Dependencies ------------ This layer depends on:
Signature · 1 line
2.11.0
Any plans to send out a similar change for meta-cloud-services?
Mark
Quoted 50 lines · Chen Qi
Add a new class, sanity-meta-virt.bbclass, to check for whether necessary settings are available for bbappend files in this layer to be effective, and warn users if not.
In addition, a variable
SKIP_SANITY_BBAPPEND_CHECKis added to enable users to explicitly skip the checking to avoid unwanted warnings.Signed-off-by Chen Qi <[email protected]>--- classes/sanity-meta-virt.bbclass | 10 ++++++++++ conf/layer.conf | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 classes/sanity-meta-virt.bbclassclasses/sanity-meta-virt.bbclass new file +10
-0@@ -0,0 +1,10 @@ +addhandler virt_bbappend_distrocheck +virt_bbappend_distrocheck[eventmask] = "bb.event.ConfigParsed" +python virt_bbappend_distrocheck() { + skip_check = e.data.getVar('SKIP_SANITY_BBAPPEND_CHECK') == "1" + if 'virtualization' not in e.data.getVar('DISTRO_FEATURES').split() and not skip_check: + bb.warn("You have included the meta-virtualization layer, but \ +'virtualization' has not been enabled in your DISTRO_FEATURES. Some bbappend files \ +may not take effect. See the meta-virtualization README for details on enabling \ +virtualization support.") +}conf/layer.conf +4
-1@@ -22,3 +22,7 @@ require conf/distro/include/virt_security_flags.inc PREFERRED_PROVIDER_virtual/runc ?= "runc-docker" PREFERRED_PROVIDER_virtual/containerd ?= "containerd-docker" + +# Sanity check for meta-virtualization layer. +# Setting SKIP_SANITY_BBAPPEND_CHECK to "1" would skip the bbappend files check. +INHERIT += "sanity-meta-virt" --2.11.0
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization