lxc-stop ignores invalid container names
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
ProcVersionSign
Uname: Linux 3.8.0-19-generic i686
NonfreeKernelMo
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_
LANG=fr_FR.UTF-8
SHELL=/bin/bash
SourcePackage: lxc
UpgradeStatus: Upgraded to raring on 2012-12-20 (123 days ago)
Thanks for reporting this bug. Unfortunately it's more complicated FREEZING| FROZEN) states.
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|
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