Hi, Good catch!
Please let me know if the patch below solves the issue for you,
and if so I'll make a new release.
Steve
--
Index: bin/xen-shell
===================================================================
RCS file: /home/cvs/xen-shell/bin/xen-shell,v
retrieving revision 1.98
diff --unified -r1.98 xen-shell
--- bin/xen-shell 17 Aug 2007 12:39:35 -0000 1.98
+++ bin/xen-shell 4 Sep 2007 10:59:16 -0000
@@ -950,9 +950,16 @@
sub removeCommands
{
#
- # Bandwidth
+ # Bandwidth: Remove this command unless there is at least one
+ # instance which is setup correctly.
#
- if ( ! -e "/var/lib/vnstat/$USER" )
+ my $has_vnstat = 0;
+ foreach my $name ( @INSTANCES )
+ {
+ $has_vnstat = 1 if ( -e "/var/lib/vnstat/$name" );
+ }
+
+ if ( ! $has_vnstat )
{
$dispatch{ 'bandwidth' } = undef;
delete( $dispatch{ 'bandwidth' } );
@@ -1307,9 +1314,17 @@
return if ( ! isControlling() );
#
- # Now show the output
+ # A user might have N instances, of which only one might
+ # have vnstat setup. Make sure this instance is setup.
#
- system( "vnstat -i $ACTIVE $arg\n" );
+ if ( -e "/var/lib/vnstat/$ACTIVE" )
+ {
+ system( "vnstat -i $ACTIVE $arg\n" );
+ }
+ else
+ {
+ print "Guest '$ACTIVE' is not configured for bandwidth display.\n";
+ }
}
pgprLxcUOhWjF.pgp
Description: PGP signature

