lxc-stop ignores invalid container names

Bug #1171866 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

$ sudo lxc-ls -1
oneiric
precise
raring
raring-cloned
sid
$ sudo lxc-stop -n foo
$ echo $?
0

lxc-stop should return 1 in the example above and display an error rather than silently failing and returning 0 to denote success.

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: lxc 0.9.0-0ubuntu3
ProcVersionSignature: Ubuntu 3.8.0-19.29-generic 3.8.8
Uname: Linux 3.8.0-19-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.9.2-0ubuntu8
Architecture: i386
Date: Tue Apr 23 14:57:33 2013
InstallationDate: Installed on 2010-10-21 (915 days ago)
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
SourcePackage: lxc
UpgradeStatus: Upgraded to raring on 2012-12-20 (123 days ago)

Revision history for this message
James Hunt (jamesodhunt) wrote :
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1171866] [NEW] lxc-stop ignores invalid container names

Thanks for reporting this bug. Unfortunately it's more complicated
than this and I'm not sure waht you want is possible. It would be
if everything were simple system containers, however you can also
lxc-start and lxc-execute things with / as rootfs and custom
config files - meaning there is no real way to say "the container does
not exist". At the same time, we don't want lxc-stop of a stopped
container to fail. Put another way, 'STOPPED' simply means "none of
the other (RUNNING|FREEZING|FROZEN) states.

So I'm not sure there is a good way to define the condition under
which we should return failure.

I'm marking this invalid (as by the definition above this isn't really a
bug), but we can certainly keep discussing this to figure out if there
is a solution.

Oh, one thing we could do is write a lxc-p-stop or something to indicate
'permanent' or 'system' container, using the API which woudl simply do

 c = lxc_container_new(lxc_name, lxc_path);
 if (c && !c->is_defined(c)) {
  fprintf(stderr, "container %s does not exist\n",
  lxc_name);
  return -1;
 }

But for lxc-stop I think that behavior would be wrong.

 status: invalid

Changed in lxc (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.