Merge lp://staging/~thumper/golxc/nicer-destroy into lp://staging/golxc

Proposed by Tim Penhey
Status: Merged
Merged at revision: 7
Proposed branch: lp://staging/~thumper/golxc/nicer-destroy
Merge into: lp://staging/golxc
Diff against target: 34 lines (+8/-1)
2 files modified
golxc.go (+5/-1)
golxc_test.go (+3/-0)
To merge this branch: bzr merge lp://staging/~thumper/golxc/nicer-destroy
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+188254@code.staging.launchpad.net

Commit message

Don't stop a stopped container.

Newer versions of lxc > 0.9 error on lxc-stop if the
container is stopped.

The LXCSuite.TestStopNotRunning was failing (but it has
to be run as root, so awkward to test).

Description of the change

Don't stop a stopped container.

Newer versions of lxc > 0.9 error on lxc-stop if the
container is stopped.

The LXCSuite.TestStopNotRunning was failing (but it has
to be run as root, so awkward to test).

This change fixes it, with a small drive by. The start
command now waits for Started or Stopped. When the
lxc-start command is executed, the container goes into
the starting state, and from there it moves to running if
all is good, or stopped if there was an error starting it.
If we don't wait for stopped as well, golxc waits forever.

We do need a better solution here for tests. The output
and behaviour of lxc has changed over the versions, so we
should have a version check for the tests. I'll file a
tech-debt bug around this.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Please take a look.

Revision history for this message
John A Meinel (jameinel) wrote :

I'd like to see a test for the:
  return c.Wait(StateRunning, StateStopped)

So that we can make it clear why we need it (a machine that cannot start will transition from starting => stopped, and never show up as "started").

However, I can understand where the overhead of writing a test vs the actual patch doesn't balance well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: