Merge lp:~thumper/juju-core/autostart-containers-after-creation 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: 2405
Proposed branch: lp:~thumper/juju-core/autostart-containers-after-creation
Merge into: lp:~go-bot/juju-core/trunk
Prerequisite: lp:~thumper/juju-core/fast-lxc
Diff against target: 245 lines (+87/-45)
5 files modified
container/lxc/export_test.go (+4/-3)
container/lxc/lxc.go (+57/-30)
container/lxc/lxc_test.go (+8/-6)
container/lxc/mock/mock-lxc.go (+17/-5)
container/lxc/testing/test.go (+1/-1)
To merge this branch: bzr merge lp:~thumper/juju-core/autostart-containers-after-creation
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+210099@code.launchpad.net

Commit message

Set lxc autostart after creation.

Currently for a recent LXC version, the autostart is controlled
by a setting in the lxc config. We were setting this in the
config file that we use for creation. However this is not clone
friendly, as we do not specify a config file for clone.

However it is perfectly valid to modify the config for the container
once it has been created. This then becomes common for both
normally created containers and those that have been cloned.

A key here is that our template container that we want to use
as a base to clone off we do not want auto-starting, however
the containers that we clone off that may well want to auto-start
(in fact all will until we add the autostart policy for local).

https://codereview.appspot.com/73300043/

Description of the change

Set lxc autostart after creation.

Currently for a recent LXC version, the autostart is controlled
by a setting in the lxc config. We were setting this in the
config file that we use for creation. However this is not clone
friendly, as we do not specify a config file for clone.

However it is perfectly valid to modify the config for the container
once it has been created. This then becomes common for both
normally created containers and those that have been cloned.

A key here is that our template container that we want to use
as a base to clone off we do not want auto-starting, however
the containers that we clone off that may well want to auto-start
(in fact all will until we add the autostart policy for local).

https://codereview.appspot.com/73300043/

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

Reviewers: mp+210099_code.launchpad.net,

Message:
Please take a look.

Description:
Set lxc autostart after creation.

Currently for a recent LXC version, the autostart is controlled
by a setting in the lxc config. We were setting this in the
config file that we use for creation. However this is not clone
friendly, as we do not specify a config file for clone.

However it is perfectly valid to modify the config for the container
once it has been created. This then becomes common for both
normally created containers and those that have been cloned.

A key here is that our template container that we want to use
as a base to clone off we do not want auto-starting, however
the containers that we clone off that may well want to auto-start
(in fact all will until we add the autostart policy for local).

https://code.launchpad.net/~thumper/juju-core/autostart-containers-after-creation/+merge/210099

Requires:
https://code.launchpad.net/~thumper/juju-core/fast-lxc/+merge/209801

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/73300043/

Affected files (+71, -35 lines):
   A [revision details]
   M container/lxc/export_test.go
   M container/lxc/lxc.go
   M container/lxc/lxc_test.go
   M container/lxc/mock/mock-lxc.go
   M container/lxc/testing/test.go

Revision history for this message
Jesse Meek (waigani) wrote :

On 2014/03/09 21:29:35, thumper wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/73300043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go
File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go#newcode179
container/lxc/lxc_test.go:179: name := string(instance.Id())
It's not clear why this has changed. Has something caused the contents
of the file to be different (apart from the lxc.start.auto)? I would
think it's preferable to match exactly if it's not too onerous.

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go
File container/lxc/mock/mock-lxc.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go#newcode87
container/lxc/mock/mock-lxc.go:87: data, err :=
ioutil.ReadFile(configFile)
There's utils.CopyFile, if you didn't know.

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go#newcode92
container/lxc/mock/mock-lxc.go:92: return
ioutil.WriteFile(configFilename, data, 0755)
0644?

https://codereview.appspot.com/73300043/

Revision history for this message
Tim Penhey (thumper) wrote :

Please take a look.

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go
File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go#newcode179
container/lxc/lxc_test.go:179: name := string(instance.Id())
On 2014/03/11 02:24:13, axw wrote:
> It's not clear why this has changed. Has something caused the contents
of the
> file to be different (apart from the lxc.start.auto)? I would think
it's
> preferable to match exactly if it's not too onerous.

Doing an exact match now.

