Merge lp://staging/~waigani/juju-core/lxc-trusty-autostart into lp://staging/~go-bot/juju-core/trunk
Proposed by
Jesse Meek
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Jesse Meek | ||||||||||||
Approved revision: | no longer in the source branch. | ||||||||||||
Merged at revision: | 2262 | ||||||||||||
Proposed branch: | lp://staging/~waigani/juju-core/lxc-trusty-autostart | ||||||||||||
Merge into: | lp://staging/~go-bot/juju-core/trunk | ||||||||||||
Diff against target: |
126 lines (+68/-12) 3 files modified
container/lxc/lxc.go (+16/-6) container/lxc/lxc_test.go (+36/-6) container/lxc/restart.go (+16/-0) |
||||||||||||
To merge this branch: | bzr merge lp://staging/~waigani/juju-core/lxc-trusty-autostart | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+202974@code.staging.launchpad.net |
Commit message
Auto start for lxc containers
Auto start for lxc containers should now work on Trusty. Symlink is created if /etc/lxc/auto exists, otherwise auto start is set to true in lxc config.
Description of the change
Auto start for lxc containers
Auto start for lxc containers should now work on Trusty. Symlink is created if /etc/lxc/auto exists, otherwise auto start is set to true in lxc config.
To post a comment you must log in.
Reviewers: mp+202974_ code.launchpad. net,
Message:
Please take a look.
Description:
Auto start for lxc containers
Auto start for lxc containers should now work on Trusty. Symlink is
created if /etc/lxc/auto exists, otherwise auto start is set to true in
lxc config.
https:/ /code.launchpad .net/~waigani/ juju-core/ lxc-trusty- autostart/ +merge/ 202974
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/56370043/
Affected files (+48, -6 lines): lxc/lxc. go lxc/lxc_ test.go lxc/restart. go
A [revision details]
M container/
M container/
A container/
Index: [revision details] 20140124005805- 5wkfrpv3q7zaknx v
=== 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: tarmac-
+New revision: <email address hidden>
Index: container/ lxc/lxc. go lxc/lxc. go' lxc/lxc. go 2013-12-04 02:37:05 +0000 lxc/lxc. go 2014-01-24 01:19:25 +0000 Tracef( "lxc container created") Join(LxcContain erDir, name, "config") containerConfig File, restartSymlink( name)); err != Join(LxcContain erDir, name, "config") containerConfig File, restartSymlink( name)); err != Tracef( "auto-restart link created") Tracef( "auto-restart link created")
=== modified file 'container/
--- container/
+++ container/
@@ -109,12 +109,14 @@
return nil, nil, err
}
logger.
- // Now symlink the config file into the restart directory.
- containerConfigFile := filepath.
- if err := os.Symlink(
nil {
- return nil, nil, err
+ // Now symlink the config file into the restart directory, if it exists
+ if restartDirExists() {
+ containerConfigFile := filepath.
+ if err := os.Symlink(
nil {
+ return nil, nil, err
+ }
+ logger.
}
- logger.
// Start the lxc container with the appropriate settings for grabbing the
// console output and a log file.
@@ -198,7 +200,12 @@
`
func networkConfigTe mplate( networkType, networkLink string) string { networkTemplate , networkType, networkLink) networkTemplate , networkType, networkLink) Tracef( "Setting auto start to true in lxc config.")
- return fmt.Sprintf(
+ networkConfig := fmt.Sprintf(
+ if !restartDirExists() {
+ networkConfig += "lxc.start.auto = 1\n"
+ logger.
+ }
+ return networkConfig
}
func generateNetwork Config( network *container. NetworkConfig) string {
Index: container/ lxc/lxc_ test.go lxc/lxc_ test.go' lxc/lxc_ test.go 2013-12-16 07:20:01 +0000 lxc/lxc_ test.go 2014-01-24 01:19:25 +0000 autostartLink, jc.IsSymlink)
=== modified file 'container/
--- container/
+++ container/
@@ -186,6 +186,25 @@
c.Assert(
}
+func (s *LxcSuite) TestStartContai nerNoRestartDir (c *gc.C) { s.RestartDir) rManager( container. ManagerConfig{ }) g.StartContaine r(c, manager, "1/lxc/0") ink(string( instance. Id())) igTemplate( "foo", "bar") autostartLink, jc.Does...
+ err := os.Remove(
+ c.Assert(err, gc.IsNil)
+
+ manager := lxc.NewContaine
+ instance := containertestin
+ autostartLink := lxc.RestartSyml
+
+ config := lxc.NetworkConf
+ expected := `
+lxc.network.type = foo
+lxc.network.link = bar
+lxc.network.flags = up
+lxc.start.auto = 1
+`
+ c.Assert(config, gc.Equals, expected)
+ c.Assert(