Merge lp:~niemeyer/juju-core/new-state-bootstrap-fixes into lp:~juju/juju-core/trunk

Proposed by Gustavo Niemeyer
Status: Merged
Merged at revision: 567
Proposed branch: lp:~niemeyer/juju-core/new-state-bootstrap-fixes
Merge into: lp:~juju/juju-core/trunk
Diff against target: 76 lines (+12/-16)
2 files modified
environs/cloudinit/cloudinit.go (+7/-12)
state/open.go (+5/-4)
To merge this branch: bzr merge lp:~niemeyer/juju-core/new-state-bootstrap-fixes
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+126101@code.launchpad.net

Description of the change

state,environs/cloudinit: fix bootstrap

With these changes environments correctly bootstrap again.

https://codereview.appspot.com/6568043/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :
Download full text (3.3 KiB)

Reviewers: mp+126101_code.launchpad.net,

Message:
Please take a look.

Description:
state,environs/cloudinit: fix bootstrap

With these changes environments correctly bootstrap again.

https://code.launchpad.net/~niemeyer/juju-core/new-state-bootstrap-fixes/+merge/126101

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M environs/cloudinit/cloudinit.go
   M state/open.go

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: state/open.go
=== modified file 'state/open.go'
--- state/open.go 2012-09-20 15:41:42 +0000
+++ state/open.go 2012-09-24 21:12:07 +0000
@@ -4,6 +4,7 @@
   "errors"
   "fmt"
   "strings"
+ "time"

   "labix.org/v2/mgo"
   "labix.org/v2/mgo/txn"
@@ -35,7 +36,7 @@
    return nil, errors.New("no mongo addresses")
   }
   if !info.UseSSH {
- session, err := mgo.Dial(strings.Join(info.Addrs, ","))
+ session, err := mgo.DialWithTimeout(strings.Join(info.Addrs, ","),
10*time.Minute)
    if err != nil {
     return nil, err
    }
@@ -92,11 +93,11 @@
   {"units", []string{"machineid"}},
  }

-// The capped collection used for transaction logs defaults to 200MB.
+// The capped collection used for transaction logs defaults to 10MB.
  // It's tweaked in export_test.go to 1MB to avoid the overhead of
-// creating and deleting the large file repeatedly.
+// creating and deleting the large file repeatedly in tests.
  var (
- logSize = 200000000
+ logSize = 10000000
   logSizeTests = 1000000
  )

Index: environs/cloudinit/cloudinit.go
=== modified file 'environs/cloudinit/cloudinit.go'
--- environs/cloudinit/cloudinit.go 2012-09-21 15:45:22 +0000
+++ environs/cloudinit/cloudinit.go 2012-09-24 21:10:48 +0000
@@ -121,22 +121,17 @@
    addScripts(c,
     "mkdir -p /opt",
     fmt.Sprintf("wget -O - %s | tar xz -C /opt", shquote(url)),
- cfg.jujuTools()+"/jujud bootstrap-state"+
- " --instance-id "+cfg.InstanceIdAccessor+
- " --env-config "+shquote(base64yaml(cfg.Config))+
- " --state-servers localhost"+mgoPortSuffix+
- debugFlag,
    )
    if err := addMongoToBoot(c); err != nil {
     return nil, err
    }
