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
=== 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:19:37 +0000
@@ -121,22 +121,17 @@
121 addScripts(c,121 addScripts(c,
122 "mkdir -p /opt",122 "mkdir -p /opt",
123 fmt.Sprintf("wget -O - %s | tar xz -C /opt", shquote(url)),123 fmt.Sprintf("wget -O - %s | tar xz -C /opt", shquote(url)),
124 cfg.jujuTools()+"/jujud bootstrap-state"+
125 " --instance-id "+cfg.InstanceIdAccessor+
126 " --env-config "+shquote(base64yaml(cfg.Config))+
127 " --state-servers localhost"+mgoPortSuffix+
128 debugFlag,
129 )124 )
130 if err := addMongoToBoot(c); err != nil {125 if err := addMongoToBoot(c); err != nil {
131 return nil, err126 return nil, err
132 }127 }
133 addScripts(c,128 addScripts(c, cfg.jujuTools()+"/jujud bootstrap-state"+
134 cfg.jujuTools()+"/jujud bootstrap-state"+129 " --instance-id "+cfg.InstanceIdAccessor+
135 " --instance-id "+cfg.InstanceIdAccessor+130 " --env-config "+shquote(base64yaml(cfg.Config))+
136 " --env-config "+shquote(base64yaml(cfg.Config))+131 " --state-servers localhost"+mgoPortSuffix+
137 " --state-servers localhost"+mgoPortSuffix+132 debugFlag,
138 debugFlag,
139 )133 )
134
140 }135 }
141136
142 if err := addAgentToBoot(c, cfg, "machine", fmt.Sprintf("--machine-id %d "+debugFlag, cfg.MachineId)); err != nil {137 if err := addAgentToBoot(c, cfg, "machine", fmt.Sprintf("--machine-id %d "+debugFlag, cfg.MachineId)); err != nil {
@@ -194,7 +189,7 @@
194 conf := &upstart.Conf{189 conf := &upstart.Conf{
195 Service: *svc,190 Service: *svc,
196 Desc: "juju state database",191 Desc: "juju state database",
197 Cmd: "/opt/mongo/bin/mongod --port 37017 --bind_ip 0.0.0.0 --dbpath=/var/lib/juju/db",192 Cmd: "/opt/mongo/bin/mongod --port=37017 --bind_ip=0.0.0.0 --dbpath=/var/lib/juju/db --smallfiles --noprealloc",
198 }193 }
199 cmds, err := conf.InstallCommands()194 cmds, err := conf.InstallCommands()
200 if err != nil {195 if err != nil {
201196
=== modified file 'state/open.go'
--- state/open.go 2012-09-20 15:41:42 +0000
+++ state/open.go 2012-09-24 21:19:37 +0000
@@ -4,6 +4,7 @@
4 "errors"4 "errors"
5 "fmt"5 "fmt"
6 "strings"6 "strings"
7 "time"
78
8 "labix.org/v2/mgo"9 "labix.org/v2/mgo"
9 "labix.org/v2/mgo/txn"10 "labix.org/v2/mgo/txn"
@@ -35,7 +36,7 @@
35 return nil, errors.New("no mongo addresses")36 return nil, errors.New("no mongo addresses")
36 }37 }
37 if !info.UseSSH {38 if !info.UseSSH {
38 session, err := mgo.Dial(strings.Join(info.Addrs, ","))39 session, err := mgo.DialWithTimeout(strings.Join(info.Addrs, ","), 10*time.Minute)
39 if err != nil {40 if err != nil {
40 return nil, err41 return nil, err
41 }42 }
@@ -92,11 +93,11 @@
92 {"units", []string{"machineid"}},93 {"units", []string{"machineid"}},
93}94}
9495
95// The capped collection used for transaction logs defaults to 200MB.96// The capped collection used for transaction logs defaults to 10MB.
96// It's tweaked in export_test.go to 1MB to avoid the overhead of97// It's tweaked in export_test.go to 1MB to avoid the overhead of
97// creating and deleting the large file repeatedly.98// creating and deleting the large file repeatedly in tests.
98var (99var (
99 logSize = 200000000100 logSize = 10000000
100 logSizeTests = 1000000101 logSizeTests = 1000000
101)102)
102103

Subscribers

People subscribed via source and target branches