Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] runqemu multiple unfs instances fix
@ 2012-10-03 22:13 Scott Garman
  2012-10-03 22:13 ` [PATCH 1/3] runqemu-export-rootfs: use consistent whitespace Scott Garman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Scott Garman @ 2012-10-03 22:13 UTC (permalink / raw)
  To: openembedded-core

Hello,

Here's a bugfix to allow multiple instances of unfs-based qemu to
run. A bit thank you to Rudolf J Streif for proposing the final
commit in this series.

Scott

The following changes since commit ae9dbd0e1e26ba2b35cbd08ec731aee62adedc23:

  distrodata: Update distrocheck functions (2012-10-03 17:37:24 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib sgarman/runqemu-unfs-fix-oe
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-unfs-fix-oe

Scott Garman (3):
  runqemu-export-rootfs: use consistent whitespace
  runqemu-export-rootfs: improve rpcbind error detection
  runqemu: allow multiple unfs instances to run simultaneously

 scripts/runqemu-export-rootfs |  113 +++++++++++++++++++++++------------------
 scripts/runqemu-internal      |    4 +-
 2 files changed, 66 insertions(+), 51 deletions(-)

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] runqemu-export-rootfs: use consistent whitespace
  2012-10-03 22:13 [PATCH 0/3] runqemu multiple unfs instances fix Scott Garman
@ 2012-10-03 22:13 ` Scott Garman
  2012-10-03 22:13 ` [PATCH 2/3] runqemu-export-rootfs: improve rpcbind error detection Scott Garman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Scott Garman @ 2012-10-03 22:13 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/runqemu-export-rootfs |   94 ++++++++++++++++++++---------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index 3c77dd7..ca79af3 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -40,9 +40,9 @@ NFS_EXPORT_DIR=$(cd "$2" && pwd)
 
 SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
 if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
-    echo "Error: Unable to find the oe-find-native-sysroot script"
-    echo "Did you forget to source your build environment setup script?"
-    exit 1
+	echo "Error: Unable to find the oe-find-native-sysroot script"
+	echo "Did you forget to source your build environment setup script?"
+	exit 1
 fi
 . $SYSROOT_SETUP_SCRIPT
 
@@ -50,9 +50,9 @@ if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then
 	echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/"
 
 	if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
-	    echo "Have you run 'bitbake meta-ide-support'?"
+		echo "Have you run 'bitbake meta-ide-support'?"
 	else
-	    echo "This shouldn't happen - something is missing from your toolchain installation"
+		echo "This shouldn't happen - something is missing from your toolchain installation"
 	fi
 	exit 1
 fi
@@ -104,53 +104,53 @@ case "$1" in
 	echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
 	$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
 	if [ ! $? = 0 ]; then
-	    echo "====================="
-	    echo "Error starting MOUNTD"
-	    echo "====================="
-	    ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
-	    if [ $? = 0 ] ; then
-		echo "  If you see an error above that says:"
-		echo "    RPC: Authentication error; why = Client credential too weak"
-		echo "  You need to change the startup of rpcbind"
-		echo "  on your host by doing the following as root:"
-		echo "==============================================="
-		echo "  According to /etc/sysconfig/rpcbind, then "
-		echo "    echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
-		echo "  or"
-		echo "    echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
-		echo "    /etc/init.d/rpcbind restart"
-		echo "==============================================="
-		echo "For Ubuntu 11.10 hosts"
-		echo "Add OPTIONS=\"-i -w\"  to /etc/default/rpcbind"
-		echo "sudo service portmap restart"
-	    fi
-	    exit 1
+		echo "====================="
+		echo "Error starting MOUNTD"
+		echo "====================="
+		ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
+		if [ $? = 0 ] ; then
+			echo "  If you see an error above that says:"
+			echo "    RPC: Authentication error; why = Client credential too weak"
+			echo "  You need to change the startup of rpcbind"
+			echo "  on your host by doing the following as root:"
+			echo "==============================================="
+			echo "  According to /etc/sysconfig/rpcbind, then "
+			echo "    echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
+			echo "  or"
+			echo "    echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
+			echo "    /etc/init.d/rpcbind restart"
+			echo "==============================================="
+			echo "For Ubuntu 11.10 hosts"
+			echo "Add OPTIONS=\"-i -w\"  to /etc/default/rpcbind"
+			echo "sudo service portmap restart"
+		fi
+		exit 1
 	fi
 	echo "Starting User Mode nfsd"
 	echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
 	$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
 	if [ ! $? = 0 ]; then
-	    echo "Error starting nfsd"
-	    exit 1
+		echo "Error starting nfsd"
+		exit 1
 	fi
 	# Check to make sure everything started ok.
 	if [ ! -f $MOUNTPID ]; then
-	    echo "rpc.mountd did not start correctly"
-	    exit 1
+		echo "rpc.mountd did not start correctly"
+		exit 1
 	fi
 	if [ ! -f $NFSPID ]; then
-	    echo "rpc.nfsd did not start correctly"
-	    exit 1
+		echo "rpc.nfsd did not start correctly"
+		exit 1
 	fi
 	ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null
 	if [ ! $? = 0 ]; then
-	    echo "rpc.mountd did not start correctly"
-	    exit 1
+		echo "rpc.mountd did not start correctly"
+		exit 1
 	fi
 	ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
 	if [ ! $? = 0 ]; then
-	    echo "rpc.nfsd did not start correctly"
-	    exit 1
+		echo "rpc.nfsd did not start correctly"
+		exit 1
 	fi
 	echo " "
 	echo "On your target please remember to add the following options for NFS"
@@ -158,29 +158,29 @@ case "$1" in
 	;;
   stop)
 	if [ -f "$MOUNTPID" ]; then
-	    echo "Stopping rpc.mountd"
-	    kill `cat $MOUNTPID`
-	    rm -f $MOUNTPID
+		echo "Stopping rpc.mountd"
+		kill `cat $MOUNTPID`
+		rm -f $MOUNTPID
 	else
-	    echo "No PID file, not stopping rpc.mountd"
+		echo "No PID file, not stopping rpc.mountd"
 	fi
 	if [ -f "$NFSPID" ]; then
-	    echo "Stopping rpc.nfsd"
-	    kill `cat $NFSPID`
-	    rm -f $NFSPID
+		echo "Stopping rpc.nfsd"
+		kill `cat $NFSPID`
+		rm -f $NFSPID
 	else
-	    echo "No PID file, not stopping rpc.nfsd"
+		echo "No PID file, not stopping rpc.nfsd"
 	fi
 	if [ -f "$EXPORTS" ]; then
-        echo "Removing exports file"
-        rm -f $EXPORTS
+		echo "Removing exports file"
+		rm -f $EXPORTS
 	fi
 	;;
   restart)
 	$0 stop $NFS_EXPORT_DIR
 	$0 start $NFS_EXPORT_DIR 
 	if [ ! $? = 0 ]; then
-	    exit 1
+		exit 1
 	fi
 	;;
   *)
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] runqemu-export-rootfs: improve rpcbind error detection
  2012-10-03 22:13 [PATCH 0/3] runqemu multiple unfs instances fix Scott Garman
  2012-10-03 22:13 ` [PATCH 1/3] runqemu-export-rootfs: use consistent whitespace Scott Garman