In order to make the match easily, I have also added in the part where
the mounting of the log dir is done after create.

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go
File container/lxc/mock/mock-lxc.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go#newcode87
container/lxc/mock/mock-lxc.go:87: data, err :=
ioutil.ReadFile(configFile)
On 2014/03/11 02:24:13, axw wrote:
> There's utils.CopyFile, if you didn't know.

No I didn't. Using it now.

https://codereview.appspot.com/73300043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2014/03/11 03:46:16, thumper wrote:
> Please take a look.

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go
> File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/lxc_test.go#newcode179
> container/lxc/lxc_test.go:179: name := string(instance.Id())
> On 2014/03/11 02:24:13, axw wrote:
> > It's not clear why this has changed. Has something caused the
contents of the
> > file to be different (apart from the lxc.start.auto)? I would think
it's
> > preferable to match exactly if it's not too onerous.

> Doing an exact match now.

> In order to make the match easily, I have also added in the part where
the
> mounting of the log dir is done after create.

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go
> File container/lxc/mock/mock-lxc.go (right):

https://codereview.appspot.com/73300043/diff/1/container/lxc/mock/mock-lxc.go#newcode87
> container/lxc/mock/mock-lxc.go:87: data, err :=
ioutil.ReadFile(configFile)
> On 2014/03/11 02:24:13, axw wrote:
> > There's utils.CopyFile, if you didn't know.

> No I didn't. Using it now.

LGTM, thanks

https://codereview.appspot.com/73300043/

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (9.8 KiB)

The attempt to merge lp:~thumper/juju-core/autostart-containers-after-creation into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.014s
ok launchpad.net/juju-core/agent 1.039s
ok launchpad.net/juju-core/agent/mongo 0.530s
ok launchpad.net/juju-core/agent/tools 0.172s
ok launchpad.net/juju-core/bzr 5.107s
ok launchpad.net/juju-core/cert 2.457s
ok launchpad.net/juju-core/charm 0.393s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.029s
ok launchpad.net/juju-core/cloudinit/sshinit 0.856s
ok launchpad.net/juju-core/cmd 0.152s
ok launchpad.net/juju-core/cmd/charm-admin 0.728s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 188.242s
ok launchpad.net/juju-core/cmd/jujud 63.233s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 9.291s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.186s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.029s
ok launchpad.net/juju-core/container 0.044s
ok launchpad.net/juju-core/container/factory 0.048s
ok launchpad.net/juju-core/container/kvm 0.183s
ok launchpad.net/juju-core/container/kvm/mock 0.041s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.264s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.236s
ok launchpad.net/juju-core/environs 2.510s
ok launchpad.net/juju-core/environs/bootstrap 2.981s
ok launchpad.net/juju-core/environs/cloudinit 0.460s
ok launchpad.net/juju-core/environs/config 2.174s
ok launchpad.net/juju-core/environs/configstore 0.037s
ok launchpad.net/juju-core/environs/filestorage 0.024s
ok launchpad.net/juju-core/environs/httpstorage 0.712s
ok launchpad.net/juju-core/environs/imagemetadata 0.462s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.042s
ok launchpad.net/juju-core/environs/jujutest 0.202s
ok launchpad.net/juju-core/environs/manual 11.863s
ok launchpad.net/juju-core/environs/simplestreams 0.218s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.948s
ok launchpad.net/juju-core/environs/storage 1.024s
ok launchpad.net/juju-core/environs/sync 23.103s
ok launchpad.net/juju-core/environs/testing 0.179s
ok launchpad.net/juju-core/environs/tools 4.606s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.012s
ok launchpad.net/juju-core/instance 0.017s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 17.731s
ok launchpad.net/juju-core/juj...

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (15.3 KiB)

