Skip to contentSkip to conversation

testimage: dont use DNS lookup for qemu based testimages

PATCH In review Saul Wold 6 participants 8 messages Mar 19, 2014

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH v2 1/1 testimage: dont use DNS lookup for qemu based testimages

---
 meta/classes/testimage.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/testimage.bbclass +10 -0
index 691c7f6..ee028e1 100644
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d
 TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
 TESTIMAGELOCK_qemuall = ""
 
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+
+fix_dns_lookup_for_qemu() {
+	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
+		sed -i -e 's:#UseDNS yes:UseDNS no:' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+	fi
+}
+
+EXPORT_FUNCTIONS fix_dns_lookup_for_qemu
+
 python do_testimage() {
     testimage_main(d)
 }
Signature · 1 line
1.8.3.1
#1 lore raw

Op 19 mrt. 2014, om 01:31 heeft Saul Wold <[email protected]> het volgende geschreven:

Quoted 13 lines

---
meta/classes/testimage.bbclass | 10 ++++++++++

1 file changed, 10 insertions(+)
meta/classes/testimage.bbclass +0 -0
index 691c7f6..ee028e1 100644
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d

TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
TESTIMAGELOCK_qemuall = ""

Quoted 1 line

+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"

Overrides and += don't do what you expect most of the time, _append_qemuall = " fix_dns_lookup_for_qemu" is a safer way to specify this. But more importantly, you're missing the trailing semicolon :)

IMAGE_POSTPROCESS_COMMAND_append_qemuall = " fix_dns_lookup_for_qemu ;"

regards,

Koen

Quoted 21 lines
meta/classes/testimage.bbclass +9 -0
+
+fix_dns_lookup_for_qemu() {
+	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
+		sed -i -e 's:#UseDNS yes:UseDNS no:' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+	fi
+}
+
+EXPORT_FUNCTIONS fix_dns_lookup_for_qemu
+

python do_testimage() {
testimage_main(d)
}

Signature · 7 lines
1.8.3.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#2 lore raw
In reply to Saul Wold
Quoted 10 lines · Saul Wold
---
 meta/classes/testimage.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/testimage.bbclass +0 -0
index 691c7f6..ee028e1 100644

meta/classes/testimage.bbclass TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d · line 49

Quoted 5 lines
meta/classes/testimage.bbclass +2 -0
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d
 TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
 TESTIMAGELOCK_qemuall = ""
 
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

The AB does: bitbake core-image-sato on one step and then adds INHERIT +="testimage" in local.conf in the next step and runs bitbake core-image-sato -c testimage, no more do_rootfs here.

As it this it will only work with testimage-auto when you have TEST_IMAGE="1" in local.conf in the first build step so you only need to do bitbake core-image-sato and do_testimage gets run after do_rootfs, but we don't use this. And the fix should work for running the task manually too.

I liked v1, I don't really see what the problem was there. No mattter the way you run our qemu images, you still have to set a proper DNS, and have network connectivity in the image (which usually involves the host too) so defaulting to UseDNS no for qemu images seems a sensible default to me.

Cheers,
Stefan

Quoted 14 lines
meta/classes/testimage.bbclass +8 -0
+fix_dns_lookup_for_qemu() {
+	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
+		sed -i -e 's:#UseDNS yes:UseDNS no:' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+	fi
+}
+
+EXPORT_FUNCTIONS fix_dns_lookup_for_qemu
+
 python do_testimage() {
     testimage_main(d)
 }
Signature · 1 line
1.8.3.1
#3 lore raw
Quoted 28 lines · StefanX
Quoted 15 lines · Saul Wold

---

 meta/classes/testimage.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/meta/classes/testimage.bbclass index 691c7f6..ee028e1 100644

meta/classes/testimage.bbclass +0 -0
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall =

"qemu-native:do_populate_sysroot qemu-helper-native:d>
TESTIMAGELOCK = "${TMPDIR}/testimage.lock" TESTIMAGELOCK_qemuall = ""

meta/classes/testimage.bbclass

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