@ 2012-10-03 22:13 ` Scott Garman
  2012-10-03 22:13 ` [PATCH 3/3] runqemu: allow multiple unfs instances to run simultaneously Scott Garman
  2012-10-05 16:03 ` [PATCH 0/3] runqemu multiple unfs instances fix Saul Wold
  3 siblings, 0 replies; 5+ messages in thread
From: Scott Garman @ 2012-10-03 22:13 UTC (permalink / raw)
  To: openembedded-core

mountd requires rpcbind or portmap. Check that one of these
services is running before doing anything else, and report
a user-friendly error when they are not found.

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/runqemu-export-rootfs |   33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index ca79af3..90edc8a 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -100,6 +100,21 @@ fi
 # See how we were called.
 case "$1" in
   start)
+	PORTMAP_RUNNING=`ps -ef | grep portmap | grep -v grep`
+	RPCBIND_RUNNING=`ps -ef | grep rpcbind | grep -v grep`
+	if [[ "x$PORTMAP_RUNNING" = "x" && "x$RPCBIND_RUNNING" = "x" ]]; then
+		echo "======================================================="
+		echo "Error: neither rpcbind nor portmap appear to be running"
+		echo "Please install and start one of these services first"
+		echo "======================================================="
+		echo "Tip: for recent Ubuntu hosts, run:"
+		echo "  sudo apt-get install rpcbind"
+		echo "Then add OPTIONS=\"-i -w\"  to /etc/default/rpcbind and run"
+		echo "  sudo service portmap restart"
+
+		exit 1
+	fi
+
 	echo "Starting User Mode rpc.mountd"
 	echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
 	$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
@@ -107,25 +122,25 @@ case "$1" in
 		echo "====================="
 		echo "Error starting MOUNTD"
 		echo "====================="
-		ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
-		if [ $? = 0 ] ; then
+		if [ ! "x$RPCBIND_RUNNING" = "x" ] ; then
 			echo "  If you see an error above that says:"
 			echo "    RPC: Authentication error; why = Client credential too weak"
-			echo "  You need to change the startup of rpcbind"
-			echo "  on your host by doing the following as root:"
+			echo "  You need to add the -i option when running rpcbind"
 			echo "==============================================="
-			echo "  According to /etc/sysconfig/rpcbind, then "
-			echo "    echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
+			echo "For recent Fedora/RedHat hosts:"
+			echo "Add RPCBIND_ARGS=-i to /etc/sysconfig/rpcbind"
 			echo "  or"
-			echo "    echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
-			echo "    /etc/init.d/rpcbind restart"
+			echo "Add RPCBIND_OPTIONS=-i to /etc/sysconfig/rpcbind"
+			echo "Then run as root: /etc/init.d/rpcbind restart"
 			echo "==============================================="
-			echo "For Ubuntu 11.10 hosts"
+			echo "For recent Debian/Ubuntu hosts:"
 			echo "Add OPTIONS=\"-i -w\"  to /etc/default/rpcbind"
 			echo "sudo service portmap restart"
 		fi
+
 		exit 1
 	fi
+
 	echo "Starting User Mode nfsd"
 	echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
 	$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] runqemu: allow multiple unfs instances to run simultaneously
  2012-10-03 22:13 [PATCH 0/3] runqemu multiple unfs instances fix Scott Garman
  2012-10-03 22:13 ` [PATCH 1/3] runqemu-export-rootfs: use consistent whitespace Scott Garman
  2012-10-03 22:13 ` [PATCH 2/3] runqemu-export-rootfs: improve rpcbind error detection Scott Garman
@ 2012-10-03 22:13 ` Scott Garman
  2012-10-05 16:03 ` [PATCH 0/3] runqemu multiple unfs instances fix Saul Wold
  3 siblings, 0 replies; 5+ messages in thread
From: Scott Garman @ 2012-10-03 22:13 UTC (permalink / raw)
  To: openembedded-core

A miscalculation in the way the port numbers of mountd and nfsd
are created was causing conflicts when starting multiple instances
of qemu using userspace nfs.

Thanks to Rudolf Streif for proposing this fix!

Fixes [YOCTO #1969]

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/runqemu-export-rootfs |    4 ++--
 scripts/runqemu-internal      |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index 90edc8a..bbdaf5b 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -82,9 +82,9 @@ NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ]
 # rpc.nfsd RPC port
 NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ]
 # NFS port number
-NFS_PORT=$[ 3049 + $NFS_INSTANCE ]
+NFS_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
 # mountd port number
-MOUNT_PORT=$[ 3048 + $NFS_INSTANCE ]
+MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
 
 ## For debugging you would additionally add
 ## --debug all
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 0f07bad..7ca00f8 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -277,8 +277,8 @@ if [ "$FSTYPE" = "nfs" ]; then
     NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'`
     MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ]
     NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ]
-    NFSD_PORT=$[ 3049 + $NFS_INSTANCE ]
-    MOUNTD_PORT=$[ 3048 + $NFS_INSTANCE ]
+    NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
+    MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
     UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT"
 
     PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] runqemu multiple unfs instances fix
  2012-10-03 22:13 [PATCH 0/3] runqemu multiple unfs instances fix Scott Garman
                   ` (2 preceding siblings ...)
  2012-10-03 22:13 ` [PATCH 3/3] runqemu: allow multiple unfs instances to run simultaneously Scott Garman
@ 2012-10-05 16:03 ` Saul Wold
  3 siblings, 0 replies; 5+ messages in thread
From: Saul Wold @ 2012-10-05 16:03 UTC (permalink / raw)
  To: Scott Garman; +Cc: openembedded-core

On 10/03/2012 03:13 PM, Scott Garman wrote:
> Hello,
>
> Here's a bugfix to allow multiple instances of unfs-based qemu to
> run. A bit thank you to Rudolf J Streif for proposing the final
> commit in this series.
>
> Scott
>
> The following changes since commit ae9dbd0e1e26ba2b35cbd08ec731aee62adedc23:
>
>    distrodata: Update distrocheck functions (2012-10-03 17:37:24 +0100)
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib sgarman/runqemu-unfs-fix-oe
>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-unfs-fix-oe
>
> Scott Garman (3):
>    runqemu-export-rootfs: use consistent whitespace
>    runqemu-export-rootfs: improve rpcbind error detection
>    runqemu: allow multiple unfs instances to run simultaneously
>
>   scripts/runqemu-export-rootfs |  113 +++++++++++++++++++++++------------------
>   scripts/runqemu-internal      |    4 +-
>   2 files changed, 66 insertions(+), 51 deletions(-)
>
Merged these into OE-Core

Thanks
	Sau!




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-05 16:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 22:13 [PATCH 0/3] runqemu multiple unfs instances fix Scott Garman
2012-10-03 22:13 ` [PATCH 1/3] runqemu-export-rootfs: use consistent whitespace Scott Garman
2012-10-03 22:13 ` [PATCH 2/3] runqemu-export-rootfs: improve rpcbind error detection Scott Garman
2012-10-03 22:13 ` [PATCH 3/3] runqemu: allow multiple unfs instances to run simultaneously Scott Garman
2012-10-05 16:03 ` [PATCH 0/3] runqemu multiple unfs instances fix Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox