Skip to content

Commit 615aa4d

Browse files
committed
cmd/buildlet, cmd/makemac: normalize macstadium host names for monitoring
In prep for better alerting when dedicated (reverse) buildlers disappear, normalize the the MacStadium host names to remove the extraneous guest OS version from them, so we can track the host's last-seen time reliably over time, even as the guest OS version changes. This CL also cleans up makemac while it's there and fixes some bugs and adds some paranoia checks and cleans up logging and adds an HTTP status handler. A future change will improve coordinator monitoring of reverse buildlets. Updates golang/go#21315 Change-Id: I3d09168cc91f37715b65ae2924a1642401e18808 Reviewed-on: https://go-review.googlesource.com/53353 Reviewed-by: Jessie Frazelle <[email protected]>
1 parent 732fb5f commit 615aa4d

File tree

3 files changed

+240
-65
lines changed

3 files changed

+240
-65
lines changed

cmd/buildlet/buildlet.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,31 @@ func configureMacStadium() {
14971497
}
14981498
*reverse = "darwin-amd64-" + major + "_" + minor
14991499
*coordinator = "farmer.golang.org:443"
1500-
*hostname = vmwareGetInfo("guestinfo.name")
1500+
1501+
// guestName is set by cmd/makemac to something like
1502+
// "mac_10_10_host01b" or "mac_10_12_host01a", which encodes
1503+
// three things: the mac OS version of the guest VM, which
1504+
// physical machine it's on (1 to 10, currently) and which of
1505+
// two possible VMs on that host is running (a or b). For
1506+
// monitoring purposes, we want stable hostnames and don't
1507+
// care which OS version is currently running (which changes
1508+
// constantly), so normalize these to only have the host
1509+
// number and side (a or b), without the OS version. The
1510+
// buildlet will report the OS version to the coordinator
1511+
// anyway. We could in theory do this normalization in the
1512+
// coordinator, but we don't want to put buildlet-specific
1513+
// knowledge there, and this file already contains a bunch of
1514+
// buildlet host-specific configuration, so normalize it here.
1515+
guestName := vmwareGetInfo("guestinfo.name") // "mac_10_12_host01a"
1516+
hostPos := strings.Index(guestName, "_host")
1517+
if hostPos == -1 {
1518+
// Assume cmd/makemac changed its conventions.
1519+
// Maybe all this normalization belongs there anyway,
1520+
// but normalizing here is a safer first step.
1521+
*hostname = guestName
1522+
} else {
1523+
*hostname = "macstadium" + guestName[hostPos:] // "macstadium_host01a"
1524+
}
15011525
}
15021526

15031527
func disableMacScreensaver() {

cmd/makemac/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
<!-- Auto-generated by x/build/update-readmes.go -->
2-
31
[![GoDoc](https://godoc.org/golang.org/x/build/cmd/makemac?status.svg)](https://godoc.org/golang.org/x/build/cmd/makemac)
42

53
# golang.org/x/build/cmd/makemac
64

75
The makemac command starts OS X VMs for the builders.
6+
7+
## Deploying
8+
9+
```
10+
* On Linux,
11+
$ go install golang.org/x/build/cmd/makemac
12+
$ scp -i ~/.ssh/id_ed25519_golang1 $GOPATH/bin/makemac [email protected]:makemac.new
13+
$ ssh -i ~/.ssh/id_ed25519_golang1 [email protected] 'cp makemac makemac.old; install makemac.new makemac'
14+
$ ssh -i ~/.ssh/id_ed25519_golang1 [email protected]
15+
16+
On that host,
17+
* sudo systemctl restart makemac
18+
$ sudo journalctl -f -u makemac # watch it
19+
```

0 commit comments

Comments
 (0)