Code review comment for lp:~niemeyer/juju-core/new-state-bootstrap-fixes

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

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.0.0
--dbpath=/var/lib/juju/db",
+ Cmd: "/opt/mongo/bin/mongod --port=37017 --bind_ip=0.0.0.0
--dbpath=/var/lib/juju/db --smallfiles --noprealloc",
   }
   cmds, err := conf.InstallCommands()
   if err != nil {

« Back to merge proposal