The attempt to merge lp:~thumper/juju-core/autostart-containers-after-creation into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.012s
ok launchpad.net/juju-core/agent 0.987s
ok launchpad.net/juju-core/agent/mongo 0.561s
ok launchpad.net/juju-core/agent/tools 0.191s
ok launchpad.net/juju-core/bzr 4.808s
ok launchpad.net/juju-core/cert 2.287s
ok launchpad.net/juju-core/charm 0.392s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.033s
ok launchpad.net/juju-core/cloudinit/sshinit 0.799s
ok launchpad.net/juju-core/cmd 0.170s
ok launchpad.net/juju-core/cmd/charm-admin 0.730s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 194.479s
ok launchpad.net/juju-core/cmd/jujud 62.786s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 9.924s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.151s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.019s
ok launchpad.net/juju-core/container 0.038s
ok launchpad.net/juju-core/container/factory 0.050s
ok launchpad.net/juju-core/container/kvm 0.236s
ok launchpad.net/juju-core/container/kvm/mock 0.041s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.251s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.221s
ok launchpad.net/juju-core/environs 2.491s
ok launchpad.net/juju-core/environs/bootstrap 3.082s
ok launchpad.net/juju-core/environs/cloudinit 0.444s
ok launchpad.net/juju-core/environs/config 3.589s
ok launchpad.net/juju-core/environs/configstore 0.028s
ok launchpad.net/juju-core/environs/filestorage 0.026s
ok launchpad.net/juju-core/environs/httpstorage 0.592s
ok launchpad.net/juju-core/environs/imagemetadata 0.405s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.049s
ok launchpad.net/juju-core/environs/jujutest 0.156s
ok launchpad.net/juju-core/environs/manual 10.074s
ok launchpad.net/juju-core/environs/simplestreams 0.226s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.961s
ok launchpad.net/juju-core/environs/storage 0.910s
ok launchpad.net/juju-core/environs/sync 23.657s
ok launchpad.net/juju-core/environs/testing 0.176s
ok launchpad.net/juju-core/environs/tools 4.828s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.011s
ok launchpad.net/juju-core/instance 0.016s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 20.596s
ok launchpad.net/juju-core/juj...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'container/lxc/export_test.go'
--- container/lxc/export_test.go 2013-10-01 02:21:52 +0000
+++ container/lxc/export_test.go 2014-03-11 03:19:30 +0000
@@ -4,7 +4,8 @@
4package lxc4package lxc
55
6var (6var (
7 NetworkConfigTemplate = networkConfigTemplate7 NetworkConfigTemplate = networkConfigTemplate
8 GenerateNetworkConfig = generateNetworkConfig8 GenerateNetworkConfig = generateNetworkConfig
9 RestartSymlink = restartSymlink9 RestartSymlink = restartSymlink
10 ContainerConfigFilename = containerConfigFilename
10)11)
1112
=== modified file 'container/lxc/lxc.go'
--- container/lxc/lxc.go 2014-03-10 02:51:31 +0000
+++ container/lxc/lxc.go 2014-03-11 03:19:30 +0000
@@ -96,7 +96,7 @@
96 return nil, nil, err96 return nil, nil, err
97 }97 }
98 logger.Tracef("write the lxc.conf file")98 logger.Tracef("write the lxc.conf file")
99 configFile, err := writeLxcConfig(network, directory, manager.logdir)99 configFile, err := writeLxcConfig(network, directory)
100 if err != nil {100 if err != nil {
101 logger.Errorf("failed to write config file: %v", err)101 logger.Errorf("failed to write config file: %v", err)
102 return nil, nil, err102 return nil, nil, err
@@ -113,25 +113,14 @@
113 logger.Errorf("lxc container creation failed: %v", err)113 logger.Errorf("lxc container creation failed: %v", err)
114 return nil, nil, err114 return nil, nil, err
115 }115 }
116 // Make sure that the mount dir has been created.
117 logger.Tracef("make the mount dir for the shard logs")
118 if err := os.MkdirAll(internalLogDir(name), 0755); err != nil {
119 logger.Errorf("failed to create internal /var/log/juju mount dir: %v", err)
120 return nil, nil, err
121 }
122 logger.Tracef("lxc container created")116 logger.Tracef("lxc container created")
123 // Now symlink the config file into the restart directory, if it exists.
124 // This is for backwards compatiblity. From Trusty onwards, the auto start
125 // option should be set in the LXC config file, this is done in the networkConfigTemplate
126 // function below.
127 if useRestartDir() {
128 containerConfigFile := filepath.Join(LxcContainerDir, name, "config")
129 if err := os.Symlink(containerConfigFile, restartSymlink(name)); err != nil {
130 return nil, nil, err
131 }
132 logger.Tracef("auto-restart link created")
133 }
134117
118 if err := autostartContainer(name); err != nil {
119 return nil, nil, err
120 }
121 if err := mountHostLogDir(name, manager.logdir); err != nil {
122 return nil, nil, err
123 }
135 // Start the lxc container with the appropriate settings for grabbing the124 // Start the lxc container with the appropriate settings for grabbing the
136 // console output and a log file.125 // console output and a log file.
137 consoleFile := filepath.Join(directory, "console.log")126 consoleFile := filepath.Join(directory, "console.log")
@@ -153,6 +142,50 @@
153 return &lxcInstance{lxcContainer, name}, hardware, nil142 return &lxcInstance{lxcContainer, name}, hardware, nil
154}143}
155144
145func appendToContainerConfig(name, line string) error {
146 file, err := os.OpenFile(
147 containerConfigFilename(name), os.O_RDWR|os.O_APPEND, 0644)
148 if err != nil {
149 return err
150 }
151 defer file.Close()
152 _, err = file.WriteString(line)
153 return err
154}
155
156func autostartContainer(name string) error {
157 // Now symlink the config file into the restart directory, if it exists.
158 // This is for backwards compatiblity. From Trusty onwards, the auto start
159 // option should be set in the LXC config file, this is done in the networkConfigTemplate
160 // function below.
161 if useRestartDir() {
162 if err := os.Symlink(
163 containerConfigFilename(name),
164 restartSymlink(name),
165 ); err != nil {
166 return err
167 }
168 logger.Tracef("auto-restart link created")
169 } else {
170 logger.Tracef("Setting auto start to true in lxc config.")
171 return appendToContainerConfig(name, "lxc.start.auto = 1\n")
172 }
173 return nil
174}
175
176func mountHostLogDir(name, logDir string) error {
177 // Make sure that the mount dir has been created.
178 logger.Tracef("make the mount dir for the shared logs")
179 if err := os.MkdirAll(internalLogDir(name), 0755); err != nil {
180 logger.Errorf("failed to create internal /var/log/juju mount dir: %v", err)
181 return err
182 }
183 line := fmt.Sprintf(
184 "lxc.mount.entry=%s var/log/juju none defaults,bind 0 0\n",
185 logDir)
186 return appendToContainerConfig(name, line)
187}
188
156func (manager *containerManager) StopContainer(instance instance.Instance) error {189func (manager *containerManager) StopContainer(instance instance.Instance) error {
157 name := string(instance.Id())190 name := string(instance.Id())
158 lxcContainer := LxcObjectFactory.New(name)191 lxcContainer := LxcObjectFactory.New(name)
@@ -205,9 +238,9 @@
205 return filepath.Join(LxcRestartDir, name+".conf")238 return filepath.Join(LxcRestartDir, name+".conf")
206}239}
207240
208const localConfig = `%s241func containerConfigFilename(name string) string {
209lxc.mount.entry=%s var/log/juju none defaults,bind 0 0242 return filepath.Join(LxcContainerDir, name, "config")
210`243}
211244
212const networkTemplate = `245const networkTemplate = `
213lxc.network.type = %s246lxc.network.type = %s
@@ -216,12 +249,7 @@
216`249`
217250
218func networkConfigTemplate(networkType, networkLink string) string {251func networkConfigTemplate(networkType, networkLink string) string {
219 networkConfig := fmt.Sprintf(networkTemplate, networkType, networkLink)252 return fmt.Sprintf(networkTemplate, networkType, networkLink)
220 if !useRestartDir() {
221 networkConfig += "lxc.start.auto = 1\n"
222 logger.Tracef("Setting auto start to true in lxc config.")
223 }
224 return networkConfig
225}253}
226254
227func generateNetworkConfig(network *container.NetworkConfig) string {255func generateNetworkConfig(network *container.NetworkConfig) string {
@@ -240,11 +268,10 @@
240 }268 }
241}269}
242270
243func writeLxcConfig(network *container.NetworkConfig, directory, logdir string) (string, error) {271func writeLxcConfig(network *container.NetworkConfig, directory string) (string, error) {
244 networkConfig := generateNetworkConfig(network)272 networkConfig := generateNetworkConfig(network)
245 configFilename := filepath.Join(directory, "lxc.conf")273 configFilename := filepath.Join(directory, "lxc.conf")
246 configContent := fmt.Sprintf(localConfig, networkConfig, logdir)274 if err := ioutil.WriteFile(configFilename, []byte(networkConfig), 0644); err != nil {
247 if err := ioutil.WriteFile(configFilename, []byte(configContent), 0644); err != nil {
248 return "", err275 return "", err
249 }276 }
250 return configFilename, nil277 return configFilename, nil
251278
=== modified file 'container/lxc/lxc_test.go'
--- container/lxc/lxc_test.go 2014-03-10 02:51:31 +0000
+++ container/lxc/lxc_test.go 2014-03-11 03:19:30 +0000
@@ -185,16 +185,18 @@
185185
186 manager := s.makeManager(c, "test")186 manager := s.makeManager(c, "test")
187 instance := containertesting.StartContainer(c, manager, "1/lxc/0")187 instance := containertesting.StartContainer(c, manager, "1/lxc/0")
188 autostartLink := lxc.RestartSymlink(string(instance.Id()))188 name := string(instance.Id())
189189 autostartLink := lxc.RestartSymlink(name)
190 config := lxc.NetworkConfigTemplate("foo", "bar")190 config, err := ioutil.ReadFile(lxc.ContainerConfigFilename(name))
191 c.Assert(err, gc.IsNil)
191 expected := `192 expected := `
192lxc.network.type = foo193lxc.network.type = veth
193lxc.network.link = bar194lxc.network.link = nic42
194lxc.network.flags = up195lxc.network.flags = up
195lxc.start.auto = 1196lxc.start.auto = 1
197lxc.mount.entry=/var/log/juju var/log/juju none defaults,bind 0 0
196`198`
197 c.Assert(config, gc.Equals, expected)199 c.Assert(string(config), gc.Equals, expected)
198 c.Assert(autostartLink, jc.DoesNotExist)200 c.Assert(autostartLink, jc.DoesNotExist)
199}201}
200202
201203
=== modified file 'container/lxc/mock/mock-lxc.go'
--- container/lxc/mock/mock-lxc.go 2013-09-30 01:50:43 +0000
+++ container/lxc/mock/mock-lxc.go 2014-03-11 03:19:30 +0000
@@ -5,8 +5,12 @@
55
6import (6import (
7 "fmt"7 "fmt"
8 "os"
9 "path/filepath"
810
9 "launchpad.net/golxc"11 "launchpad.net/golxc"
12
13 "launchpad.net/juju-core/utils"
10)14)
1115
12// This file provides a mock implementation of the golxc interfaces16// This file provides a mock implementation of the golxc interfaces
@@ -44,13 +48,15 @@
44}48}
4549
46type mockFactory struct {50type mockFactory struct {
47 instances map[string]golxc.Container51 containerDir string
48 listeners []chan<- Event52 instances map[string]golxc.Container
53 listeners []chan<- Event
49}54}
5055
51func MockFactory() ContainerFactory {56func MockFactory(containerDir string) ContainerFactory {
52 return &mockFactory{57 return &mockFactory{
53 instances: make(map[string]golxc.Container),58 containerDir: containerDir,
59 instances: make(map[string]golxc.Container),
54 }60 }
55}61}
5662
@@ -74,7 +80,13 @@
74 }80 }
75 mock.state = golxc.StateStopped81 mock.state = golxc.StateStopped
76 mock.factory.instances[mock.name] = mock82 mock.factory.instances[mock.name] = mock
77 return nil83 // Create the container directory.
84 containerDir := filepath.Join(mock.factory.containerDir, mock.name)
85 if err := os.MkdirAll(containerDir, 0755); err != nil {
86 return err
87 }
88 containerConfig := filepath.Join(containerDir, "config")
89 return utils.CopyFile(containerConfig, configFile)
78}90}
7991
80// Start runs the container as a daemon.92// Start runs the container as a daemon.
8193
=== modified file 'container/lxc/testing/test.go'
--- container/lxc/testing/test.go 2013-11-11 22:45:29 +0000
+++ container/lxc/testing/test.go 2014-03-11 03:19:30 +0000
@@ -33,6 +33,6 @@
33 s.PatchValue(&lxc.LxcContainerDir, s.LxcDir)33 s.PatchValue(&lxc.LxcContainerDir, s.LxcDir)
34 s.RestartDir = c.MkDir()34 s.RestartDir = c.MkDir()
35 s.PatchValue(&lxc.LxcRestartDir, s.RestartDir)35 s.PatchValue(&lxc.LxcRestartDir, s.RestartDir)
36 s.Factory = mock.MockFactory()36 s.Factory = mock.MockFactory(s.LxcDir)
37 s.PatchValue(&lxc.LxcObjectFactory, s.Factory)37 s.PatchValue(&lxc.LxcObjectFactory, s.Factory)
38}38}

Subscribers

People subscribed via source and target branches

to status/vote changes: