All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Firmware files for Ralink RT28x0
From: Ivo Van Doorn @ 2011-04-10 17:35 UTC (permalink / raw)
  To: Xose Vazquez Perez; +Cc: linux-wireless, users
In-Reply-To: <4DA1E90A.5070902@gmail.com>

Hi.

>> I notice that rt2800{pci,usb} each specify only one firmware image,
>> regardless of the controller version.
>>
>> This is inconsistent with rt28{6,7}0sta and with the firmware images in
>> linux-firmware.
>>
>> If you think that a single image per bus type can cover all controllers,
>> please identify those firmware images, test them on each hardware
>> generation, and get them into linux-firmware.
>
> querida:/datos/kernel/linux-2.6/drivers/net/wireless/rt2x00 $ grep "\.bin" *
> rt2800pci.h:#define FIRMWARE_RT2860                     "rt2860.bin"
> rt2800usb.h:#define FIRMWARE_RT2870                     "rt2870.bin"
> rt61pci.h:#define FIRMWARE_RT2561                       "rt2561.bin"
> rt61pci.h:#define FIRMWARE_RT2561s                      "rt2561s.bin"
> rt61pci.h:#define FIRMWARE_RT2661                       "rt2661.bin"
> rt73usb.h:#define FIRMWARE_RT2571                       "rt73.bin"
>
> rt3070.bin rt3071.bin rt3090.bin should be deleted from linux-firmware.
> They were only need by staging drivers.

True, but the rt2860 and rt2870 firmware file are outdated in the
linux-firmware,
and probably don't support the rt3090 or other more recent chipsets. So before
they can be removed, those files must be updated.

Ivo

^ permalink raw reply

* Re: [Qemu-devel] tcg/tcg.c:1892: tcg fatal error
From: Artyom Tarasenko @ 2011-04-10 17:31 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Blue Swirl, qemu-devel, Aurelien Jarno
In-Reply-To: <BANLkTikM0uDAMBAfezMPewuYdpg1uWh1zg@mail.gmail.com>

On Sun, Apr 10, 2011 at 4:59 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 10 April 2011 15:09, Artyom Tarasenko <atar4qemu@gmail.com> wrote:
>> Does it mean the last block is processed correctly and the crash
>> happens on the next instruction which doesn't make it to the log?
>
> ...maybe tcg_abort() should do a qemu_log_flush()...?

Sounds reasonable, but in this particular case makes no difference.

-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/

^ permalink raw reply

* Re: Firmware files for Ralink RT28x0
From: Xose Vazquez Perez @ 2011-04-10 17:29 UTC (permalink / raw)
  To: linux-wireless, users

Ben Hutchings wrote:

> I notice that rt2800{pci,usb} each specify only one firmware image,
> regardless of the controller version.
> 
> This is inconsistent with rt28{6,7}0sta and with the firmware images in
> linux-firmware.
> 
> If you think that a single image per bus type can cover all controllers,
> please identify those firmware images, test them on each hardware
> generation, and get them into linux-firmware.

querida:/datos/kernel/linux-2.6/drivers/net/wireless/rt2x00 $ grep "\.bin" *
rt2800pci.h:#define FIRMWARE_RT2860			"rt2860.bin"
rt2800usb.h:#define FIRMWARE_RT2870			"rt2870.bin"
rt61pci.h:#define FIRMWARE_RT2561			"rt2561.bin"
rt61pci.h:#define FIRMWARE_RT2561s			"rt2561s.bin"
rt61pci.h:#define FIRMWARE_RT2661			"rt2661.bin"
rt73usb.h:#define FIRMWARE_RT2571			"rt73.bin"

rt3070.bin rt3071.bin rt3090.bin should be deleted from linux-firmware.
They were only need by staging drivers.

-- 
«Allá muevan feroz guerra, ciegos reyes por un palmo más de tierra;
que yo aquí tengo por mío cuanto abarca el mar bravío, a quien nadie
impuso leyes. Y no hay playa, sea cualquiera, ni bandera de esplendor,
que no sienta mi derecho y dé pecho a mi valor.»

^ permalink raw reply

* [PATCH v2] lowpan-tools_0.2.2;: fix build with static libnl1
From: Anders Darander @ 2011-04-10 17:27 UTC (permalink / raw)
  To: openembedded-devel

* add NL_CFLAGS to a few Makefiles.am
* git version not fixed
* build and runtime tested, although only in qemuarm

Signed-off-by: Anders Darander <anders@chargestorm.se>
---
 .../0001-Add-NL_CFLAGS-to-libcommon.patch          |   65 ++++++++++++++++++++
 recipes/lowpan-tools/lowpan-tools.inc              |    4 +-
 recipes/lowpan-tools/lowpan-tools_0.2.2.bb         |    6 ++-
 3 files changed, 72 insertions(+), 3 deletions(-)
 create mode 100644 recipes/lowpan-tools/lowpan-tools-0.2.2/0001-Add-NL_CFLAGS-to-libcommon.patch

diff --git a/recipes/lowpan-tools/lowpan-tools-0.2.2/0001-Add-NL_CFLAGS-to-libcommon.patch b/recipes/lowpan-tools/lowpan-tools-0.2.2/0001-Add-NL_CFLAGS-to-libcommon.patch
new file mode 100644
index 0000000..45cc4d0
--- /dev/null
+++ b/recipes/lowpan-tools/lowpan-tools-0.2.2/0001-Add-NL_CFLAGS-to-libcommon.patch
@@ -0,0 +1,65 @@
+From 7fa435ea775b1410d9ccb95d2e315847f5a0f09c Mon Sep 17 00:00:00 2001
+From: Anders Darander <anders@chargestorm.se>
+Date: Tue, 5 Apr 2011 20:24:54 +0200
+Subject: [PATCH] Add-NL_CFLAGS-to-libcommon
+
+Signed-off-by: Anders Darander <anders@chargestorm.se>
+---
+ iplink/Makefile.am |    1 +
+ lib/Makefile.am    |    1 +
+ src/Makefile.am    |    4 ++--
+ tests/Makefile.am  |    2 +-
+ 4 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/iplink/Makefile.am b/iplink/Makefile.am
+index bbed7ba..6e87ae0 100644
+--- a/iplink/Makefile.am
++++ b/iplink/Makefile.am
+@@ -4,3 +4,4 @@ noinst_HEADERS = iplink.h
+ iproute_LTLIBRARIES = link_wpan.la
+ link_wpan_la_LDFLAGS = -module -avoid-version -shared
+ 
++link_wpan_la_CFLAGS = $(NL_CFLAGS) -D_GNU_SOURCE
+\ No newline at end of file
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index 5e15018..6936ebb 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -3,3 +3,4 @@ include $(top_srcdir)/Makefile.common
+ noinst_LTLIBRARIES = libcommon.la
+ libcommon_la_SOURCES = printbuf.c genl.c parse.c shash.c logging.c nl_policy.c
+ 
++libcommon_la_CFLAGS = $(NL_CFLAGS) -D_GNU_SOURCE
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 555e214..46c4017 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -20,11 +20,11 @@ iz_SOURCES = iz.c iz-common.c iz-mac.c iz-phy.c
+ noinst_HEADERS = iz.h
+ 
+ izcoordinator_SOURCES = coordinator.c
+-izcoordinator_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS) -DLEASE_FILE=\"$(leasefile)\"
++izcoordinator_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS) -DLEASE_FILE=\"$(leasefile)\" -D_GNU_SOURCE
+ izcoordinator_CFLAGS += -DPID_FILE=\"$(pidfile)\"
+ izcoordinator_LDADD = ../addrdb/libaddrdb.la $(LDADD) $(NL_LIBS) $(LEXLIB)
+ 
+-iz_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS)
++iz_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS) -D_GNU_SOURCE
+ iz_LDADD = $(LDADD) $(NL_LIBS)
+ 
+ izattach.8: $(izattach_SOURCES) $(top_srcdir)/configure.ac
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index d491be5..00621ca 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -4,6 +4,6 @@ zbtest_PROGRAMS = listen-packet test test2 test3 test4 test5 test6 test7 gnl izl
+ 
+ izlisten_SOURCES = listen.c
+ 
+-gnl_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS)
++gnl_CFLAGS = $(AM_CFLAGS) $(NL_CFLAGS) -D_GNU_SOURCE
+ gnl_LDADD = $(LDADD) $(NL_LIBS)
+ 
+-- 
+1.7.4.1
+
diff --git a/recipes/lowpan-tools/lowpan-tools.inc b/recipes/lowpan-tools/lowpan-tools.inc
index f429f96..94faf9c 100644
--- a/recipes/lowpan-tools/lowpan-tools.inc
+++ b/recipes/lowpan-tools/lowpan-tools.inc
@@ -1,7 +1,7 @@
 DESCRIPTION = "LoWPAN utilities (IEEE802.15.4)"
 LICENSE = "GPLv2"
-DEPENDS = "libnl bison-native flex-native python-native"
-INC_PR = "r11"
+DEPENDS = "libnl1 bison-native flex-native python-native"
+INC_PR = "r12"
 
 SRC_URI = "http://prdownloads.sourceforge.net/linux-zigbee/linux-zigbee-sources/${PV}/lowpan-tools-${PV}.tar.gz"
 
diff --git a/recipes/lowpan-tools/lowpan-tools_0.2.2.bb b/recipes/lowpan-tools/lowpan-tools_0.2.2.bb
index 5686487..103109e 100644
--- a/recipes/lowpan-tools/lowpan-tools_0.2.2.bb
+++ b/recipes/lowpan-tools/lowpan-tools_0.2.2.bb
@@ -1,6 +1,10 @@
 require lowpan-tools.inc
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
+
+SRC_URI_append = " \
+      file://0001-Add-NL_CFLAGS-to-libcommon.patch \
+      "
 
 EXTRA_OECONF = "--enable-ip-plugin"
 
-- 
1.7.4.1




^ permalink raw reply related

* Re: [PATCH 2/3] powerpc: Use MSR_64BIT in places
From: Kumar Gala @ 2011-04-10 17:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1302386681.28876.0.camel@pasglop>


On Apr 9, 2011, at 5:04 PM, Benjamin Herrenschmidt wrote:

> On Fri, 2011-04-08 at 04:24 -0500, Kumar Gala wrote:
>> On Apr 8, 2011, at 2:56 AM, Michael Ellerman wrote:
>>=20
>>> Use the new MSR_64BIT in a few places. Some of these are already =
ifdef'ed
>>> for BOOKE vs BOOKS, but it's still clearer, MSR_SF does not =
immediately
>>> parse as "MSR bit for 64bit".
>>>=20
>>> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>>> ---
>>> arch/powerpc/kernel/head_64.S   |    2 +-
>>> arch/powerpc/kernel/signal_64.c |    4 ++--
>>> arch/powerpc/kernel/traps.c     |    2 +-
>>> arch/powerpc/xmon/xmon.c        |   14 +++++++-------
>>> 4 files changed, 11 insertions(+), 11 deletions(-)
>>=20
>> However MSR_ISF does ;)
>=20
> I'm not sure I parse that one :-) Any ways ISF is "interrupt SF" and =
has
> no equivalent in the MSR for BookE (it's elsewhere, EPCR no ?).

I was just saying that if _SF doesn't parse as 64-bit mode, ISF doesn't =
parse as interrupt into 64-bit mode :)

- k=

^ permalink raw reply

* [ath9k-devel] ath9k: how to change channels dynamically
From: Larry Vaden @ 2011-04-10 17:23 UTC (permalink / raw)
  To: ath9k-devel
In-Reply-To: <344889.96199.qm@web137318.mail.in.yahoo.com>

On Sun, Apr 10, 2011 at 11:50 AM, Serene Gud <serene_gud@yahoo.co.in> wrote:

> I am using Fedora14 and not OpenWrt.
>
> Thanks!
>
>
There is some considerable discussion of channel switching in the .pdf
for IEEE Std 802.11TM-2007 which you can obtain by visiting <
http://standards.ieee.org/getieee802/download/802.11-2007.pdf>.

Otherwise, the call documented in wizviz is prolly compatible with F-14, I
dunno for sure.

F-14 is currently running

Linux shell.texoma.net 2.6.35.11-83.fc14.i686 #1 SMP Mon Feb 7 07:04:18 UTC
2011 i686 i686 i386 GNU/Linux

and the latest OpenWrt is running

Linux hq-0900-ap1 2.6.37.6 #6 Sat Apr 9 14:59:58 CDT 2011 mips GNU/Linux

so, with any luck, the call will work for you.

regards/ldv
-- 
Larry Vaden, CoFounder
Internet Texoma, Inc.
Serving Rural Texomaland Since 1995
We Care About Your Connection!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20110410/e10f01e6/attachment.htm 

^ permalink raw reply

* [PATCH][Trivial] Serial, ifx6x60c: Remove duplicate includes of linux/tty.h
From: Jesper Juhl @ 2011-04-10 17:22 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-serial, linux-kernel, trivial

Including linux/tty.h 3 times is a little over the top - once will do.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 ifx6x60.c |    2 --
 1 file changed, 2 deletions(-)

	compile tested only.

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 8ee5a41..5315525 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -41,7 +41,6 @@
 #include <linux/tty.h>
 #include <linux/device.h>
 #include <linux/spi/spi.h>
-#include <linux/tty.h>
 #include <linux/kfifo.h>
 #include <linux/tty_flip.h>
 #include <linux/timer.h>
@@ -56,7 +55,6 @@
 #include <linux/sched.h>
 #include <linux/time.h>
 #include <linux/wait.h>
-#include <linux/tty.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/ifx_modem.h>


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related

* Re: Crash with kfree(null) on MacBook? kobject_set_name_vargs
From: Rafał Miłecki @ 2011-04-10 17:15 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andy Botting
In-Reply-To: <BANLkTi=n+ckDXVk6rN=Mgh+BApbrPqPfmg@mail.gmail.com>

W dniu 10 kwietnia 2011 19:14 użytkownik Rafał Miłecki
<zajec5@gmail.com> napisał:
> I'm writing new axi bus driver and one of the early testers reported
> it crashing for him. Andy is using MacBook and backtrace+debugging
> pretty clearly point to kfree being called on null string.
>
> The most interesting part of code is:
> axi_info("[axi_register_cores][%d] current name: %s\n", i, core->dev.kobj.name);
> axi_info("[axi_register_cores][%d] calling dev_set_name with %d, %d
> for 0x%03X\n", i, 0/*bus->busnumber*/, dev_id, core->id.id);
> err = dev_set_name(&core->dev, "axi%d:%d", 0/*bus->busnumber*/, dev_id);
> axi_info("[axi_register_cores][%d] dev_set_name result: %d\n", i, err);
>
> The result is:
> [axi_register_cores][1] current name: (null)
> [axi_register_cores][1] calling dev_set_name with 0, 0 for 0x812
> BUG: unable to handle kernel paging request at ffffeba400000000
> IP: [<ffffffff8108c4d4>] kfree+0x2a/0x8a
>
> Whole code: http://pastie.org/1779473
> Whole result: http://pastie.org/1779416
>
> Can you help me with this issue, please? On my machine everything goes fine:
> [axi_register_cores][1] current name: (null)
> [axi_register_cores][1] calling dev_set_name with 0, 0 for 0x812
> [axi_register_cores][1] dev_set_name result: 0
> [axi_register_cores][1] Register dev for core 0x812
>
> bcopeland on #linux-wireless suggested turning on SLAB or SLUB. Is
> this going to provide some interesting info?

Link to kobject_set_name_vargs for lazy ;)
http://lxr.free-electrons.com/source/lib/kobject.c#L215

-- 
Rafał

^ permalink raw reply

* Crash with kfree(null) on MacBook? kobject_set_name_vargs
From: Rafał Miłecki @ 2011-04-10 17:14 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andy Botting

I'm writing new axi bus driver and one of the early testers reported
it crashing for him. Andy is using MacBook and backtrace+debugging
pretty clearly point to kfree being called on null string.

The most interesting part of code is:
axi_info("[axi_register_cores][%d] current name: %s\n", i, core->dev.kobj.name);
axi_info("[axi_register_cores][%d] calling dev_set_name with %d, %d
for 0x%03X\n", i, 0/*bus->busnumber*/, dev_id, core->id.id);
err = dev_set_name(&core->dev, "axi%d:%d", 0/*bus->busnumber*/, dev_id);
axi_info("[axi_register_cores][%d] dev_set_name result: %d\n", i, err);

The result is:
[axi_register_cores][1] current name: (null)
[axi_register_cores][1] calling dev_set_name with 0, 0 for 0x812
BUG: unable to handle kernel paging request at ffffeba400000000
IP: [<ffffffff8108c4d4>] kfree+0x2a/0x8a

Whole code: http://pastie.org/1779473
Whole result: http://pastie.org/1779416

Can you help me with this issue, please? On my machine everything goes fine:
[axi_register_cores][1] current name: (null)
[axi_register_cores][1] calling dev_set_name with 0, 0 for 0x812
[axi_register_cores][1] dev_set_name result: 0
[axi_register_cores][1] Register dev for core 0x812

bcopeland on #linux-wireless suggested turning on SLAB or SLUB. Is
this going to provide some interesting info?

-- 
Rafał

^ permalink raw reply

* Re: [PATCH] rt2800usb: Add three new USB IDs
From: Xose Vazquez Perez @ 2011-04-10 17:12 UTC (permalink / raw)
  To: Larry Finger, linux-wireless, users

Larry Finger wrote:

> There are three USB IDs supported by staging/rt2870sta that are not in the
> mainline driver rt2800usb.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org>
> ---
> 
> Index: wireless-testing/drivers/net/wireless/rt2x00/rt2800usb.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ wireless-testing/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -758,6 +758,8 @@ static struct usb_device_id rt2800usb_de
>  	{ USB_DEVICE(0x07d1, 0x3c0f), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	{ USB_DEVICE(0x07d1, 0x3c11), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	{ USB_DEVICE(0x07d1, 0x3c16), USB_DEVICE_DATA(&rt2800usb_ops) },
> +	{ USB_DEVICE(0x2001, 0x3c09), USB_DEVICE_DATA(&rt2800usb_ops) },
> +	{ USB_DEVICE(0x2001, 0x3c0a), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	/* Draytek */
>  	{ USB_DEVICE(0x07fa, 0x7712), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	/* Edimax */
> @@ -828,6 +830,7 @@ static struct usb_device_id rt2800usb_de
>  	/* Planex */
>  	{ USB_DEVICE(0x2019, 0xab25), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	{ USB_DEVICE(0x2019, 0xed06), USB_DEVICE_DATA(&rt2800usb_ops) },
> +	{ USB_DEVICE(0x2019, 0xed14), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	/* Quanta */
>  	{ USB_DEVICE(0x1a32, 0x0304), USB_DEVICE_DATA(&rt2800usb_ops) },
>  	/* Ralink */

NACK, unless they also be in the windows driver.
They were eliminated in recent versions of ralink LiNUX drivers.

^ permalink raw reply

* SELinux mixed/virtualisation policy
From: Ramon de Carvalho Valle @ 2011-04-10 17:12 UTC (permalink / raw)
  To: SELinux

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

As this is my first message to the list, I'd like to introduce myself.
I'm a Security Engineer at IBM Linux Technology Center, Founder at RISE
Security, and I'm currently working on Common Criteria Evaluation.

During the work on developing test cases for KVM and libvirt using the
MLS policy, after several failed attempts to make KVM and libvirt work
using MLS policy out of the box, I've been informed that libvirt does
not support dynamic labeling using MLS policy, which actually makes sense.

However, I and Dan Walsh (who kindly informed me about libvirt) both
agree that dynamic labeling is more secure than manual labeling using
MLS policy, for virtual machine environments.

This made me think for several hours about the policies currently
available and the virtualised environments. Thus, I'd like to make a
proposal and hear your opinions.


SELinux mixed policy

The SELinux mixed policy can have non hierarchical sensitivities that
have the same behavior of a categorized only environment. Such
sensitivities should not be included in the default sensitivity
hierarchy (i.e. s0 to s15). Thus, all rules for these sensitivities
should be explicitly stated. This allows creating a unique sensitivity
for virtual machine environments that is not part of the default
sensitivity hierarchy.

One of the main goals of virtualisation (amongst others) is the
representation of a physical environment in a logical environment to
obtain better usage of the available resources. However, physical and
logical objects should not belong to the same hierarchy, as it is in a
non virtualised environment.

In a non virtualised environment, one physical computer can not dominate
and/or communicate with a process of another physical computer without
any sort of well defined communication protocol, which can not infer a
hierarchy between physical objects and logical objects. Thus, a physical
computer can not dominate a process of another physical computer (i.e. a
guest -a process representing a virtual machine- should never dominate a
process of the host), something that is actually possible in the
currently available policies.

The main goal of having non hierarchical sensitivities available, or, at
a minimum, a sensitivity optionally available for use by the virtual
environment (i.e. sv -which does not belongs to the default hierarchy-),
is to better represent a physical environment where a physical computer
(usually) can not be automatically subjected to another physical
computer that has been compromised.


Virtualisation policy

Considering the above policy, a police could be refined to allow a
hierarchy to be defined between the guests only (i.e. sv0 to sv15), and
rules between the host sensitivities and guest sensitivities should be
explicitly stated. The categories constrains for the virtualisation
sensitivities should behave the same way as the constrains for the
standard sensitivities. This will result in the following

Host processes (in a non virtualised environment, a process)
s0-s15:c0-c255

Host processes representing virtual machines (in a non virtualised
environment, a physical computer)
sv0-sv15:c0-c255

The communication between them should be explicitly stated, as they are
two different types of object in a non virtualised environment (and the
communication between them only would occur when explicitly stated).

Please, let me know what you think. Any comments, critics and/or
suggestions would be greatly appreciated.

Best regards,

- -- 
Ramon de Carvalho Valle
Security Engineer
IBM Linux Technology Center
rcvalle@linux.vnet.ibm.com
http://rcvalle.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2h5Q8ACgkQkcIYeh81wLmeoACgkabADsP+i80M3VxFMw1deXk/
V4QAn2AbkKdzlSH7xM4xLj06ftAimm5n
=egxz
-----END PGP SIGNATURE-----


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply

* [PATCH 4/4] Remove 16 byte limit for PIN codes returned by agents
From: David Herrmann @ 2011-04-10 17:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, hadess, dforsi, David Herrmann
In-Reply-To: <1302455477-27664-1-git-send-email-dh.herrmann@googlemail.com>

Agents can now return PIN codes longer than 16 characters. The
pin parser automatically truncates all PINs to 16 characters, but
allows hexadecimal PINs to be longer than 16 characters because
each two hexdecimal encoded bytes are parsed into one output byte.
---
 src/agent.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/agent.c b/src/agent.c
index f87f253..40495bf 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -403,7 +403,7 @@ static void pincode_reply(DBusPendingCall *call, void *user_data)
 	len = strlen(pin);
 
 	dbus_error_init(&err);
-	if (len > 16 || len < 1) {
+	if (len < 1) {
 		error("Invalid PIN length (%zu) from agent", len);
 		dbus_set_error_const(&err, "org.bluez.Error.InvalidArgs",
 					"Invalid passkey length");
-- 
1.7.4.4


^ permalink raw reply related

* [PATCH 3/4] Parse pin codes starting with '$' as hexadecimal encoded strings
From: David Herrmann @ 2011-04-10 17:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, hadess, dforsi, David Herrmann
In-Reply-To: <1302455477-27664-1-git-send-email-dh.herrmann@googlemail.com>

If a pin code is retrieved from an agent and the first character is
a dollar sign '$', then the pin is decoded as following:
  - The first character (dollar sign) is stripped from the pin
  - The rest is parsed as hexadecimal numbers, where each two characters
    will be converted into a one byte integer. If an odd number of
    characters follows, then the last character is stripped. Empty
    pins are valid. Parser is case insensitive.
Pins not starting with '$' are parsed as usual.

For instance:
  pin: $0A3e005067
is decoded into a 5 byte pin:
  decoded: 0x0a 0x3e 0x00 0x50 0x67
---
 src/event.c |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/src/event.c b/src/event.c
index 248fb78..f2fc688 100644
--- a/src/event.c
+++ b/src/event.c
@@ -101,12 +101,52 @@ static gboolean get_adapter_and_device(bdaddr_t *src, bdaddr_t *dst,
  *
  *****************************************************************/
 
+static char hex2dec(char c)
+{
+	if (c >= '0' && c <= '9')
+		return  c - '0';
+	else if (c >= 'A' && c <= 'F')
+		return c - 'A' + 10;
+	else if (c >= 'a' && c <= 'f')
+		return c - 'a' + 10;
+	else
+		return 0;
+}
+
+static size_t decode_hex(const char *pin, char *out)
+{
+	size_t i;
+
+	for (i = 0; i < 16 && pin[i * 2] && pin[i * 2 + 1]; ++i)
+		out[i] = hex2dec(pin[i * 2]) * 16 + hex2dec(pin[i * 2 + 1]);
+	return i;
+}
+
+static size_t decode_pin(const char *pin, char *out)
+{
+	size_t len;
+
+	if (!pin) {
+		return 0;
+	}
+	else if (pin[0] == '$') {
+		len = decode_hex(&pin[1], out);
+	}
+	else {
+		len = strnlen(pin, 16);
+		memcpy(out, pin, len);
+	}
+	return len;
+}
+
 static void pincode_cb(struct agent *agent, DBusError *derr,
 				const char *pincode, struct btd_device *device)
 {
 	struct btd_adapter *adapter = device_get_adapter(device);
 	bdaddr_t sba, dba;
 	int err;
+	size_t len;
+	char rawpin[16];
 
 	device_get_address(device, &dba);
 
@@ -117,7 +157,8 @@ static void pincode_cb(struct agent *agent, DBusError *derr,
 		return;
 	}
 
-	err = btd_adapter_pincode_reply(adapter, &dba, pincode, pincode ? strlen(pincode) : 0);
+	len = decode_pin(pincode, rawpin);
+	err = btd_adapter_pincode_reply(adapter, &dba, rawpin, len);
 	if (err < 0)
 		goto fail;
 
-- 
1.7.4.4


^ permalink raw reply related

* [PATCH 2/4] Make adapter API accept binary pincodes
From: David Herrmann @ 2011-04-10 17:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, hadess, dforsi, David Herrmann
In-Reply-To: <1302455477-27664-1-git-send-email-dh.herrmann@googlemail.com>

Add pin-length argument to adapter API to allow passing binary pins
containing \0 characters to the hci handler.
---
 src/adapter.c |    4 ++--
 src/adapter.h |    2 +-
 src/event.c   |    6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 83f3217..14516ac 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3701,9 +3701,9 @@ int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr)
 }
 
 int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
-							const char *pin)
+							const char *pin, size_t pinlen)
 {
-	return adapter_ops->pincode_reply(adapter->dev_id, bdaddr, pin, pin ? strlen(pin) : 0);
+	return adapter_ops->pincode_reply(adapter->dev_id, bdaddr, pin, pinlen);
 }
 
 int btd_adapter_confirm_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/adapter.h b/src/adapter.h
index fd2fc12..b507506 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -273,7 +273,7 @@ int btd_adapter_disconnect_device(struct btd_adapter *adapter,
 int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr);
 
 int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
-							const char *pin);
+							const char *pin, size_t pinlen);
 int btd_adapter_confirm_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
 							gboolean success);
 int btd_adapter_passkey_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/event.c b/src/event.c
index 4ca1be5..248fb78 100644
--- a/src/event.c
+++ b/src/event.c
@@ -111,13 +111,13 @@ static void pincode_cb(struct agent *agent, DBusError *derr,
 	device_get_address(device, &dba);
 
 	if (derr) {
-		err = btd_adapter_pincode_reply(adapter, &dba, NULL);
+		err = btd_adapter_pincode_reply(adapter, &dba, NULL, 0);
 		if (err < 0)
 			goto fail;
 		return;
 	}
 
-	err = btd_adapter_pincode_reply(adapter, &dba, pincode);
+	err = btd_adapter_pincode_reply(adapter, &dba, pincode, pincode ? strlen(pincode) : 0);
 	if (err < 0)
 		goto fail;
 
@@ -142,7 +142,7 @@ int btd_event_request_pin(bdaddr_t *sba, bdaddr_t *dba)
 	memset(pin, 0, sizeof(pin));
 	pinlen = read_pin_code(sba, dba, pin);
 	if (pinlen > 0) {
-		btd_adapter_pincode_reply(adapter, dba, pin);
+		btd_adapter_pincode_reply(adapter, dba, pin, pinlen);
 		return 0;
 	}
 
-- 
1.7.4.4


^ permalink raw reply related

* [PATCH 1/4] Add length argument to hci pincode reply
From: David Herrmann @ 2011-04-10 17:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, hadess, dforsi, David Herrmann
In-Reply-To: <1302455477-27664-1-git-send-email-dh.herrmann@googlemail.com>

This adds a new "length" argument to the hci pincode reply to allow
sending binary pins including \0 characters.
---
 plugins/hciops.c  |    9 ++++-----
 plugins/mgmtops.c |   14 ++++++--------
 src/adapter.c     |    2 +-
 src/adapter.h     |    2 +-
 4 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/plugins/hciops.c b/plugins/hciops.c
index 93f6f21..afac330 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -3296,7 +3296,7 @@ static int hciops_remove_bonding(int index, bdaddr_t *bdaddr)
 	return 0;
 }
 
-static int hciops_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
+static int hciops_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin, size_t pinlen)
 {
 	struct dev_info *dev = &devs[index];
 	char addr[18];
@@ -3307,14 +3307,13 @@ static int hciops_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
 
 	if (pin) {
 		pin_code_reply_cp pr;
-		size_t len = strlen(pin);
 
-		dev->pin_length = len;
+		dev->pin_length = pinlen;
 
 		memset(&pr, 0, sizeof(pr));
 		bacpy(&pr.bdaddr, bdaddr);
-		memcpy(pr.pin_code, pin, len);
-		pr.pin_len = len;
+		memcpy(pr.pin_code, pin, pinlen);
+		pr.pin_len = pinlen;
 		err = hci_send_cmd(dev->sk, OGF_LINK_CTL,
 						OCF_PIN_CODE_REPLY,
 						PIN_CODE_REPLY_CP_SIZE, &pr);
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 042afc5..d03a29d 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -493,7 +493,7 @@ static void mgmt_connect_failed(int sk, uint16_t index, void *buf, size_t len)
 	btd_event_bonding_complete(&info->bdaddr, &ev->bdaddr, ev->status);
 }
 
-static int mgmt_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
+static int mgmt_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin, size_t pinlen)
 {
 	char buf[MGMT_HDR_SIZE + sizeof(struct mgmt_cp_pin_code_reply)];
 	struct mgmt_hdr *hdr = (void *) buf;
@@ -501,7 +501,7 @@ static int mgmt_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
 	char addr[18];
 
 	ba2str(bdaddr, addr);
-	DBG("index %d addr %s pin %s", index, addr, pin ? pin : "<none>");
+	DBG("index %d addr %s pinlen %lu", index, addr, pinlen);
 
 	memset(buf, 0, sizeof(buf));
 
@@ -518,10 +518,8 @@ static int mgmt_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
 		buf_len = sizeof(*hdr) + sizeof(*cp);
 	} else {
 		struct mgmt_cp_pin_code_reply *cp;
-		size_t pin_len;
 
-		pin_len = strlen(pin);
-		if (pin_len > 16)
+		if (pinlen > 16)
 			return -EINVAL;
 
 		hdr->opcode = htobs(MGMT_OP_PIN_CODE_REPLY);
@@ -530,8 +528,8 @@ static int mgmt_pincode_reply(int index, bdaddr_t *bdaddr, const char *pin)
 
 		cp = (void *) &buf[sizeof(*hdr)];
 		bacpy(&cp->bdaddr, bdaddr);
-		cp->pin_len = pin_len;
-		memcpy(cp->pin_code, pin, pin_len);
+		cp->pin_len = pinlen;
+		memcpy(cp->pin_code, pin, pinlen);
 
 		buf_len = sizeof(*hdr) + sizeof(*cp);
 	}
@@ -568,7 +566,7 @@ static void mgmt_pin_code_request(int sk, uint16_t index, void *buf, size_t len)
 	err = btd_event_request_pin(&info->bdaddr, &ev->bdaddr);
 	if (err < 0) {
 		error("btd_event_request_pin: %s", strerror(-err));
-		mgmt_pincode_reply(index, &ev->bdaddr, NULL);
+		mgmt_pincode_reply(index, &ev->bdaddr, NULL, 0);
 	}
 }
 
diff --git a/src/adapter.c b/src/adapter.c
index c400bfd..83f3217 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3703,7 +3703,7 @@ int btd_adapter_remove_bonding(struct btd_adapter *adapter, bdaddr_t *bdaddr)
 int btd_adapter_pincode_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
 							const char *pin)
 {
-	return adapter_ops->pincode_reply(adapter->dev_id, bdaddr, pin);
+	return adapter_ops->pincode_reply(adapter->dev_id, bdaddr, pin, pin ? strlen(pin) : 0);
 }
 
 int btd_adapter_confirm_reply(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/adapter.h b/src/adapter.h
index 308af75..fd2fc12 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -221,7 +221,7 @@ struct btd_adapter_ops {
 	int (*read_local_features) (int index, uint8_t *features);
 	int (*disconnect) (int index, bdaddr_t *bdaddr);
 	int (*remove_bonding) (int index, bdaddr_t *bdaddr);
-	int (*pincode_reply) (int index, bdaddr_t *bdaddr, const char *pin);
+	int (*pincode_reply) (int index, bdaddr_t *bdaddr, const char *pin, size_t pinlen);
 	int (*confirm_reply) (int index, bdaddr_t *bdaddr, gboolean success);
 	int (*passkey_reply) (int index, bdaddr_t *bdaddr, uint32_t passkey);
 	int (*enable_le) (int index);
-- 
1.7.4.4


^ permalink raw reply related

* [RFC][PATCH 0/4] Allow hexadecimal encoded pins
From: David Herrmann @ 2011-04-10 17:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, hadess, dforsi, David Herrmann

This patch series adds support for hexadecimal encoded pins. This is
no final patch and I would be glad to get some feedback.

This patch series solves the problem that the current bluez implementation
does not allow binary PINs that contain ASCII \0 characters. This is needed
for several devices that take bluetooth addresses as PINs. I had the
following ideas to implement binary pins:

 - Hard coding binary pins into bluetoothd by detecting the device with
   PnP VID/PID information as suggested by Marcel Holtmann.
   However, this is not possible (as noted by Bastien Nocera) because
   devices may refuse to offer SDP information for unpaired hosts.
   Furthermore, SDP records are retrieved after pairing with the remote
   device unless they're cached.
 - Adding a new dbus agent interface that returns pins as byte-arrays
   instead of 0-terminated strings. However, this either breaks backward-
   compatibility or needs _huge_ additions to the dbus interface.
 - Adding escape-sequences to pins or special pin parsing. This does break
   backward-compatibility but may be implemented in a way that reduces
   problems to a minimum.

I implemented the first approach a week ago as discussed on the mailing list
which turned out to be not appropriate. The second approach is probably the
cleanest one but requires huge dbus API additions. This patch series
implements the third approach. See patch 3/4 for details on the suggested
PIN encoding.

Pin encoding with the dollar sign is just a temporary approach which makes
the implementation quite easy and shows the idea of this patch. However,
the encoding is of course open for discussion.


Binary pin support is inspired by getting Nintendo Wiimote pairing support.
To test wiimote pairing with this patch series, do the following:
 - assume the local bdaddr is: 01:23:45:67:89:ab
   and the wiimote bdaddr is: ba:98:76:54:32:10
 - Pairing with red-sync button, use pin: $ab8967452301 (host addr. backwards)
 - Pairing with 1+2 buttons, use pin: $1032547698ba (wiimote addr backwards)
Automatic reconnection is only enabled in the wiimote when synced with the
red-sync button. The 1+2 button method is only for temporary connections.


Regards
David

^ permalink raw reply

* [PATCH 1/5] Moving test_setup.display_attributes to kvm_utils
From: Lucas Meneghel Rodrigues @ 2011-04-10 17:10 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Lucas Meneghel Rodrigues

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/kvm_utils.py  |   14 ++++++++++++++
 client/tests/kvm/test_setup.py |   18 +++---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index c3810f9..38c4afe 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -6,6 +6,7 @@ KVM test utility functions.
 
 import time, string, random, socket, os, signal, re, logging, commands, cPickle
 import fcntl, shelve, ConfigParser, rss_file_transfer, threading, sys, UserDict
+import inspect
 from autotest_lib.client.bin import utils, os_dep
 from autotest_lib.client.common_lib import error, logging_config
 import kvm_subprocess
@@ -1199,6 +1200,19 @@ def create_report(report_dir, results_dir):
     os.system('%s -r %s -f %s -R' % (reporter, results_dir, html_file))
 
 
+def display_attributes(instance):
+    """
+    Inspects a given class instance attributes and displays them, convenient
+    for debugging.
+    """
+    logging.debug("Attributes set:")
+    for member in inspect.getmembers(instance):
+        name, value = member
+        attribute = getattr(instance, name)
+        if not (name.startswith("__") or callable(attribute) or not value):
+            logging.debug("    %s: %s", name, value)
+
+
 def get_full_pci_id(pci_id):
     """
     Get full PCI ID of pci_id.
diff --git a/client/tests/kvm/test_setup.py b/client/tests/kvm/test_setup.py
index 1125aea..b4363e5 100644
--- a/client/tests/kvm/test_setup.py
+++ b/client/tests/kvm/test_setup.py
@@ -5,6 +5,7 @@ import os, shutil, tempfile, re, ConfigParser, glob, inspect
 import logging, time
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
+import kvm_utils
 
 
 @error.context_aware
@@ -42,19 +43,6 @@ def clean_old_image(image):
         os.remove(image)
 
 
-def display_attributes(instance):
-    """
-    Inspects a given class instance attributes and displays them, convenient
-    for debugging.
-    """
-    logging.debug("Attributes set:")
-    for member in inspect.getmembers(instance):
-        name, value = member
-        attribute = getattr(instance, name)
-        if not (name.startswith("__") or callable(attribute) or not value):
-            logging.debug("    %s: %s", name, value)
-
-
 class Disk(object):
     """
     Abstract class for Disk objects, with the common methods implemented.
@@ -490,7 +478,7 @@ class UnattendedInstallConfig(object):
         Uses an appropriate strategy according to each install model.
         """
         logging.info("Starting unattended install setup")
-        display_attributes(self)
+        kvm_utils.display_attributes(self)
 
         if self.unattended_file and (self.floppy or self.cdrom_unattended):
             self.setup_boot_disk()
@@ -640,7 +628,7 @@ class EnospcConfig(object):
     def setup(self):
         logging.debug("Starting enospc setup")
         error.context("performing enospc setup")
-        display_attributes(self)
+        kvm_utils.display_attributes(self)
         # Double check if there aren't any leftovers
         self.cleanup()
         try:
-- 
1.7.4.2


^ permalink raw reply related

* [PATCH 5/5] KVM test: installer: Fix bug on patch applying code
From: Lucas Meneghel Rodrigues @ 2011-04-10 17:10 UTC (permalink / raw)
  To: autotest; +Cc: kvm
In-Reply-To: <1302455423-32116-1-git-send-email-lmr@redhat.com>

Patch command was missing <, let's fix it.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/installer.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/installer.py b/client/tests/kvm/installer.py
index 6ccb7fa..8026d6d 100644
--- a/client/tests/kvm/installer.py
+++ b/client/tests/kvm/installer.py
@@ -680,7 +680,7 @@ class GitInstaller(SourceDirInstaller):
             for patch in user_patches:
                 utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                    os.path.basename(patch)))
-                utils.system('patch -p1 %s' % os.path.basename(patch))
+                utils.system('patch -p1 < %s' % os.path.basename(patch))
 
         if kernel_repo:
             kernel_srcdir = os.path.join(self.srcdir, "kvm")
@@ -692,7 +692,7 @@ class GitInstaller(SourceDirInstaller):
                 for patch in kernel_patches:
                     utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                        os.path.basename(patch)))
-                    utils.system('patch -p1 %s' % os.path.basename(patch))
+                    utils.system('patch -p1 < %s' % os.path.basename(patch))
         else:
             self.kernel_srcdir = None
 
@@ -706,7 +706,7 @@ class GitInstaller(SourceDirInstaller):
                 for patch in kmod_patches:
                     utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                        os.path.basename(patch)))
-                    utils.system('patch -p1 %s' % os.path.basename(patch))
+                    utils.system('patch -p1 < %s' % os.path.basename(patch))
         else:
             self.kmod_srcdir = None
 
-- 
1.7.4.2

^ permalink raw reply related

* [PATCH 4/5] KVM test: Cleaning unused imports on test_setup
From: Lucas Meneghel Rodrigues @ 2011-04-10 17:10 UTC (permalink / raw)
  To: autotest; +Cc: kvm
In-Reply-To: <1302455423-32116-1-git-send-email-lmr@redhat.com>

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/test_setup.py |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/test_setup.py b/client/tests/kvm/test_setup.py
index 7df25ff..f915c1b 100644
--- a/client/tests/kvm/test_setup.py
+++ b/client/tests/kvm/test_setup.py
@@ -1,11 +1,9 @@
 """
 Library to perform pre/post test setup for KVM autotest.
 """
-import os, shutil, tempfile, re, ConfigParser, glob, inspect
-import logging, time
+import os, logging
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
-import kvm_utils
 
 
 class HugePageConfig(object):
-- 
1.7.4.2

^ permalink raw reply related

* [PATCH 3/5] KVM test: Moving unattended_install setup to test code
From: Lucas Meneghel Rodrigues @ 2011-04-10 17:10 UTC (permalink / raw)
  To: autotest; +Cc: kvm
In-Reply-To: <1302455423-32116-1-git-send-email-lmr@redhat.com>

Also, set start_vm = no

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/kvm_preprocessing.py        |    4 -
 client/tests/kvm/test_setup.py               |  486 -------------------------
 client/tests/kvm/tests/unattended_install.py |  495 +++++++++++++++++++++++++-
 client/tests/kvm/tests_base.cfg.sample       |    1 +
 4 files changed, 493 insertions(+), 493 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index 71e468d..e2cafe9 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -257,10 +257,6 @@ def preprocess(test, params, env):
         h = test_setup.HugePageConfig(params)
         h.setup()
 
-    if params.get("type") == "unattended_install":
-        u = test_setup.UnattendedInstallConfig(test, params)
-        u.setup()
-
     # Execute any pre_commands
     if params.get("pre_command"):
         process_command(test, params, env, params.get("pre_command"),
diff --git a/client/tests/kvm/test_setup.py b/client/tests/kvm/test_setup.py
index b93a941..7df25ff 100644
--- a/client/tests/kvm/test_setup.py
+++ b/client/tests/kvm/test_setup.py
@@ -8,492 +8,6 @@ from autotest_lib.client.bin import utils
 import kvm_utils
 
 
-@error.context_aware
-def cleanup(dir):
-    """
-    If dir is a mountpoint, do what is possible to unmount it. Afterwards,
-    try to remove it.
-
-    @param dir: Directory to be cleaned up.
-    """
-    error.context("cleaning up unattended install directory %s" % dir)
-    if os.path.ismount(dir):
-        utils.run('fuser -k %s' % dir, ignore_status=True)
-        utils.run('umount %s' % dir)
-    if os.path.isdir(dir):
-        shutil.rmtree(dir)
-
-
-@error.context_aware
-def clean_old_image(image):
-    """
-    Clean a leftover image file from previous processes. If it contains a
-    mounted file system, do the proper cleanup procedures.
-
-    @param image: Path to image to be cleaned up.
-    """
-    error.context("cleaning up old leftover image %s" % image)
-    if os.path.exists(image):
-        mtab = open('/etc/mtab', 'r')
-        mtab_contents = mtab.read()
-        mtab.close()
-        if image in mtab_contents:
-            utils.run('fuser -k %s' % image, ignore_status=True)
-            utils.run('umount %s' % image)
-        os.remove(image)
-
-
-class Disk(object):
-    """
-    Abstract class for Disk objects, with the common methods implemented.
-    """
-    def __init__(self):
-        self.path = None
-
-
-    def setup_answer_file(self, filename, contents):
-        utils.open_write_close(os.path.join(self.mount, filename), contents)
-
-
-    def copy_to(self, src):
-        logging.debug("Copying %s to disk image mount", src)
-        dst = os.path.join(self.mount, os.path.basename(src))
-        if os.path.isdir(src):
-            shutil.copytree(src, dst)
-        elif os.path.isfile(src):
-            shutil.copyfile(src, dst)
-
-
-    def close(self):
-        os.chmod(self.path, 0755)
-        cleanup(self.mount)
-        logging.debug("Disk %s successfuly set", self.path)
-
-
-class FloppyDisk(Disk):
-    """
-    Represents a 1.44 MB floppy disk. We can copy files to it, and setup it in
-    convenient ways.
-    """
-    @error.context_aware
-    def __init__(self, path, qemu_img_binary, tmpdir):
-        error.context("Creating unattended install floppy image %s" % path)
-        self.tmpdir = tmpdir
-        self.mount = tempfile.mkdtemp(prefix='floppy_', dir=self.tmpdir)
-        self.virtio_mount = None
-        self.path = path
-        clean_old_image(path)
-        if not os.path.isdir(os.path.dirname(path)):
-            os.makedirs(os.path.dirname(path))
-
-        try:
-            c_cmd = '%s create -f raw %s 1440k' % (qemu_img_binary, path)
-            utils.run(c_cmd)
-            f_cmd = 'mkfs.msdos -s 1 %s' % path
-            utils.run(f_cmd)
-            m_cmd = 'mount -o loop,rw %s %s' % (path, self.mount)
-            utils.run(m_cmd)
-        except error.CmdError, e:
-            cleanup(self.mount)
-            raise
-
-
-    def _copy_virtio_drivers(self, virtio_floppy):
-        """
-        Copy the virtio drivers on the virtio floppy to the install floppy.
-
-        1) Mount the floppy containing the viostor drivers
-        2) Copy its contents to the root of the install floppy
-        """
-        virtio_mount = tempfile.mkdtemp(prefix='virtio_floppy_',
-                                        dir=self.tmpdir)
-
-        pwd = os.getcwd()
-        try:
-            m_cmd = 'mount -o loop %s %s' % (virtio_floppy, virtio_mount)
-            utils.run(m_cmd)
-            os.chdir(virtio_mount)
-            path_list = glob.glob('*')
-            for path in path_list:
-                self.copy_to(path)
-        finally:
-            os.chdir(pwd)
-            cleanup(virtio_mount)
-
-
-    def setup_virtio_win2003(self, virtio_floppy, virtio_oemsetup_id):
-        """
-        Setup the install floppy with the virtio storage drivers, win2003 style.
-
-        Win2003 and WinXP depend on the file txtsetup.oem file to install
-        the virtio drivers from the floppy, which is a .ini file.
-        Process:
-
-        1) Copy the virtio drivers on the virtio floppy to the install floppy
-        2) Parse the ini file with config parser
-        3) Modify the identifier of the default session that is going to be
-           executed on the config parser object
-        4) Re-write the config file to the disk
-        """
-        self._copy_virtio_drivers(virtio_floppy)
-        txtsetup_oem = os.path.join(self.mount, 'txtsetup.oem')
-        if not os.path.isfile(txtsetup_oem):
-            raise IOError('File txtsetup.oem not found on the install '
-                          'floppy. Please verify if your floppy virtio '
-                          'driver image has this file')
-        parser = ConfigParser.ConfigParser()
-        parser.read(txtsetup_oem)
-        if not parser.has_section('Defaults'):
-            raise ValueError('File txtsetup.oem does not have the session '
-                             '"Defaults". Please check txtsetup.oem')
-        default_driver = parser.get('Defaults', 'SCSI')
-        if default_driver != virtio_oemsetup_id:
-            parser.set('Defaults', 'SCSI', virtio_oemsetup_id)
-            fp = open(txtsetup_oem, 'w')
-            parser.write(fp)
-            fp.close()
-
-
-    def setup_virtio_win2008(self, virtio_floppy):
-        """
-        Setup the install floppy with the virtio storage drivers, win2008 style.
-
-        Win2008, Vista and 7 require people to point out the path to the drivers
-        on the unattended file, so we just need to copy the drivers to the
-        driver floppy disk.
-        Process:
-
-        1) Copy the virtio drivers on the virtio floppy to the install floppy
-        """
-        self._copy_virtio_drivers(virtio_floppy)
-
-
-class CdromDisk(Disk):
-    """
-    Represents a CDROM disk that we can master according to our needs.
-    """
-    def __init__(self, path, tmpdir):
-        self.mount = tempfile.mkdtemp(prefix='cdrom_unattended_', dir=tmpdir)
-        self.path = path
-        clean_old_image(path)
-        if not os.path.isdir(os.path.dirname(path)):
-            os.makedirs(os.path.dirname(path))
-
-
-    @error.context_aware
-    def close(self):
-        error.context("Creating unattended install CD image %s" % self.path)
-        g_cmd = ('mkisofs -o %s -max-iso9660-filenames '
-                 '-relaxed-filenames -D --input-charset iso8859-1 '
-                 '%s' % (self.path, self.mount))
-        utils.run(g_cmd)
-
-        os.chmod(self.path, 0755)
-        cleanup(self.mount)
-        logging.debug("unattended install CD image %s successfuly created",
-                      self.path)
-
-
-class UnattendedInstallConfig(object):
-    """
-    Creates a floppy disk image that will contain a config file for unattended
-    OS install. The parameters to the script are retrieved from environment
-    variables.
-    """
-    def __init__(self, test, params):
-        """
-        Sets class atributes from test parameters.
-
-        @param test: KVM test object.
-        @param params: Dictionary with test parameters.
-        """
-        root_dir = test.bindir
-        images_dir = os.path.join(root_dir, 'images')
-        self.deps_dir = os.path.join(root_dir, 'deps')
-        self.unattended_dir = os.path.join(root_dir, 'unattended')
-
-        attributes = ['kernel_args', 'finish_program', 'cdrom_cd1',
-                      'unattended_file', 'medium', 'url', 'kernel', 'initrd',
-                      'nfs_server', 'nfs_dir', 'install_virtio', 'floppy',
-                      'cdrom_unattended', 'boot_path', 'extra_params',
-                      'qemu_img_binary', 'cdkey', 'finish_program']
-
-        for a in attributes:
-            setattr(self, a, params.get(a, ''))
-
-        if self.install_virtio == 'yes':
-            v_attributes = ['virtio_floppy', 'virtio_storage_path',
-                            'virtio_network_path', 'virtio_oemsetup_id',
-                            'virtio_network_installer']
-            for va in v_attributes:
-                setattr(self, va, params.get(va, ''))
-
-        self.tmpdir = test.tmpdir
-
-        if getattr(self, 'unattended_file'):
-            self.unattended_file = os.path.join(root_dir, self.unattended_file)
-
-        if getattr(self, 'finish_program'):
-            self.finish_program = os.path.join(root_dir, self.finish_program)
-
-        if getattr(self, 'qemu_img_binary'):
-            if not os.path.isfile(getattr(self, 'qemu_img_binary')):
-                self.qemu_img_binary = os.path.join(root_dir,
-                                                    self.qemu_img_binary)
-
-        if getattr(self, 'cdrom_cd1'):
-            self.cdrom_cd1 = os.path.join(root_dir, self.cdrom_cd1)
-        self.cdrom_cd1_mount = tempfile.mkdtemp(prefix='cdrom_cd1_',
-                                                dir=self.tmpdir)
-        if self.medium == 'nfs':
-            self.nfs_mount = tempfile.mkdtemp(prefix='nfs_',
-                                              dir=self.tmpdir)
-
-        if getattr(self, 'floppy'):
-            self.floppy = os.path.join(root_dir, self.floppy)
-            if not os.path.isdir(os.path.dirname(self.floppy)):
-                os.makedirs(os.path.dirname(self.floppy))
-
-        self.image_path = os.path.dirname(self.kernel)
-
-
-    @error.context_aware
-    def render_answer_file(self):
-        """
-        Replace KVM_TEST_CDKEY (in the unattended file) with the cdkey
-        provided for this test and replace the KVM_TEST_MEDIUM with
-        the tree url or nfs address provided for this test.
-
-        @return: Answer file contents
-        """
-        error.base_context('Rendering final answer file')
-        error.context('Reading answer file %s' % self.unattended_file)
-        unattended_contents = open(self.unattended_file).read()
-        dummy_cdkey_re = r'\bKVM_TEST_CDKEY\b'
-        if re.search(dummy_cdkey_re, unattended_contents):
-            if self.cdkey:
-                unattended_contents = re.sub(dummy_cdkey_re, self.cdkey,
-                                             unattended_contents)
-            else:
-                print ("WARNING: 'cdkey' required but not specified for "
-                       "this unattended installation")
-
-        dummy_medium_re = r'\bKVM_TEST_MEDIUM\b'
-        if self.medium == "cdrom":
-            content = "cdrom"
-        elif self.medium == "url":
-            content = "url --url %s" % self.url
-        elif self.medium == "nfs":
-            content = "nfs --server=%s --dir=%s" % (self.nfs_server,
-                                                    self.nfs_dir)
-        else:
-            raise ValueError("Unexpected installation medium %s" % self.url)
-
-        unattended_contents = re.sub(dummy_medium_re, content,
-                                     unattended_contents)
-
-        def replace_virtio_key(contents, dummy_re, attribute_name):
-            """
-            Replace a virtio dummy string with contents.
-
-            If install_virtio is not set, replace it with a dummy string.
-
-            @param contents: Contents of the unattended file
-            @param dummy_re: Regular expression used to search on the.
-                    unattended file contents.
-            @param env: Name of the environment variable.
-            """
-            dummy_path = "C:"
-            driver = getattr(self, attribute_name, '')
-
-            if re.search(dummy_re, contents):
-                if self.install_virtio == "yes":
-                    if driver.endswith("msi"):
-                        driver = 'msiexec /passive /package ' + driver
-                    else:
-                        try:
-                            # Let's escape windows style paths properly
-                            drive, path = driver.split(":")
-                            driver = drive + ":" + re.escape(path)
-                        except:
-                            pass
-                    contents = re.sub(dummy_re, driver, contents)
-                else:
-                    contents = re.sub(dummy_re, dummy_path, contents)
-            return contents
-
-        vdict = {r'\bKVM_TEST_STORAGE_DRIVER_PATH\b':
-                 'virtio_storage_path',
-                 r'\bKVM_TEST_NETWORK_DRIVER_PATH\b':
-                 'virtio_network_path',
-                 r'\bKVM_TEST_VIRTIO_NETWORK_INSTALLER\b':
-                 'virtio_network_installer_path'}
-
-        for vkey in vdict:
-            unattended_contents = replace_virtio_key(
-                                                   contents=unattended_contents,
-                                                   dummy_re=vkey,
-                                                   attribute_name=vdict[vkey])
-
-        logging.debug("Unattended install contents:")
-        for line in unattended_contents.splitlines():
-            logging.debug(line)
-        return unattended_contents
-
-
-    def setup_boot_disk(self):
-        answer_contents = self.render_answer_file()
-
-        if self.unattended_file.endswith('.sif'):
-            dest_fname = 'winnt.sif'
-            setup_file = 'winnt.bat'
-            boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
-                                   self.tmpdir)
-            boot_disk.setup_answer_file(dest_fname, answer_contents)
-            setup_file_path = os.path.join(self.unattended_dir, setup_file)
-            boot_disk.copy_to(setup_file_path)
-            if self.install_virtio == "yes":
-                boot_disk.setup_virtio_win2003(self.virtio_floppy,
-                                               self.virtio_oemsetup_id)
-            boot_disk.copy_to(self.finish_program)
-
-        elif self.unattended_file.endswith('.ks'):
-            # Red Hat kickstart install
-            dest_fname = 'ks.cfg'
-            if self.cdrom_unattended:
-                boot_disk = CdromDisk(self.cdrom_unattended, self.tmpdir)
-            elif self.floppy:
-                boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
-                                       self.tmpdir)
-            else:
-                raise ValueError("Neither cdrom_unattended nor floppy set "
-                                 "on the config file, please verify")
-            boot_disk.setup_answer_file(dest_fname, answer_contents)
-
-        elif self.unattended_file.endswith('.xml'):
-            if "autoyast" in self.extra_params:
-                # SUSE autoyast install
-                dest_fname = "autoinst.xml"
-                if self.cdrom_unattended:
-                    boot_disk = CdromDisk(self.cdrom_unattended)
-                elif self.floppy:
-                    boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
-                                           self.tmpdir)
-                else:
-                    raise ValueError("Neither cdrom_unattended nor floppy set "
-                                     "on the config file, please verify")
-                boot_disk.setup_answer_file(dest_fname, answer_contents)
-
-            else:
-                # Windows unattended install
-                dest_fname = "autounattend.xml"
-                boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
-                                       self.tmpdir)
-                boot_disk.setup_answer_file(dest_fname, answer_contents)
-                if self.install_virtio == "yes":
-                    boot_disk.setup_virtio_win2008(self.virtio_floppy)
-                boot_disk.copy_to(self.finish_program)
-
-        else:
-            raise ValueError('Unknown answer file type: %s' %
-                             self.unattended_file)
-
-        boot_disk.close()
-
-
-    @error.context_aware
-    def setup_cdrom(self):
-        """
-        Mount cdrom and copy vmlinuz and initrd.img.
-        """
-        error.context("Copying vmlinuz and initrd.img from install cdrom %s" %
-                      self.cdrom_cd1)
-        m_cmd = ('mount -t iso9660 -v -o loop,ro %s %s' %
-                 (self.cdrom_cd1, self.cdrom_cd1_mount))
-        utils.run(m_cmd)
-
-        try:
-            if not os.path.isdir(self.image_path):
-                os.makedirs(self.image_path)
-            kernel_fetch_cmd = ("cp %s/%s/%s %s" %
-                                (self.cdrom_cd1_mount, self.boot_path,
-                                 os.path.basename(self.kernel), self.kernel))
-            utils.run(kernel_fetch_cmd)
-            initrd_fetch_cmd = ("cp %s/%s/%s %s" %
-                                (self.cdrom_cd1_mount, self.boot_path,
-                                 os.path.basename(self.initrd), self.initrd))
-            utils.run(initrd_fetch_cmd)
-        finally:
-            cleanup(self.cdrom_cd1_mount)
-
-
-    @error.context_aware
-    def setup_url(self):
-        """
-        Download the vmlinuz and initrd.img from URL.
-        """
-        error.context("downloading vmlinuz and initrd.img from %s" % self.url)
-        os.chdir(self.image_path)
-        kernel_fetch_cmd = "wget -q %s/%s/%s" % (self.url, self.boot_path,
-                                                 os.path.basename(self.kernel))
-        initrd_fetch_cmd = "wget -q %s/%s/%s" % (self.url, self.boot_path,
-                                                 os.path.basename(self.initrd))
-
-        if os.path.exists(self.kernel):
-            os.remove(self.kernel)
-        if os.path.exists(self.initrd):
-            os.remove(self.initrd)
-
-        utils.run(kernel_fetch_cmd)
-        utils.run(initrd_fetch_cmd)
-
-
-    def setup_nfs(self):
-        """
-        Copy the vmlinuz and initrd.img from nfs.
-        """
-        error.context("copying the vmlinuz and initrd.img from NFS share")
-
-        m_cmd = ("mount %s:%s %s -o ro" %
-                 (self.nfs_server, self.nfs_dir, self.nfs_mount))
-        utils.run(m_cmd)
-
-        try:
-            kernel_fetch_cmd = ("cp %s/%s/%s %s" %
-                                (self.nfs_mount, self.boot_path,
-                                os.path.basename(self.kernel), self.image_path))
-            utils.run(kernel_fetch_cmd)
-            initrd_fetch_cmd = ("cp %s/%s/%s %s" %
-                                (self.nfs_mount, self.boot_path,
-                                os.path.basename(self.initrd), self.image_path))
-            utils.run(initrd_fetch_cmd)
-        finally:
-            cleanup(self.nfs_mount)
-
-
-    def setup(self):
-        """
-        Configure the environment for unattended install.
-
-        Uses an appropriate strategy according to each install model.
-        """
-        logging.info("Starting unattended install setup")
-        kvm_utils.display_attributes(self)
-
-        if self.unattended_file and (self.floppy or self.cdrom_unattended):
-            self.setup_boot_disk()
-        if self.medium == "cdrom":
-            if self.kernel and self.initrd:
-                self.setup_cdrom()
-        elif self.medium == "url":
-            self.setup_url()
-        elif self.medium == "nfs":
-            self.setup_nfs()
-        else:
-            raise ValueError("Unexpected installation method %s" %
-                             self.medium)
-
-
 class HugePageConfig(object):
     def __init__(self, params):
         """
diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index 955f8d6..40adfb9 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -1,6 +1,493 @@
-import logging, time, socket, re
+import logging, time, socket, re, os, shutil, tempfile, glob, ConfigParser
 from autotest_lib.client.common_lib import error
-import kvm_vm
+from autotest_lib.client.bin import utils
+import kvm_vm, kvm_utils
+
+
+@error.context_aware
+def cleanup(dir):
+    """
+    If dir is a mountpoint, do what is possible to unmount it. Afterwards,
+    try to remove it.
+
+    @param dir: Directory to be cleaned up.
+    """
+    error.context("cleaning up unattended install directory %s" % dir)
+    if os.path.ismount(dir):
+        utils.run('fuser -k %s' % dir, ignore_status=True)
+        utils.run('umount %s' % dir)
+    if os.path.isdir(dir):
+        shutil.rmtree(dir)
+
+
+@error.context_aware
+def clean_old_image(image):
+    """
+    Clean a leftover image file from previous processes. If it contains a
+    mounted file system, do the proper cleanup procedures.
+
+    @param image: Path to image to be cleaned up.
+    """
+    error.context("cleaning up old leftover image %s" % image)
+    if os.path.exists(image):
+        mtab = open('/etc/mtab', 'r')
+        mtab_contents = mtab.read()
+        mtab.close()
+        if image in mtab_contents:
+            utils.run('fuser -k %s' % image, ignore_status=True)
+            utils.run('umount %s' % image)
+        os.remove(image)
+
+
+class Disk(object):
+    """
+    Abstract class for Disk objects, with the common methods implemented.
+    """
+    def __init__(self):
+        self.path = None
+
+
+    def setup_answer_file(self, filename, contents):
+        utils.open_write_close(os.path.join(self.mount, filename), contents)
+
+
+    def copy_to(self, src):
+        logging.debug("Copying %s to disk image mount", src)
+        dst = os.path.join(self.mount, os.path.basename(src))
+        if os.path.isdir(src):
+            shutil.copytree(src, dst)
+        elif os.path.isfile(src):
+            shutil.copyfile(src, dst)
+
+
+    def close(self):
+        os.chmod(self.path, 0755)
+        cleanup(self.mount)
+        logging.debug("Disk %s successfuly set", self.path)
+
+
+class FloppyDisk(Disk):
+    """
+    Represents a 1.44 MB floppy disk. We can copy files to it, and setup it in
+    convenient ways.
+    """
+    @error.context_aware
+    def __init__(self, path, qemu_img_binary, tmpdir):
+        error.context("Creating unattended install floppy image %s" % path)
+        self.tmpdir = tmpdir
+        self.mount = tempfile.mkdtemp(prefix='floppy_', dir=self.tmpdir)
+        self.virtio_mount = None
+        self.path = path
+        clean_old_image(path)
+        if not os.path.isdir(os.path.dirname(path)):
+            os.makedirs(os.path.dirname(path))
+
+        try:
+            c_cmd = '%s create -f raw %s 1440k' % (qemu_img_binary, path)
+            utils.run(c_cmd)
+            f_cmd = 'mkfs.msdos -s 1 %s' % path
+            utils.run(f_cmd)
+            m_cmd = 'mount -o loop,rw %s %s' % (path, self.mount)
+            utils.run(m_cmd)
+        except error.CmdError, e:
+            cleanup(self.mount)
+            raise
+
+
+    def _copy_virtio_drivers(self, virtio_floppy):
+        """
+        Copy the virtio drivers on the virtio floppy to the install floppy.
+
+        1) Mount the floppy containing the viostor drivers
+        2) Copy its contents to the root of the install floppy
+        """
+        virtio_mount = tempfile.mkdtemp(prefix='virtio_floppy_',
+                                        dir=self.tmpdir)
+
+        pwd = os.getcwd()
+        try:
+            m_cmd = 'mount -o loop %s %s' % (virtio_floppy, virtio_mount)
+            utils.run(m_cmd)
+            os.chdir(virtio_mount)
+            path_list = glob.glob('*')
+            for path in path_list:
+                self.copy_to(path)
+        finally:
+            os.chdir(pwd)
+            cleanup(virtio_mount)
+
+
+    def setup_virtio_win2003(self, virtio_floppy, virtio_oemsetup_id):
+        """
+        Setup the install floppy with the virtio storage drivers, win2003 style.
+
+        Win2003 and WinXP depend on the file txtsetup.oem file to install
+        the virtio drivers from the floppy, which is a .ini file.
+        Process:
+
+        1) Copy the virtio drivers on the virtio floppy to the install floppy
+        2) Parse the ini file with config parser
+        3) Modify the identifier of the default session that is going to be
+           executed on the config parser object
+        4) Re-write the config file to the disk
+        """
+        self._copy_virtio_drivers(virtio_floppy)
+        txtsetup_oem = os.path.join(self.mount, 'txtsetup.oem')
+        if not os.path.isfile(txtsetup_oem):
+            raise IOError('File txtsetup.oem not found on the install '
+                          'floppy. Please verify if your floppy virtio '
+                          'driver image has this file')
+        parser = ConfigParser.ConfigParser()
+        parser.read(txtsetup_oem)
+        if not parser.has_section('Defaults'):
+            raise ValueError('File txtsetup.oem does not have the session '
+                             '"Defaults". Please check txtsetup.oem')
+        default_driver = parser.get('Defaults', 'SCSI')
+        if default_driver != virtio_oemsetup_id:
+            parser.set('Defaults', 'SCSI', virtio_oemsetup_id)
+            fp = open(txtsetup_oem, 'w')
+            parser.write(fp)
+            fp.close()
+
+
+    def setup_virtio_win2008(self, virtio_floppy):
+        """
+        Setup the install floppy with the virtio storage drivers, win2008 style.
+
+        Win2008, Vista and 7 require people to point out the path to the drivers
+        on the unattended file, so we just need to copy the drivers to the
+        driver floppy disk.
+        Process:
+
+        1) Copy the virtio drivers on the virtio floppy to the install floppy
+        """
+        self._copy_virtio_drivers(virtio_floppy)
+
+
+class CdromDisk(Disk):
+    """
+    Represents a CDROM disk that we can master according to our needs.
+    """
+    def __init__(self, path, tmpdir):
+        self.mount = tempfile.mkdtemp(prefix='cdrom_unattended_', dir=tmpdir)
+        self.path = path
+        clean_old_image(path)
+        if not os.path.isdir(os.path.dirname(path)):
+            os.makedirs(os.path.dirname(path))
+
+
+    @error.context_aware
+    def close(self):
+        error.context("Creating unattended install CD image %s" % self.path)
+        g_cmd = ('mkisofs -o %s -max-iso9660-filenames '
+                 '-relaxed-filenames -D --input-charset iso8859-1 '
+                 '%s' % (self.path, self.mount))
+        utils.run(g_cmd)
+
+        os.chmod(self.path, 0755)
+        cleanup(self.mount)
+        logging.debug("unattended install CD image %s successfuly created",
+                      self.path)
+
+
+class UnattendedInstallConfig(object):
+    """
+    Creates a floppy disk image that will contain a config file for unattended
+    OS install. The parameters to the script are retrieved from environment
+    variables.
+    """
+    def __init__(self, test, params):
+        """
+        Sets class atributes from test parameters.
+
+        @param test: KVM test object.
+        @param params: Dictionary with test parameters.
+        """
+        root_dir = test.bindir
+        images_dir = os.path.join(root_dir, 'images')
+        self.deps_dir = os.path.join(root_dir, 'deps')
+        self.unattended_dir = os.path.join(root_dir, 'unattended')
+
+        attributes = ['kernel_args', 'finish_program', 'cdrom_cd1',
+                      'unattended_file', 'medium', 'url', 'kernel', 'initrd',
+                      'nfs_server', 'nfs_dir', 'install_virtio', 'floppy',
+                      'cdrom_unattended', 'boot_path', 'extra_params',
+                      'qemu_img_binary', 'cdkey', 'finish_program']
+
+        for a in attributes:
+            setattr(self, a, params.get(a, ''))
+
+        if self.install_virtio == 'yes':
+            v_attributes = ['virtio_floppy', 'virtio_storage_path',
+                            'virtio_network_path', 'virtio_oemsetup_id',
+                            'virtio_network_installer']
+            for va in v_attributes:
+                setattr(self, va, params.get(va, ''))
+
+        self.tmpdir = test.tmpdir
+
+        if getattr(self, 'unattended_file'):
+            self.unattended_file = os.path.join(root_dir, self.unattended_file)
+
+        if getattr(self, 'finish_program'):
+            self.finish_program = os.path.join(root_dir, self.finish_program)
+
+        if getattr(self, 'qemu_img_binary'):
+            if not os.path.isfile(getattr(self, 'qemu_img_binary')):
+                self.qemu_img_binary = os.path.join(root_dir,
+                                                    self.qemu_img_binary)
+
+        if getattr(self, 'cdrom_cd1'):
+            self.cdrom_cd1 = os.path.join(root_dir, self.cdrom_cd1)
+        self.cdrom_cd1_mount = tempfile.mkdtemp(prefix='cdrom_cd1_',
+                                                dir=self.tmpdir)
+        if self.medium == 'nfs':
+            self.nfs_mount = tempfile.mkdtemp(prefix='nfs_',
+                                              dir=self.tmpdir)
+
+        if getattr(self, 'floppy'):
+            self.floppy = os.path.join(root_dir, self.floppy)
+            if not os.path.isdir(os.path.dirname(self.floppy)):
+                os.makedirs(os.path.dirname(self.floppy))
+
+        self.image_path = os.path.dirname(self.kernel)
+
+
+    @error.context_aware
+    def render_answer_file(self):
+        """
+        Replace KVM_TEST_CDKEY (in the unattended file) with the cdkey
+        provided for this test and replace the KVM_TEST_MEDIUM with
+        the tree url or nfs address provided for this test.
+
+        @return: Answer file contents
+        """
+        error.base_context('Rendering final answer file')
+        error.context('Reading answer file %s' % self.unattended_file)
+        unattended_contents = open(self.unattended_file).read()
+        dummy_cdkey_re = r'\bKVM_TEST_CDKEY\b'
+        if re.search(dummy_cdkey_re, unattended_contents):
+            if self.cdkey:
+                unattended_contents = re.sub(dummy_cdkey_re, self.cdkey,
+                                             unattended_contents)
+            else:
+                print ("WARNING: 'cdkey' required but not specified for "
+                       "this unattended installation")
+
+        dummy_medium_re = r'\bKVM_TEST_MEDIUM\b'
+        if self.medium == "cdrom":
+            content = "cdrom"
+        elif self.medium == "url":
+            content = "url --url %s" % self.url
+        elif self.medium == "nfs":
+            content = "nfs --server=%s --dir=%s" % (self.nfs_server,
+                                                    self.nfs_dir)
+        else:
+            raise ValueError("Unexpected installation medium %s" % self.url)
+
+        unattended_contents = re.sub(dummy_medium_re, content,
+                                     unattended_contents)
+
+        def replace_virtio_key(contents, dummy_re, attribute_name):
+            """
+            Replace a virtio dummy string with contents.
+
+            If install_virtio is not set, replace it with a dummy string.
+
+            @param contents: Contents of the unattended file
+            @param dummy_re: Regular expression used to search on the.
+                    unattended file contents.
+            @param env: Name of the environment variable.
+            """
+            dummy_path = "C:"
+            driver = getattr(self, attribute_name, '')
+
+            if re.search(dummy_re, contents):
+                if self.install_virtio == "yes":
+                    if driver.endswith("msi"):
+                        driver = 'msiexec /passive /package ' + driver
+                    else:
+                        try:
+                            # Let's escape windows style paths properly
+                            drive, path = driver.split(":")
+                            driver = drive + ":" + re.escape(path)
+                        except:
+                            pass
+                    contents = re.sub(dummy_re, driver, contents)
+                else:
+                    contents = re.sub(dummy_re, dummy_path, contents)
+            return contents
+
+        vdict = {r'\bKVM_TEST_STORAGE_DRIVER_PATH\b':
+                 'virtio_storage_path',
+                 r'\bKVM_TEST_NETWORK_DRIVER_PATH\b':
+                 'virtio_network_path',
+                 r'\bKVM_TEST_VIRTIO_NETWORK_INSTALLER\b':
+                 'virtio_network_installer_path'}
+
+        for vkey in vdict:
+            unattended_contents = replace_virtio_key(
+                                                   contents=unattended_contents,
+                                                   dummy_re=vkey,
+                                                   attribute_name=vdict[vkey])
+
+        logging.debug("Unattended install contents:")
+        for line in unattended_contents.splitlines():
+            logging.debug(line)
+        return unattended_contents
+
+
+    def setup_boot_disk(self):
+        answer_contents = self.render_answer_file()
+
+        if self.unattended_file.endswith('.sif'):
+            dest_fname = 'winnt.sif'
+            setup_file = 'winnt.bat'
+            boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
+                                   self.tmpdir)
+            boot_disk.setup_answer_file(dest_fname, answer_contents)
+            setup_file_path = os.path.join(self.unattended_dir, setup_file)
+            boot_disk.copy_to(setup_file_path)
+            if self.install_virtio == "yes":
+                boot_disk.setup_virtio_win2003(self.virtio_floppy,
+                                               self.virtio_oemsetup_id)
+            boot_disk.copy_to(self.finish_program)
+
+        elif self.unattended_file.endswith('.ks'):
+            # Red Hat kickstart install
+            dest_fname = 'ks.cfg'
+            if self.cdrom_unattended:
+                boot_disk = CdromDisk(self.cdrom_unattended, self.tmpdir)
+            elif self.floppy:
+                boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
+                                       self.tmpdir)
+            else:
+                raise ValueError("Neither cdrom_unattended nor floppy set "
+                                 "on the config file, please verify")
+            boot_disk.setup_answer_file(dest_fname, answer_contents)
+
+        elif self.unattended_file.endswith('.xml'):
+            if "autoyast" in self.extra_params:
+                # SUSE autoyast install
+                dest_fname = "autoinst.xml"
+                if self.cdrom_unattended:
+                    boot_disk = CdromDisk(self.cdrom_unattended)
+                elif self.floppy:
+                    boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
+                                           self.tmpdir)
+                else:
+                    raise ValueError("Neither cdrom_unattended nor floppy set "
+                                     "on the config file, please verify")
+                boot_disk.setup_answer_file(dest_fname, answer_contents)
+
+            else:
+                # Windows unattended install
+                dest_fname = "autounattend.xml"
+                boot_disk = FloppyDisk(self.floppy, self.qemu_img_binary,
+                                       self.tmpdir)
+                boot_disk.setup_answer_file(dest_fname, answer_contents)
+                if self.install_virtio == "yes":
+                    boot_disk.setup_virtio_win2008(self.virtio_floppy)
+                boot_disk.copy_to(self.finish_program)
+
+        else:
+            raise ValueError('Unknown answer file type: %s' %
+                             self.unattended_file)
+
+        boot_disk.close()
+
+
+    @error.context_aware
+    def setup_cdrom(self):
+        """
+        Mount cdrom and copy vmlinuz and initrd.img.
+        """
+        error.context("Copying vmlinuz and initrd.img from install cdrom %s" %
+                      self.cdrom_cd1)
+        m_cmd = ('mount -t iso9660 -v -o loop,ro %s %s' %
+                 (self.cdrom_cd1, self.cdrom_cd1_mount))
+        utils.run(m_cmd)
+
+        try:
+            if not os.path.isdir(self.image_path):
+                os.makedirs(self.image_path)
+            kernel_fetch_cmd = ("cp %s/%s/%s %s" %
+                                (self.cdrom_cd1_mount, self.boot_path,
+                                 os.path.basename(self.kernel), self.kernel))
+            utils.run(kernel_fetch_cmd)
+            initrd_fetch_cmd = ("cp %s/%s/%s %s" %
+                                (self.cdrom_cd1_mount, self.boot_path,
+                                 os.path.basename(self.initrd), self.initrd))
+            utils.run(initrd_fetch_cmd)
+        finally:
+            cleanup(self.cdrom_cd1_mount)
+
+
+    @error.context_aware
+    def setup_url(self):
+        """
+        Download the vmlinuz and initrd.img from URL.
+        """
+        error.context("downloading vmlinuz and initrd.img from %s" % self.url)
+        os.chdir(self.image_path)
+        kernel_fetch_cmd = "wget -q %s/%s/%s" % (self.url, self.boot_path,
+                                                 os.path.basename(self.kernel))
+        initrd_fetch_cmd = "wget -q %s/%s/%s" % (self.url, self.boot_path,
+                                                 os.path.basename(self.initrd))
+
+        if os.path.exists(self.kernel):
+            os.remove(self.kernel)
+        if os.path.exists(self.initrd):
+            os.remove(self.initrd)
+
+        utils.run(kernel_fetch_cmd)
+        utils.run(initrd_fetch_cmd)
+
+
+    def setup_nfs(self):
+        """
+        Copy the vmlinuz and initrd.img from nfs.
+        """
+        error.context("copying the vmlinuz and initrd.img from NFS share")
+
+        m_cmd = ("mount %s:%s %s -o ro" %
+                 (self.nfs_server, self.nfs_dir, self.nfs_mount))
+        utils.run(m_cmd)
+
+        try:
+            kernel_fetch_cmd = ("cp %s/%s/%s %s" %
+                                (self.nfs_mount, self.boot_path,
+                                os.path.basename(self.kernel), self.image_path))
+            utils.run(kernel_fetch_cmd)
+            initrd_fetch_cmd = ("cp %s/%s/%s %s" %
+                                (self.nfs_mount, self.boot_path,
+                                os.path.basename(self.initrd), self.image_path))
+            utils.run(initrd_fetch_cmd)
+        finally:
+            cleanup(self.nfs_mount)
+
+
+    def setup(self):
+        """
+        Configure the environment for unattended install.
+
+        Uses an appropriate strategy according to each install model.
+        """
+        logging.info("Starting unattended install setup")
+        kvm_utils.display_attributes(self)
+
+        if self.unattended_file and (self.floppy or self.cdrom_unattended):
+            self.setup_boot_disk()
+        if self.medium == "cdrom":
+            if self.kernel and self.initrd:
+                self.setup_cdrom()
+        elif self.medium == "url":
+            self.setup_url()
+        elif self.medium == "nfs":
+            self.setup_nfs()
+        else:
+            raise ValueError("Unexpected installation method %s" %
+                             self.medium)
 
 
 @error.context_aware
