cmd/makemac: use new MacStadium datastore

MacStadium is migrating off the current datastore. As part of the
transition, we copied our base images to the new storage, adding _nfs as
the suffix. The new images were snapshotted to allow for copy on write.

New base image names were suffixed with _nfs to accommodate the
migration. The new storage device was named GGLGLN-A-001-STV1 by
MacStadium.

Updated vmware-notes.txt to include manual instructions for a test run
of this latest change. The VM started and successfully connected to the
coordinator.

Updates golang/go#33155

Change-Id: I69976ebc6faa4f95a0aefd4d2e4c8d6a5bcf8a0f
Reviewed-on: https://go-review.googlesource.com/c/build/+/188219
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/makemac/makemac.go b/cmd/makemac/makemac.go
index 46a1013..5a338af 100644
--- a/cmd/makemac/makemac.go
+++ b/cmd/makemac/makemac.go
@@ -245,7 +245,7 @@
 
 	baseDisk, err := findBaseDisk(ctx, minor)
 	if err != nil {
-		return "", fmt.Errorf("failed to find osx_%d_frozen base disk: %v", minor, err)
+		return "", fmt.Errorf("failed to find osx_%d_frozen_nfs base disk: %v", minor, err)
 	}
 
 	hostNum, hostWhich, err := st.pickHost()
@@ -296,7 +296,7 @@
 		"-vm", name,
 		"-link=true",
 		"-persist=false",
-		"-ds=Pure1-1",
+		"-ds=GGLGLN-A-001-STV1",
 		"-disk", baseDisk,
 	); err != nil {
 		return "", err
@@ -474,9 +474,9 @@
 }
 
 // findBaseDisk returns the path of the vmdk of the most recent