The AB does: bitbake core-image-sato on one step and then adds INHERIT +="testimage" in local.conf in the next step and runs bitbake core-image-sato -c testimage, no more do_rootfs here.

Quoted 5 lines

As it this it will only work with testimage-auto when you have TEST_IMAGE="1" in local.conf in the first build step so you only need to do bitbake core-image-sato and do_testimage gets run after do_rootfs, but we don't use this. And the fix should work for running the task manually too.

I have to say I agree; this is not the right fix.

Quoted 5 lines

I liked v1, I don't really see what the problem was there. No mattter the way you run our qemu images, you still have to set a proper DNS, and have network connectivity in the image (which usually involves the host too) so defaulting to UseDNS no for qemu images seems a sensible default to me.

Well, v1 was unconditional in the openssh recipe; I think it still needs to be just for qemuall.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#4 lore raw
Quoted 29 lines · Paul Eggleton
Quoted 28 lines · StefanX
Quoted 15 lines · Saul Wold

---

  meta/classes/testimage.bbclass | 10 ++++++++++
  1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/meta/classes/testimage.bbclass index 691c7f6..ee028e1 100644

meta/classes/testimage.bbclass +0 -0
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall =

"qemu-native:do_populate_sysroot qemu-helper-native:d>
TESTIMAGELOCK = "${TMPDIR}/testimage.lock" TESTIMAGELOCK_qemuall = ""

meta/classes/testimage.bbclass

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

The AB does: bitbake core-image-sato on one step and then adds INHERIT +="testimage" in local.conf in the next step and runs bitbake core-image-sato -c testimage, no more do_rootfs here.

Quoted 8 lines
Quoted 5 lines

As it this it will only work with testimage-auto when you have TEST_IMAGE="1" in local.conf in the first build step so you only need to do bitbake core-image-sato and do_testimage gets run after do_rootfs, but we don't use this. And the fix should work for running the task manually too.

I have to say I agree; this is not the right fix.

Is there any reason that we can't include the INHERIT += "testimage" during the core build?

The other choice is to move the function into the openssh recipe and then the actual setting of the IMAGE_POSTPROCESS_COMMAND can happen in the local.conf or auto.conf

Quoted 9 lines
Quoted 5 lines

I liked v1, I don't really see what the problem was there. No mattter the way you run our qemu images, you still have to set a proper DNS, and have network connectivity in the image (which usually involves the host too) so defaulting to UseDNS no for qemu images seems a sensible default to me.

Well, v1 was unconditional in the openssh recipe; I think it still needs to be just for qemuall.

It was originally for qemuall, but was also for all images and was to broad as some may not want it disabled in this way.

Further thoughts?

Sau!

Quoted 3 lines

Cheers,
Paul

#5 lore raw

We can add the INHERIT either in the nightly*.conf as an atextappend or in CreateAutoConf. So doing it via the ab isn't difficult at all. Let me know what you guys think and I'll pull together a patch for it.

-b

Quoted 74 lines · Saul Wold
Quoted 33 lines · Paul Eggleton
Quoted 31 lines · StefanX
Quoted 16 lines · Saul Wold

---

  meta/classes/testimage.bbclass | 10 ++++++++++
  1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/meta/classes/testimage.bbclass index 691c7f6..ee028e1 100644

meta/classes/testimage.bbclass +0 -0
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall =

"qemu-native:do_populate_sysroot qemu-helper-native:d>
TESTIMAGELOCK = "${TMPDIR}/testimage.lock" TESTIMAGELOCK_qemuall = ""

meta/classes/testimage.bbclass

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

The AB does: bitbake core-image-sato on one step and then adds INHERIT +="testimage" in local.conf in the next step and runs bitbake core-image-sato -c testimage, no more do_rootfs here.

Quoted 9 lines
Quoted 5 lines

As it this it will only work with testimage-auto when you have TEST_IMAGE="1" in local.conf in the first build step so you only need to do bitbake core-image-sato and do_testimage gets run after do_rootfs, but we don't use this. And the fix should work for running the task manually too.

I have to say I agree; this is not the right fix.

Is there any reason that we can't include the INHERIT += "testimage" during the core build?