- addScripts(c,
- cfg.jujuTools()+"/jujud bootstrap-state"+
- " --instance-id "+cfg.InstanceIdAccessor+
- " --env-config "+shquote(base64yaml(cfg.Config))+
- " --state-servers localhost"+mgoPortSuffix+
- debugFlag,
+ addScripts(c, cfg.jujuTools()+"/jujud bootstrap-state"+
+ " --instance-id "+cfg.InstanceIdAccessor+
+ " --env-config "+shquote(base64yaml(cfg.Config))+
+ " --state-servers localhost"+mgoPortSuffix+
+ debugFlag,
    )
+
   }

   if err := addAgentToBoot(c, cfg, "machine",
fmt.Sprintf("--machine-id %d "+debugFlag, cfg.MachineId)); err != nil {
@@ -194,7 +189,7 @@
   conf := &upstart.Conf{
    Service: *svc,
    Desc: "juju state database",
- Cmd: "/opt/mongo/bin/mongod --port 37017 --bind_ip 0.0....

Read more...

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

*** Submitted:

state,environs/cloudinit: fix bootstrap

With these changes environments correctly bootstrap again.

R=dfc
CC=
https://codereview.appspot.com/6568043

https://codereview.appspot.com/6568043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/cloudinit/cloudinit.go'
2--- environs/cloudinit/cloudinit.go 2012-09-21 15:45:22 +0000
3+++ environs/cloudinit/cloudinit.go 2012-09-24 21:19:37 +0000
4@@ -121,22 +121,17 @@
5 addScripts(c,
6 "mkdir -p /opt",
7 fmt.Sprintf("wget -O - %s | tar xz -C /opt", shquote(url)),
8- cfg.jujuTools()+"/jujud bootstrap-state"+
9- " --instance-id "+cfg.InstanceIdAccessor+
10- " --env-config "+shquote(base64yaml(cfg.Config))+
11- " --state-servers localhost"+mgoPortSuffix+
12- debugFlag,
13 )
14 if err := addMongoToBoot(c); err != nil {
15 return nil, err
16 }
17- addScripts(c,
18- cfg.jujuTools()+"/jujud bootstrap-state"+
19- " --instance-id "+cfg.InstanceIdAccessor+
20- " --env-config "+shquote(base64yaml(cfg.Config))+
21- " --state-servers localhost"+mgoPortSuffix+
22- debugFlag,
23+ addScripts(c, cfg.jujuTools()+"/jujud bootstrap-state"+
24+ " --instance-id "+cfg.InstanceIdAccessor+
25+ " --env-config "+shquote(base64yaml(cfg.Config))+
26+ " --state-servers localhost"+mgoPortSuffix+
27+ debugFlag,
28 )
29+
30 }
31
32 if err := addAgentToBoot(c, cfg, "machine", fmt.Sprintf("--machine-id %d "+debugFlag, cfg.MachineId)); err != nil {
33@@ -194,7 +189,7 @@
34 conf := &upstart.Conf{
35 Service: *svc,
36 Desc: "juju state database",
37- Cmd: "/opt/mongo/bin/mongod --port 37017 --bind_ip 0.0.0.0 --dbpath=/var/lib/juju/db",
38+ Cmd: "/opt/mongo/bin/mongod --port=37017 --bind_ip=0.0.0.0 --dbpath=/var/lib/juju/db --smallfiles --noprealloc",
39 }
40 cmds, err := conf.InstallCommands()
41 if err != nil {
42
43=== modified file 'state/open.go'
44--- state/open.go 2012-09-20 15:41:42 +0000
45+++ state/open.go 2012-09-24 21:19:37 +0000
46@@ -4,6 +4,7 @@
47 "errors"
48 "fmt"
49 "strings"
50+ "time"
51
52 "labix.org/v2/mgo"
53 "labix.org/v2/mgo/txn"
54@@ -35,7 +36,7 @@
55 return nil, errors.New("no mongo addresses")
56 }
57 if !info.UseSSH {
58- session, err := mgo.Dial(strings.Join(info.Addrs, ","))
59+ session, err := mgo.DialWithTimeout(strings.Join(info.Addrs, ","), 10*time.Minute)
60 if err != nil {
61 return nil, err
62 }
63@@ -92,11 +93,11 @@
64 {"units", []string{"machineid"}},
65 }
66
67-// The capped collection used for transaction logs defaults to 200MB.
68+// The capped collection used for transaction logs defaults to 10MB.
69 // It's tweaked in export_test.go to 1MB to avoid the overhead of
70-// creating and deleting the large file repeatedly.
71+// creating and deleting the large file repeatedly in tests.
72 var (
73- logSize = 200000000
74+ logSize = 10000000
75 logSizeTests = 1000000
76 )
77

Subscribers

People subscribed via source and target branches