-// snapshot of the osx_$(minor)_frozen VM.
+// snapshot of the osx_$(minor)_frozen_nfs VM.
 func findBaseDisk(ctx context.Context, minor int) (string, error) {
-	vmName := fmt.Sprintf("osx_%d_frozen", minor)
+	vmName := fmt.Sprintf("osx_%d_frozen_nfs", minor)
 	out, err := exec.CommandContext(ctx, "govc", "vm.info", "-json", vmName).Output()
 	if err != nil {
 		return "", err
@@ -508,9 +508,9 @@
 	// Now find the first vmdk file, without its [datastore] prefix. The files are listed like:
 	/*
 	   "SnapshotFile": [
-	     "[Pure1-1] osx_14_frozen/osx_14_frozen-Snapshot2.vmsn",
-	     "[Pure1-1] osx_14_frozen/osx_14_frozen_15.vmdk",
-	     "[Pure1-1] osx_14_frozen/osx_14_frozen_15-000001.vmdk"
+	     "[GGLGLN-A-001-STV1] osx_14_frozen_nfs/osx_14_frozen_nfs-Snapshot2.vmsn",
+	     "[GGLGLN-A-001-STV1] osx_14_frozen_nfs/osx_14_frozen_nfs_15.vmdk",
+	     "[GGLGLN-A-001-STV1] osx_14_frozen_nfs/osx_14_frozen_nfs_15-000001.vmdk"
 	   ]
 	*/
 	for _, f := range ss.SnapshotFile {
diff --git a/env/darwin/macstadium/vmware-notes.md b/env/darwin/macstadium/vmware-notes.md
new file mode 100644
index 0000000..0de2446
--- /dev/null
+++ b/env/darwin/macstadium/vmware-notes.md
@@ -0,0 +1,62 @@
+* Setup OS X.
+* Shut it down.
+* Clone to Virtual Machine (convention: "osx_11_frozen" for OS X
+  10.11")
+* Snapshot that new frozen VM once to make its vmdk in COW format.
+
+Then, to create more:
+
+* 10.14:
+
+```bash
+export VMHOST=4
+export VMWHICH=b
+export VMNAME="mac_10_14_host0${VMHOST}_${VMWHICH}"
+govc vm.create -m 4096 -c 6 -on=false -net dvPortGroup-Private -g darwin18_64Guest -ds "BOOT_$VMHOST" $VMNAME
+govc vm.change -e smc.present=TRUE -e ich7m.present=TRUE -e firmware=efi -e guestinfo.key-host-darwin-10_14=$(cat $HOME/keys/host-darwin-10_14) -e guestinfo.name=$VMNAME -vm $VMNAME
+govc device.usb.add -vm $VMNAME
+govc vm.disk.attach -vm $VMNAME -link=true -persist=false -ds GGLGLN-A-001-STV1 -disk osx_14_frozen_nfs/osx_14_frozen_nfs_17.vmdk
+govc vm.power -on $VMNAME
+```
+
+* 10.x:
+
+Change MINOR to target minor version (14, 12, 11, 10, and 8 are supported)
+
+```bash
+export MINOR=14
+export VMHOST=4
+export VMWHICH=b
+export GUEST_TYPE=darwin$(expr $MINOR + 4)_64Guest # (14: darwin18, 12: darwin16...)
+export VMNAME="mac_10_${MINOR}_host0${VMHOST}_${VMWHICH}"
+export SNAPSHOT=$(govc vm.info -json osx_${MINOR}_frozen_nfs | jq -r '.VirtualMachines[0].Layout.Snapshot[0].SnapshotFile|.[]|match(" .+vmdk$").string')
+govc vm.create -m 4096 -c 6 -on=false -net dvPortGroup-Private -g darwin16_64Guest -ds "BOOT_$VMHOST" $VMNAME
+govc vm.change -e smc.present=TRUE -e ich7m.present=TRUE -e firmware=efi -e guestinfo.key-host-darwin-10_$MINOR=$(cat $HOME/keys/host-darwin-10_${MINOR}) -e guestinfo.name=$VMNAME -vm $VMNAME
+govc device.usb.add -vm $VMNAME
+govc vm.disk.attach -vm $VMNAME -link=true -persist=false -ds GGLGLN-A-001-STV1 -disk $SNAPSHOT
+govc vm.power -on $VMNAME
+```
+
+Other misc notes:
+
+```bash
+$ govc vm.info -json osx11_host12_a | jq . | grep MacAdd
+              "MacAddress": "00:50:56:b4:05:57",
+```
+
+if sleep failing,
+```bash
+sudo pmset -a hibernatemode 25
+sudo pmset sleepnow
+```
+
+```bash
+pmset -g assertions     # RemovableMedia mounted
+system_profiler  # to see which
+```
+
+https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1012225
+  ... doesn't seem to work
+  ... but changing from SATA to IDE does make the RemovableMedia assertion go away (but `pmset sleepnow` stil doesn't work)
+
+
diff --git a/env/darwin/macstadium/vmware-notes.txt b/env/darwin/macstadium/vmware-notes.txt
deleted file mode 100644
index db7c32f..0000000
--- a/env/darwin/macstadium/vmware-notes.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-* Setup OS X.
-* Shut it down.
-* Clone to Virtual Machine (convention: "osx_11_frozen" for OS X
-  10.11")
-* Snapshot that new frozen VM once to make its vmdk in COW format.
-
-Then, to create more:
-
-# 10.11
-
-export VMHOST=4
-export VMWHICH=b
-export VMNAME=osx11_host${VMHOST}_${VMWHICH}
-date
-govc vm.create -m 4096 -c 2 -on=false -net dvPortGroup-Private -ds "BOOT_$VMHOST"  -g darwin14_64Guest $VMNAME
-govc vm.change -e smc.present=TRUE -e ich7m.present=TRUE -e firmware=efi -vm $VMNAME
-govc device.usb.add -vm $VMNAME
-govc vm.disk.attach -vm $VMNAME -link=true -persist=false -ds=NetApp-1 -disk "osx_11_frozen/osx_11_frozen.vmdk"
-govc vm.power -on $VMNAME
-date
-
-# 10.8:
-
-export VMHOST=13
-export VMWHICH=b
-export VMNAME=osx8_host${VMHOST}_${VMWHICH}
-date
-govc vm.create -m 4096 -c 2 -on=false -net dvPortGroup-Private -ds "mac_host_$VMHOST"  -g darwin12_64Guest $VMNAME
-govc vm.change -e smc.present=TRUE -e ich7m.present=TRUE -e firmware=efi -vm $VMNAME
-govc device.usb.add -vm $VMNAME
-govc vm.disk.attach -vm $VMNAME -link=true -persist=false -ds=NetApp-1 -disk "osx_8_frozen/osx_8_frozen.vmdk"
-govc vm.power -on $VMNAME
-date
-
-
-Other misc notes:
-
-$ govc vm.info -json osx11_host12_a | jq . | grep MacAdd
-              "MacAddress": "00:50:56:b4:05:57",
-
-
-sudo pmset -a hibernatemode 25
-sudo pmset sleepnow
-if sleep failing,
-pmset -g assertions     # RemovableMedia mounted
-system_profiler  # to see which
-https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1012225
-  ... doesn't seem to work
-  ... but changing from SATA to IDE does make the RemovableMedia assertion go away (but `pmset sleepnow` stil doesn't work)
-