@@ -14,8 +501,10 @@ def run_unattended_install(test, params, env):
     @param params: Dictionary with the test parameters.
     @param env: Dictionary with test environment.
     """
+    unattended_install_config = UnattendedInstallConfig(test, params)
+    unattended_install_config.setup()
     vm = env.get_vm(params["main_vm"])
-    vm.verify_alive()
+    vm.create()
 
     install_timeout = int(params.get("timeout", 3000))
     post_install_delay = int(params.get("post_install_delay", 0))
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index e25b18c..dbd1783 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -97,6 +97,7 @@ variants:
 
     - unattended_install:
         type = unattended_install
+        start_vm = no
         kill_vm = yes
         kill_vm_gracefully = yes
         kill_vm_on_error = yes
-- 
1.7.4.2

^ permalink raw reply related

* [PATCH 2/5] KVM test: Moving enospc test setup to test code
From: Lucas Meneghel Rodrigues @ 2011-04-10 17:10 UTC (permalink / raw)
  To: autotest; +Cc: kvm
In-Reply-To: <1302455423-32116-1-git-send-email-lmr@redhat.com>

Michael Goldish has pointed out that some of the test
setup code contained inside test_setup could be easily
moved to the tests themselves, so we avoid some 'hardcoding'
present on kvm_preprocessing.

So let's start by moving enospc test setup to the test
code itself. The only caveat here is that we need to specify
start_vm = no so test setup can happen before the vm is
started.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/kvm_preprocessing.py  |    8 ---
 client/tests/kvm/test_setup.py         |   93 -----------------------------
 client/tests/kvm/tests/enospc.py       |  101 +++++++++++++++++++++++++++++++-
 client/tests/kvm/tests_base.cfg.sample |    1 +
 4 files changed, 99 insertions(+), 104 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index dbe5d19..71e468d 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -261,10 +261,6 @@ def preprocess(test, params, env):
         u = test_setup.UnattendedInstallConfig(test, params)
         u.setup()
 
-    if params.get("type") == "enospc":
-        e = test_setup.EnospcConfig(test, params)
-        e.setup()
-
     # Execute any pre_commands
     if params.get("pre_command"):
         process_command(test, params, env, params.get("pre_command"),
@@ -365,10 +361,6 @@ def postprocess(test, params, env):
         h = test_setup.HugePageConfig(params)
         h.cleanup()
 
-    if params.get("type") == "enospc":
-        e = test_setup.EnospcConfig(test, params)
-        e.cleanup()
-
     # Execute any post_commands
     if params.get("post_command"):
         process_command(test, params, env, params.get("post_command"),
diff --git a/client/tests/kvm/test_setup.py b/client/tests/kvm/test_setup.py
index b4363e5..b93a941 100644
--- a/client/tests/kvm/test_setup.py
+++ b/client/tests/kvm/test_setup.py
@@ -593,96 +593,3 @@ class HugePageConfig(object):
             return
         utils.system("echo 0 > %s" % self.kernel_hp_file)
         logging.debug("Hugepage memory successfuly dealocated")
-
-
-class EnospcConfig(object):
-    """
-    Performs setup for the test enospc. This is a borg class, similar to a
-    singleton. The idea is to keep state in memory for when we call cleanup()
-    on postprocessing.
-    """
-    __shared_state = {}
-    def __init__(self, test, params):
-        self.__dict__ = self.__shared_state
-        root_dir = test.bindir
-        self.tmpdir = test.tmpdir
-        self.qemu_img_binary = params.get('qemu_img_binary')
-        if not os.path.isfile(self.qemu_img_binary):
-            self.qemu_img_binary = os.path.join(root_dir,
-                                                self.qemu_img_binary)
-        self.raw_file_path = os.path.join(self.tmpdir, 'enospc.raw')
-        # Here we're trying to choose fairly explanatory names so it's less
-        # likely that we run in conflict with other devices in the system
-        self.vgtest_name = params.get("vgtest_name")
-        self.lvtest_name = params.get("lvtest_name")
-        self.lvtest_device = "/dev/%s/%s" % (self.vgtest_name, self.lvtest_name)
-        image_dir = os.path.dirname(params.get("image_name"))
-        self.qcow_file_path = os.path.join(image_dir, 'enospc.qcow2')
-        try:
-            getattr(self, 'loopback')
-        except AttributeError:
-            self.loopback = ''
-
-
-    @error.context_aware
-    def setup(self):
-        logging.debug("Starting enospc setup")
-        error.context("performing enospc setup")
-        kvm_utils.display_attributes(self)
-        # Double check if there aren't any leftovers
-        self.cleanup()
-        try:
-            utils.run("%s create -f raw %s 10G" %
-                      (self.qemu_img_binary, self.raw_file_path))
-            # Associate a loopback device with the raw file.
-            # Subject to race conditions, that's why try here to associate
-            # it with the raw file as quickly as possible
-            l_result = utils.run("losetup -f")
-            utils.run("losetup -f %s" % self.raw_file_path)
-            self.loopback = l_result.stdout.strip()
-            # Add the loopback device configured to the list of pvs
-            # recognized by LVM
-            utils.run("pvcreate %s" % self.loopback)
-            utils.run("vgcreate %s %s" % (self.vgtest_name, self.loopback))
-            # Create an lv inside the vg with starting size of 200M
-            utils.run("lvcreate -L 200M -n %s %s" %
-                      (self.lvtest_name, self.vgtest_name))
-            # Create a 10GB qcow2 image in the logical volume
-            utils.run("%s create -f qcow2 %s 10G" %
-                      (self.qemu_img_binary, self.lvtest_device))
-            # Let's symlink the logical volume with the image name that autotest
-            # expects this device to have
-            os.symlink(self.lvtest_device, self.qcow_file_path)
-        except Exception, e:
-            self.cleanup()
-            raise
-
-    @error.context_aware
-    def cleanup(self):
-        error.context("performing enospc cleanup")
-        if os.path.isfile(self.lvtest_device):
-            utils.run("fuser -k %s" % self.lvtest_device)
-            time.sleep(2)
-        l_result = utils.run("lvdisplay")
-        # Let's remove all volumes inside the volume group created
-        if self.lvtest_name in l_result.stdout:
-            utils.run("lvremove -f %s" % self.lvtest_device)
-        # Now, removing the volume group itself
-        v_result = utils.run("vgdisplay")
-        if self.vgtest_name in v_result.stdout:
-            utils.run("vgremove -f %s" % self.vgtest_name)
-        # Now, if we can, let's remove the physical volume from lvm list
-        if self.loopback:
-            p_result = utils.run("pvdisplay")
-            if self.loopback in p_result.stdout:
-                utils.run("pvremove -f %s" % self.loopback)
-        l_result = utils.run('losetup -a')
-        if self.loopback and (self.loopback in l_result.stdout):
-            try:
-                utils.run("losetup -d %s" % self.loopback)
-            except error.CmdError:
-                logging.error("Failed to liberate loopback %s", self.loopback)
-        if os.path.islink(self.qcow_file_path):
-            os.remove(self.qcow_file_path)
-        if os.path.isfile(self.raw_file_path):
-            os.remove(self.raw_file_path)
diff --git a/client/tests/kvm/tests/enospc.py b/client/tests/kvm/tests/enospc.py
index 9917144..5b06328 100644
--- a/client/tests/kvm/tests/enospc.py
+++ b/client/tests/kvm/tests/enospc.py
@@ -1,7 +1,99 @@
-import logging, time, re
+import logging, time, re, os
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
-import kvm_vm
+import kvm_vm, kvm_utils
+
+
+class EnospcConfig(object):
+    """
+    Performs setup for the test enospc. This is a borg class, similar to a
+    singleton. The idea is to keep state in memory for when we call cleanup()
+    on postprocessing.
+    """
+    __shared_state = {}
+    def __init__(self, test, params):
+        self.__dict__ = self.__shared_state
+        root_dir = test.bindir
+        self.tmpdir = test.tmpdir
+        self.qemu_img_binary = params.get('qemu_img_binary')
+        if not os.path.isfile(self.qemu_img_binary):
+            self.qemu_img_binary = os.path.join(root_dir,
+                                                self.qemu_img_binary)
+        self.raw_file_path = os.path.join(self.tmpdir, 'enospc.raw')
+        # Here we're trying to choose fairly explanatory names so it's less
+        # likely that we run in conflict with other devices in the system
+        self.vgtest_name = params.get("vgtest_name")
+        self.lvtest_name = params.get("lvtest_name")
+        self.lvtest_device = "/dev/%s/%s" % (self.vgtest_name, self.lvtest_name)
+        image_dir = os.path.dirname(params.get("image_name"))
+        self.qcow_file_path = os.path.join(image_dir, 'enospc.qcow2')
+        try:
+            getattr(self, 'loopback')
+        except AttributeError:
+            self.loopback = ''
+
+    @error.context_aware
+    def setup(self):
+        logging.debug("Starting enospc setup")
+        error.context("performing enospc setup")
+        kvm_utils.display_attributes(self)
+        # Double check if there aren't any leftovers
+        self.cleanup()
+        try:
+            utils.run("%s create -f raw %s 10G" %
+                      (self.qemu_img_binary, self.raw_file_path))
+            # Associate a loopback device with the raw file.
+            # Subject to race conditions, that's why try here to associate
+            # it with the raw file as quickly as possible
+            l_result = utils.run("losetup -f")
+            utils.run("losetup -f %s" % self.raw_file_path)
+            self.loopback = l_result.stdout.strip()
+            # Add the loopback device configured to the list of pvs
+            # recognized by LVM
+            utils.run("pvcreate %s" % self.loopback)
+            utils.run("vgcreate %s %s" % (self.vgtest_name, self.loopback))
+            # Create an lv inside the vg with starting size of 200M
+            utils.run("lvcreate -L 200M -n %s %s" %
+                      (self.lvtest_name, self.vgtest_name))
+            # Create a 10GB qcow2 image in the logical volume
+            utils.run("%s create -f qcow2 %s 10G" %
+                      (self.qemu_img_binary, self.lvtest_device))
+            # Let's symlink the logical volume with the image name that autotest
+            # expects this device to have
+            os.symlink(self.lvtest_device, self.qcow_file_path)
+        except Exception, e:
+            self.cleanup()
+            raise
+
+    @error.context_aware
+    def cleanup(self):
+        error.context("performing enospc cleanup")
+        if os.path.isfile(self.lvtest_device):
+            utils.run("fuser -k %s" % self.lvtest_device)
+            time.sleep(2)
+        l_result = utils.run("lvdisplay")
+        # Let's remove all volumes inside the volume group created
+        if self.lvtest_name in l_result.stdout:
+            utils.run("lvremove -f %s" % self.lvtest_device)
+        # Now, removing the volume group itself
+        v_result = utils.run("vgdisplay")
+        if self.vgtest_name in v_result.stdout:
+            utils.run("vgremove -f %s" % self.vgtest_name)
+        # Now, if we can, let's remove the physical volume from lvm list
+        if self.loopback:
+            p_result = utils.run("pvdisplay")
+            if self.loopback in p_result.stdout:
+                utils.run("pvremove -f %s" % self.loopback)
+        l_result = utils.run('losetup -a')
+        if self.loopback and (self.loopback in l_result.stdout):
+            try:
+                utils.run("losetup -d %s" % self.loopback)
+            except error.CmdError:
+                logging.error("Failed to liberate loopback %s", self.loopback)
+        if os.path.islink(self.qcow_file_path):
+            os.remove(self.qcow_file_path)
+        if os.path.isfile(self.raw_file_path):
+            os.remove(self.raw_file_path)
 
 
 def run_enospc(test, params, env):
@@ -19,8 +111,10 @@ def run_enospc(test, params, env):
     @param params: Dictionary with the test parameters.
     @param env: Dictionary with test environment.
     """
+    enospc_config = EnospcConfig(test, params)
+    enospc_config.setup()
     vm = env.get_vm(params["main_vm"])
-    vm.verify_alive()
+    vm.create()
     login_timeout = int(params.get("login_timeout", 360))
     session_serial = vm.wait_for_serial_login(timeout=login_timeout)
 
@@ -72,3 +166,4 @@ def run_enospc(test, params, env):
                      pause_n, iterations)
 
     logging.info("Final %s", vm.monitor.cmd("info status"))
+    enospc_config.cleanup()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index da25361..e25b18c 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -610,6 +610,7 @@ variants:
 
     - enospc:
         type = enospc
+        start_vm = no
         images += " stg"
         drive_werror = stop
         drive_cache = none
-- 
1.7.4.2

^ permalink raw reply related

* GET BACK TO ME IMMEDIATELY
From: GET BACK TO ME IMMEDIATELY @ 2011-04-10 17:09 UTC (permalink / raw)


Hello 

I wish to ask for your consent for a partnership project that I would want both of us to execute mutually which is beneficial. However my name is Mr. Rodney Smith. Kindly get back to me to confirm the receipt of this massage so that I will give you full details of the project.

Send your reply to my private email at rodney_smith@ibibo.com 

I am waiting for your permission.

Warm regards
Mr. Rodney Smith
Email:smithrodney@ibibo.com

^ permalink raw reply

* [PATCH] ARM: Kconfig.debug: Remove unused CONFIG_DEBUG_ERRORS
From: Jesper Juhl @ 2011-04-10 17:06 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1302300518-7523-1-git-send-email-sboyd@codeaurora.org>

On Fri, 8 Apr 2011, Stephen Boyd wrote:

> This config option isn't actually used anywhere and can be safely
> removed. The last user was traps.c before commit 082f47a ([ARM]
> always allow dump_stack() to produce a backtrace, 2007-07-05).
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Ok, this patch looks sane, so feel free to add :
  Reviewed-by: Jesper Juhl <jj@chaosbits.net>

But, I see a lot of *_defconfig files in my copy of the tree that 
reference the option :

./arch/arm/configs/realview_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp2000_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/netx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/em_x270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/tct_hammer_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/integrator_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s3c6400_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5p6442_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/jornada720_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/imote2_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mmp2_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/hackkit_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/lpd270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/u8500_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5pc100_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/cerfcube_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/cm_x2xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/exynos4_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/simpad_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/colibri_pxa270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/kirkwood_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/realview-smp_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/magician_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mv78xx0_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5pv210_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ns9xxx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/corgi_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp4xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/vexpress_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa168_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/orion5x_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa910_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/omap1_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/spitz_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/viper_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa255-idp_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/colibri_pxa300_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/neponset_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/lubbock_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/collie_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/dove_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/rpc_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mainstone_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/badge4_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/raumfeld_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5p64x0_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp23xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/versatile_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ezx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/davinci_all_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/da8xx_omapl_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/zeus_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s3c2410_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/am200epdkit_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ep93xx_defconfig:CONFIG_DEBUG_ERRORS=y

shouldn't those lines be removed as well?

I can submit a patch, but I thought you'd rather do it yourself..

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply

* Re: [PATCH] ARM: Kconfig.debug: Remove unused CONFIG_DEBUG_ERRORS
From: Jesper Juhl @ 2011-04-10 17:06 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Russell King, linux-kernel, linux-arm-kernel
In-Reply-To: <1302300518-7523-1-git-send-email-sboyd@codeaurora.org>

On Fri, 8 Apr 2011, Stephen Boyd wrote:

> This config option isn't actually used anywhere and can be safely
> removed. The last user was traps.c before commit 082f47a ([ARM]
> always allow dump_stack() to produce a backtrace, 2007-07-05).
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Ok, this patch looks sane, so feel free to add :
  Reviewed-by: Jesper Juhl <jj@chaosbits.net>

But, I see a lot of *_defconfig files in my copy of the tree that 
reference the option :

./arch/arm/configs/realview_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp2000_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/netx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/em_x270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/tct_hammer_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/integrator_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s3c6400_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5p6442_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/jornada720_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/imote2_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mmp2_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/hackkit_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/lpd270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/u8500_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5pc100_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/cerfcube_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/cm_x2xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/exynos4_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/simpad_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/colibri_pxa270_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/kirkwood_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/realview-smp_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/magician_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mv78xx0_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5pv210_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ns9xxx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/corgi_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp4xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/vexpress_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa168_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/orion5x_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa910_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/omap1_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/spitz_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/viper_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/pxa255-idp_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/colibri_pxa300_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/neponset_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/lubbock_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/collie_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/dove_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/rpc_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/mainstone_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/badge4_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/raumfeld_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s5p64x0_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ixp23xx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/versatile_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ezx_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/davinci_all_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/da8xx_omapl_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/zeus_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/s3c2410_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/am200epdkit_defconfig:CONFIG_DEBUG_ERRORS=y
./arch/arm/configs/ep93xx_defconfig:CONFIG_DEBUG_ERRORS=y

shouldn't those lines be removed as well?

I can submit a patch, but I thought you'd rather do it yourself..

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply

* [ath9k-devel] GOOD for OpenWrt: only 2 tx failed per day
From: Larry Vaden @ 2011-04-10 17:03 UTC (permalink / raw)
  To: ath9k-devel

THANKS, Felix et al.

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.