The other choice is to move the function into the openssh recipe and then the actual setting of the IMAGE_POSTPROCESS_COMMAND can happen in the local.conf or auto.conf

Quoted 11 lines
Quoted 5 lines

I liked v1, I don't really see what the problem was there. No mattter the way you run our qemu images, you still have to set a proper DNS, and have network connectivity in the image (which usually involves the host too) so defaulting to UseDNS no for qemu images seems a sensible default to me.

Well, v1 was unconditional in the openssh recipe; I think it still needs to be
just for qemuall.

It was originally for qemuall, but was also for all images and was to broad as some may not want it disabled in this way.

Further thoughts?

Sau!

Quoted 4 lines

Cheers,
Paul

Signature · 3 lines
Elizabeth Flanagan
Yocto Project
Build and Release
#6 lore raw
In reply to Saul Wold
Quoted 37 lines · On Wednesday 19 March 2014 13:06:51 Saul Wold wrote:
Quoted 36 lines · Paul Eggleton
Quoted 34 lines · StefanX
Quoted 16 lines · Saul Wold

---

  meta/classes/testimage.bbclass | 10 ++++++++++
  1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/meta/classes/testimage.bbclass index 691c7f6..ee028e1 100644

meta/classes/testimage.bbclass +0 -0
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall =

"qemu-native:do_populate_sysroot qemu-helper-native:d>

  TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
  TESTIMAGELOCK_qemuall = ""

meta/classes/testimage.bbclass

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

The AB does: bitbake core-image-sato on one step and then adds INHERIT +="testimage" in local.conf in the next step and runs bitbake core-image-sato -c testimage, no more do_rootfs here.

As it this it will only work with testimage-auto when you have TEST_IMAGE="1" in local.conf in the first build step so you only need to do bitbake core-image-sato and do_testimage gets run after do_rootfs, but we don't use this. And the fix should work for running the task manually too.

Quoted 4 lines
Quoted 1 line

I have to say I agree; this is not the right fix.

Is there any reason that we can't include the INHERIT += "testimage" during the core build?

I don't want testimage.bbclass influencing how images are constructed. It's just as valid a workaround for people running qemu manually on their machines as it is for the automated testing.

Quoted 3 lines

The other choice is to move the function into the openssh recipe and then the actual setting of the IMAGE_POSTPROCESS_COMMAND can happen in the local.conf or auto.conf

That can't work. The function has to be defined in the scope of the image not the openssh recipe or it can't be called from IMAGE_POSTPROCESS_COMMAND.

To be honest we already have code in image.bbclass for allowing empty passwords in OpenSSH / dropbear; this seems to me to be in the same category, so I would suggest putting at least the function there (with a more generic name that does not contain "qemu").

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

I liked v1, I don't really see what the problem was there. No mattter the way you run our qemu images, you still have to set a proper DNS, and have network connectivity in the image (which usually involves the host too) so defaulting to UseDNS no for qemu images seems a sensible default to me.

Well, v1 was unconditional in the openssh recipe; I think it still needs to be just for qemuall.

It was originally for qemuall, but was also for all images and was to broad as some may not want it disabled in this way.

OK, I missed that; but v1 still made openssh machine-specific which is not desirable.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#7 lore raw
In reply to Stanacar, StefanX
Quoted 16 lines · StefanX
Quoted 13 lines · Saul Wold
---
 meta/classes/testimage.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/testimage.bbclass +0 -0
index 691c7f6..ee028e1 100644
@@ -45,6 +45,16 @@ TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d
 TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
 TESTIMAGELOCK_qemuall = ""
 
Quoted 7 lines

meta/classes/testimage.bbclass TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:d · line 49

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+IMAGE_POSTPROCESS_COMMAND_qemuall += "fix_dns_lookup_for_qemu"
+

I might be wrong, but this won't have any effect with the default (manual) way we use testimage. The testimage class isn't in the global inherit, so that IMAGE_POSTPROCESS_COMMAND won't run as the image isn't reconstructed.

Surely it will have run when the rootfs was originally constructed though?

Koen is right, that override is incorrect.

Cheers,

Richard