Merge lp:~thumper/juju-core/auto-restart-containers into lp:~go-bot/juju-core/trunk
Proposed by
Tim Penhey
Status: | Merged |
---|---|
Approved by: | Tim Penhey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1487 |
Proposed branch: | lp:~thumper/juju-core/auto-restart-containers |
Merge into: | lp:~go-bot/juju-core/trunk |
Prerequisite: | lp:~thumper/juju-core/test-import-fix |
Diff against target: |
134 lines (+43/-0) 3 files modified
container/lxc/lxc.go (+17/-0) container/lxc/lxc_test.go (+14/-0) container/lxc/test.go (+12/-0) |
To merge this branch: | bzr merge lp:~thumper/juju-core/auto-restart-containers |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+175435@code.launchpad.net |
Commit message
Add the autostart symlink for containers.
In order for containers to autostart, there needs to be
a symlink in /etc/lxc/auto called CN.conf where CN is
the container name, which points to the config file for
the container, which is by default /var/lib/
Description of the change
Add the autostart symlink for containers.
In order for containers to autostart, there needs to be
a symlink in /etc/lxc/auto called CN.conf where CN is
the container name, which points to the config file for
the container, which is by default /var/lib/
To post a comment you must log in.
Reviewers: mp+175435_ code.launchpad. net,
Message:
Please take a look.
Description:
Add the autostart symlink for containers.
In order for containers to autostart, there needs to be lxc/CN/ config.
a symlink in /etc/lxc/auto called CN.conf where CN is
the container name, which points to the config file for
the container, which is by default /var/lib/
https:/ /code.launchpad .net/~thumper/ juju-core/ auto-restart- containers/ +merge/ 175435
Requires: /code.launchpad .net/~thumper/ juju-core/ test-import- fix/+merge/ 175430
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/11491043/
Affected files: lxc/lxc. go lxc/lxc_ test.go lxc/test. go
A [revision details]
M container/
M container/
M container/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: container/ lxc/lxc. go lxc/lxc. go' lxc/lxc. go 2013-07-15 01:16:52 +0000 lxc/lxc. go 2013-07-17 23:38:15 +0000 juju/containers " inerDir = "/var/lib/ juju/removed- containers"
=== modified file 'container/
--- container/
+++ container/
@@ -28,6 +28,7 @@
containerDir = "/var/lib/
removedConta
lxcContainerDir = "/var/lib/lxc"
+ lxcRestartDir = "/etc/lxc/auto"
lxcObjectFactory = golxc.Factory()
)
@@ -125,6 +126,13 @@ Tracef( "lxc container created") Join(lxcContain erDir, name, "config") Join(lxcRestart Dir, name+".conf") containerConfig File, linkLocation); err != nil { Tracef( "auto-restart link created")
return nil, err
}
logger.
+ // Now symlink the config file into the restart directory.
+ containerConfigFile := filepath.
+ linkLocation := filepath.
+ if err := os.Symlink(
+ return nil, err
+ }
+ logger.
// Start the lxc container with the appropriate settings for grabbing the Errorf( "failed to destroy lxc container: %v", err) Join(lxcRestart Dir, name+".conf") linkLocation) ; err != nil { Tracef( "auto-restart link removed") Tracef( "create old container dir: %s", removedContaine rDir) removedContaine rDir, 0755); err != nil {
// console output and a log file.
@@ -154,6 +162,13 @@
logger.
return err
}
+ // Remove the autostart symlink
+ linkLocation := filepath.
+ if err := os.Remove(
+ return err
+ }
+ logger.
+
// Move the directory.
logger.
if err := os.MkdirAll(
Index: container/ lxc/lxc_ test.go lxc/lxc_ test.go' lxc/lxc_ test.go 2013-07-17 22:41:36 +0000 lxc/lxc_ test.go 2013-07-17 23:38:15 +0000
=== modified file 'container/
--- container/
+++ container/
@@ -12,6 +12,7 @@
gc "launchpad. net/gocheck" net/goyaml" net/loggo"
"launchpad.
+ "launchpad.
"launchpad. net/juju- core/container/ lxc" net/juju- core/instance" te.SetUpTest( c) SetUpTest( c) ("juju. container. lxc").SetLogLev el(loggo. TRACE)
"launchpad.
@@ -46,6 +47,7 @@
func (s *LxcSuite) SetUpTest(c *gc.C) {
s.LoggingSui
s.TestSuite.
+ loggo.GetLogger
}
func (s *LxcSuite) TearDownTest(c *gc.C) {
@@ -96,6 +98,16 @@
// Check the mount point has been created i...