veyron2/services/mgmt/node: rename node->device, cl 2 of N (go/vissue/496)

Rename node->device throughout type/method names and comments. Virtually all
mechanical replacements, except for comment reformatting.

Renaming files and packages left for future cls.

Change-Id: I49cfd04c3ae2a7e6ffed8c76f6868d5981118fcf
diff --git a/tools/mgmt/nminstall b/tools/mgmt/nminstall
index a9b6406..c366dbf 100755
--- a/tools/mgmt/nminstall
+++ b/tools/mgmt/nminstall
@@ -1,17 +1,17 @@
 #!/bin/bash
 #
-# Installs node manager on the local machine.
+# Installs device manager on the local machine.
 #
 # Specifically:
 #
-# 1. Fetches the binaries required for a node manager installation from a few
+# 1. Fetches the binaries required for a device manager installation from a few
 # possible sources.
 #
 # 2. Sets up the helper with setuid.  The helper binary needs to be owned by
-# root and have the suid bit set, to enable the node manager to run binaries
+# root and have the suid bit set, to enable the device manager to run binaries
 # under different system accounts than itself.
 #
-# 3. Runs the self-install command on the node manager.
+# 3. Runs the self-install command on the device manager.
 #
 # Usage:
 #
@@ -28,7 +28,7 @@
 
 usage() {
   echo "usage:"
-  echo "./nminstall [--single_user] <install parent dir> [<binary source>] [-- args for node manager...]"
+  echo "./nminstall [--single_user] <install parent dir> [<binary source>] [-- args for device manager...]"
 }
 
 readonly BIN_NAMES=(noded suidhelper agentd)
@@ -58,7 +58,7 @@
 }
 
 ###############################################################################
-# Fetches binaries needed by node manager installation.
+# Fetches binaries needed by device manager installation.
 # Globals:
 #   BIN_NAMES
 #   VEYRON_ROOT
@@ -139,11 +139,11 @@
     exit 1
   fi
 
-  local -r INSTALL_DIR="${INSTALL_PARENT_DIR}/node_manager"
+  local -r INSTALL_DIR="${INSTALL_PARENT_DIR}/device_manager"
 
-  # TODO(caprita): Check that the node manager is not already installed before
+  # TODO(caprita): Check that the device manager is not already installed before
   # proceeding.  We should require an explicit uninstall to avoid wiping away
-  # the node manager accidentally.
+  # the device manager accidentally.
   if [[ ${SINGLE_USER} == false ]]; then
     sudo rm -rf "${INSTALL_DIR}"
   else
@@ -179,9 +179,9 @@
   fi
   echo "Suidhelper configured."
 
-  # Tell the node manager to install itself.
+  # Tell the device manager to install itself.
   local -r NM_ROOT="${INSTALL_DIR}/nmroot"
-  echo "Installing node manager under ${NM_ROOT} ..."
+  echo "Installing device manager under ${NM_ROOT} ..."
   local -r PUBLISH=$(hostname)
   if [[ "$1" = "--" ]]; then
     shift
@@ -191,8 +191,8 @@
     exit 1
   fi
 
-  VEYRON_NM_CURRENT="${INSTALL_DIR}/noded.curr" VEYRON_NM_ROOT="${NM_ROOT}" VEYRON_NM_HELPER="${SETUID_SCRIPT}" "${BIN_INSTALL}/noded" --install_self -- --name="${PUBLISH}" "$@"
-  echo "Node manager installed."
+  VEYRON_NM_CURRENT="${INSTALL_DIR}/deviced.curr" VEYRON_NM_ROOT="${NM_ROOT}" VEYRON_NM_HELPER="${SETUID_SCRIPT}" "${BIN_INSTALL}/noded" --install_self -- --name="${PUBLISH}" "$@"
+  echo "Device manager installed."
 
   local -r SECURITY_DIR="${INSTALL_DIR}/security"
   mkdir -m 700 "${SECURITY_DIR}"
@@ -201,14 +201,14 @@
   local -r AGENT_KEY_DIR="${SECURITY_DIR}/keys"
   mkdir -m 700 "${AGENT_KEY_DIR}"
 
-  # Run node manager under the security agent.
+  # Run device manager under the security agent.
   echo
   echo "Running:"
-  echo "VEYRON_CREDENTIALS=\"${PRINCIPAL_DIR}\" \"${BIN_INSTALL}/agentd\" ${AGENT_FLAG} --additional_principals=\"${AGENT_KEY_DIR}\" \"${INSTALL_DIR}/noded.curr\""
+  echo "VEYRON_CREDENTIALS=\"${PRINCIPAL_DIR}\" \"${BIN_INSTALL}/agentd\" ${AGENT_FLAG} --additional_principals=\"${AGENT_KEY_DIR}\" \"${INSTALL_DIR}/deviced.curr\""
   echo
   # NOTE: If you update the command below, please also update the command echoed
   # above to keep the two in sync.
-  VEYRON_CREDENTIALS="${PRINCIPAL_DIR}" exec "${BIN_INSTALL}/agentd" ${AGENT_FLAG} --additional_principals="${AGENT_KEY_DIR}" "${INSTALL_DIR}/noded.curr"
+  VEYRON_CREDENTIALS="${PRINCIPAL_DIR}" exec "${BIN_INSTALL}/agentd" ${AGENT_FLAG} --additional_principals="${AGENT_KEY_DIR}" "${INSTALL_DIR}/deviced.curr"
 }
 
 main "$@"
diff --git a/tools/mgmt/nodex/acl_test.go b/tools/mgmt/nodex/acl_test.go
index 57922f8..9e6b945 100644
--- a/tools/mgmt/nodex/acl_test.go
+++ b/tools/mgmt/nodex/acl_test.go
@@ -32,7 +32,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	// Test the 'get' command.
 	tape.SetResponses([]interface{}{GetACLResponse{
@@ -49,7 +49,7 @@
 		err:  nil,
 	}})
 
-	if err := cmd.Execute([]string{"acl", "get", nodeName}); err != nil {
+	if err := cmd.Execute([]string{"acl", "get", deviceName}); err != nil {
 		t.Fatalf("%v, output: %v, error: %v", err)
 	}
 	if expected, got := strings.TrimSpace(`
@@ -78,10 +78,10 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	// Some tests to validate parse.
-	if err := cmd.Execute([]string{"acl", "set", nodeName}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName}); err == nil {
 		t.Fatalf("failed to correctly detect insufficient parameters")
 	}
 	if expected, got := "ERROR: set: incorrect number of arguments 1, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -90,7 +90,7 @@
 
 	stderr.Reset()
 	stdout.Reset()
-	if err := cmd.Execute([]string{"acl", "set", nodeName, "foo"}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName, "foo"}); err == nil {
 		t.Fatalf("failed to correctly detect insufficient parameters")
 	}
 	if expected, got := "ERROR: set: incorrect number of arguments 2, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -99,7 +99,7 @@
 
 	stderr.Reset()
 	stdout.Reset()
-	if err := cmd.Execute([]string{"acl", "set", nodeName, "foo", "bar", "ohno"}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName, "foo", "bar", "ohno"}); err == nil {
 		t.Fatalf("failed to correctly detect insufficient parameters")
 	}
 	if expected, got := "ERROR: set: incorrect number of arguments 4, must be 1 + 2n", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -108,7 +108,7 @@
 
 	stderr.Reset()
 	stdout.Reset()
-	if err := cmd.Execute([]string{"acl", "set", nodeName, "foo", "!"}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName, "foo", "!"}); err == nil {
 		t.Fatalf("failed to detect invalid parameter")
 	}
 	if expected, got := "ERROR: failed to parse access tags for \"foo\": empty access tag", strings.TrimSpace(stderr.String()); !strings.HasPrefix(got, expected) {
@@ -156,7 +156,7 @@
 	if err := cmd.Execute([]string{
 		"acl",
 		"set",
-		nodeName,
+		deviceName,
 		"friends/...", "Admin,Write",
 		"friends/alice", "!Admin,Write",
 		"self/...", "Admin,Write,Read",
@@ -227,10 +227,10 @@
 	},
 	})
 
-	if err := cmd.Execute([]string{"acl", "set", nodeName, "vana/bad", "Read"}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName, "vana/bad", "Read"}); err == nil {
 		t.Fatalf("GetACL RPC inside acl set command failed but error wrongly not detected")
 	}
-	if expected, got := `^ERROR: GetACL\(`+nodeName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
+	if expected, got := `^ERROR: GetACL\(`+deviceName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
 		t.Fatalf("Unexpected output from list. Got %q, regexp %q", got, expected)
 	}
 	if expected, got := "", strings.TrimSpace(stdout.String()); got != expected {
@@ -260,13 +260,13 @@
 		verror.Make(errOops, nil),
 	})
 
-	if err := cmd.Execute([]string{"acl", "set", nodeName, "friend", "Read"}); err == nil {
+	if err := cmd.Execute([]string{"acl", "set", deviceName, "friend", "Read"}); err == nil {
 		t.Fatalf("SetACL should have failed: %v", err)
 	}
 	if expected, got := "", strings.TrimSpace(stdout.String()); got != expected {
 		t.Fatalf("Unexpected output from list. Got %q, expected %q", got, expected)
 	}
-	if expected, got := `^ERROR: SetACL\(`+nodeName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
+	if expected, got := `^ERROR: SetACL\(`+deviceName+`\) failed:.*oops!`, strings.TrimSpace(stderr.String()); !regexp.MustCompile(expected).MatchString(got) {
 		t.Fatalf("Unexpected output from list. Got %q, regexp %q", got, expected)
 	}
 
diff --git a/tools/mgmt/nodex/associate_impl.go b/tools/mgmt/nodex/associate_impl.go
index 479046e..06d77c3 100644
--- a/tools/mgmt/nodex/associate_impl.go
+++ b/tools/mgmt/nodex/associate_impl.go
@@ -13,9 +13,9 @@
 	Name:     "list",
 	Short:    "Lists the account associations.",
 	Long:     "Lists all account associations.",
-	ArgsName: "<nodemanager>.",
+	ArgsName: "<devicemanager>.",
 	ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.`,
+<devicemanager> is the name of the device manager to connect to.`,
 }
 
 func runList(cmd *cmdline.Command, args []string) error {
@@ -41,9 +41,9 @@
 	Name:     "add",
 	Short:    "Add the listed blessings with the specified system account.",
 	Long:     "Add the listed blessings with the specified system account.",
-	ArgsName: "<nodemanager> <systemName> <blessing>...",
+	ArgsName: "<devicemanager> <systemName> <blessing>...",
 	ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.
+<devicemanager> is the name of the device manager to connect to.
 <systemName> is the name of an account holder on the local system.
 <blessing>.. are the blessings to associate systemAccount with.`,
 }
@@ -62,9 +62,9 @@
 	Name:     "remove",
 	Short:    "Removes system accounts associated with the listed blessings.",
 	Long:     "Removes system accounts associated with the listed blessings.",
-	ArgsName: "<nodemanager>  <blessing>...",
+	ArgsName: "<devicemanager>  <blessing>...",
 	ArgsLong: `
-<nodemanager> is the name of the node manager to connect to.
+<devicemanager> is the name of the device manager to connect to.
 <blessing>... is a list of blessings.`,
 }
 
diff --git a/tools/mgmt/nodex/impl.go b/tools/mgmt/nodex/impl.go
index 51fb0f6..1bda19b 100644
--- a/tools/mgmt/nodex/impl.go
+++ b/tools/mgmt/nodex/impl.go
@@ -15,9 +15,9 @@
 	Name:     "install",
 	Short:    "Install the given application.",
 	Long:     "Install the given application.",
-	ArgsName: "<node> <application>",
+	ArgsName: "<device> <application>",
 	ArgsLong: `
-<node> is the veyron object name of the node manager's app service.
+<device> is the veyron object name of the device manager's app service.
 <application> is the veyron object name of the application.`,
 }
 
@@ -25,12 +25,12 @@
 	if expected, got := 2, len(args); expected != got {
 		return cmd.UsageErrorf("install: incorrect number of arguments, expected %d, got %d", expected, got)
 	}
-	nodeName, appName := args[0], args[1]
-	appID, err := node.ApplicationClient(nodeName).Install(runtime.NewContext(), appName)
+	deviceName, appName := args[0], args[1]
+	appID, err := node.ApplicationClient(deviceName).Install(runtime.NewContext(), appName)
 	if err != nil {
 		return fmt.Errorf("Install failed: %v", err)
 	}
-	fmt.Fprintf(cmd.Stdout(), "Successfully installed: %q\n", naming.Join(nodeName, appID))
+	fmt.Fprintf(cmd.Stdout(), "Successfully installed: %q\n", naming.Join(deviceName, appID))
 	return nil
 }
 
@@ -76,11 +76,11 @@
 var cmdClaim = &cmdline.Command{
 	Run:      runClaim,
 	Name:     "claim",
-	Short:    "Claim the node.",
-	Long:     "Claim the node.",
-	ArgsName: "<node> <grant extension>",
+	Short:    "Claim the device.",
+	Long:     "Claim the device.",
+	ArgsName: "<device> <grant extension>",
 	ArgsLong: `
-<node> is the veyron object name of the node manager's app service.
+<device> is the veyron object name of the device manager's app service.
 
 <grant extension> is used to extend the default blessing of the
 current principal when blessing the app instance.`,
@@ -90,8 +90,8 @@
 	if expected, got := 2, len(args); expected != got {
 		return cmd.UsageErrorf("claim: incorrect number of arguments, expected %d, got %d", expected, got)
 	}
-	nodeName, grant := args[0], args[1]
-	if err := node.DeviceClient(nodeName).Claim(runtime.NewContext(), &granter{p: runtime.Principal(), extension: grant}); err != nil {
+	deviceName, grant := args[0], args[1]
+	if err := node.DeviceClient(deviceName).Claim(runtime.NewContext(), &granter{p: runtime.Principal(), extension: grant}); err != nil {
 		return fmt.Errorf("Claim failed: %v", err)
 	}
 	fmt.Fprintln(cmd.Stdout(), "Successfully claimed.")
@@ -101,9 +101,9 @@
 func root() *cmdline.Command {
 	return &cmdline.Command{
 		Name:  "nodex",
-		Short: "Tool for interacting with the veyron node manager",
+		Short: "Tool for interacting with the veyron device manager",
 		Long: `
-The nodex tool facilitates interaction with the veyron node manager.
+The nodex tool facilitates interaction with the veyron device manager.
 `,
 		Children: []*cmdline.Command{cmdInstall, cmdStart, associateRoot(), cmdClaim, cmdStop, cmdSuspend, cmdResume, aclRoot()},
 	}
diff --git a/tools/mgmt/nodex/impl_test.go b/tools/mgmt/nodex/impl_test.go
index 535fbdb..e7239d3 100644
--- a/tools/mgmt/nodex/impl_test.go
+++ b/tools/mgmt/nodex/impl_test.go
@@ -32,7 +32,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	// Test the 'list' command.
 	tape.SetResponses([]interface{}{ListAssociationResponse{
@@ -49,7 +49,7 @@
 		err: nil,
 	}})
 
-	if err := cmd.Execute([]string{"associate", "list", nodeName}); err != nil {
+	if err := cmd.Execute([]string{"associate", "list", deviceName}); err != nil {
 		t.Fatalf("%v", err)
 	}
 	if expected, got := "root/self alice_self_account\nroot/other alice_other_account", strings.TrimSpace(stdout.String()); got != expected {
@@ -62,7 +62,7 @@
 	stdout.Reset()
 
 	// Test list with bad parameters.
-	if err := cmd.Execute([]string{"associate", "list", nodeName, "hello"}); err == nil {
+	if err := cmd.Execute([]string{"associate", "list", deviceName, "hello"}); err == nil {
 		t.Fatalf("wrongly failed to receive a non-nil error.")
 	}
 	if got, expected := len(tape.Play()), 0; got != expected {
@@ -84,7 +84,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "/myapp/1")
+	deviceName := naming.JoinAddressName(endpoint.String(), "/myapp/1")
 
 	if err := cmd.Execute([]string{"add", "one"}); err == nil {
 		t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -96,7 +96,7 @@
 	stdout.Reset()
 
 	tape.SetResponses([]interface{}{nil})
-	if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/self"}); err != nil {
+	if err := cmd.Execute([]string{"associate", "add", deviceName, "alice", "root/self"}); err != nil {
 		t.Fatalf("%v", err)
 	}
 	expected := []interface{}{
@@ -109,7 +109,7 @@
 	stdout.Reset()
 
 	tape.SetResponses([]interface{}{nil})
-	if err := cmd.Execute([]string{"associate", "add", nodeName, "alice", "root/other", "root/self"}); err != nil {
+	if err := cmd.Execute([]string{"associate", "add", deviceName, "alice", "root/other", "root/self"}); err != nil {
 		t.Fatalf("%v", err)
 	}
 	expected = []interface{}{
@@ -134,7 +134,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	if err := cmd.Execute([]string{"remove", "one"}); err == nil {
 		t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -146,7 +146,7 @@
 	stdout.Reset()
 
 	tape.SetResponses([]interface{}{nil})
-	if err := cmd.Execute([]string{"associate", "remove", nodeName, "root/self"}); err != nil {
+	if err := cmd.Execute([]string{"associate", "remove", deviceName, "root/self"}); err != nil {
 		t.Fatalf("%v", err)
 	}
 	expected := []interface{}{
@@ -171,7 +171,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	if err := cmd.Execute([]string{"install", "blech"}); err == nil {
 		t.Fatalf("wrongly failed to receive a non-nil error.")
@@ -196,12 +196,12 @@
 		appId: appId,
 		err:   nil,
 	}})
-	if err := cmd.Execute([]string{"install", nodeName, "myBestApp"}); err != nil {
+	if err := cmd.Execute([]string{"install", deviceName, "myBestApp"}); err != nil {
 		t.Fatalf("%v", err)
 	}
 
 	eb := new(bytes.Buffer)
-	fmt.Fprintf(eb, "Successfully installed: %q", naming.Join(nodeName, appId))
+	fmt.Fprintf(eb, "Successfully installed: %q", naming.Join(deviceName, appId))
 	if expected, got := eb.String(), strings.TrimSpace(stdout.String()); got != expected {
 		t.Fatalf("Unexpected output from Install. Got %q, expected %q", got, expected)
 	}
@@ -227,7 +227,7 @@
 	cmd := root()
 	var stdout, stderr bytes.Buffer
 	cmd.Init(nil, &stdout, &stderr)
-	nodeName := naming.JoinAddressName(endpoint.String(), "")
+	deviceName := naming.JoinAddressName(endpoint.String(), "")
 
 	// Confirm that we correctly enforce the number of arguments.
 	if err := cmd.Execute([]string{"claim", "nope"}); err == nil {
@@ -254,8 +254,8 @@
 	tape.SetResponses([]interface{}{
 		nil,
 	})
-	if err := cmd.Execute([]string{"claim", nodeName, "grant"}); err != nil {
-		t.Fatalf("Claim(%s, %s) failed: %v", nodeName, "grant", err)
+	if err := cmd.Execute([]string{"claim", deviceName, "grant"}); err != nil {
+		t.Fatalf("Claim(%s, %s) failed: %v", deviceName, "grant", err)
 	}
 	if got, expected := len(tape.Play()), 1; got != expected {
 		t.Errorf("invalid call sequence. Got %v, want %v", got, expected)
@@ -277,7 +277,7 @@
 	tape.SetResponses([]interface{}{
 		verror.Make(errOops, nil),
 	})
-	if err := cmd.Execute([]string{"claim", nodeName, "grant"}); err == nil {
+	if err := cmd.Execute([]string{"claim", deviceName, "grant"}); err == nil {
 		t.Fatalf("claim() failed to detect error", err)
 	}
 	expected = []interface{}{
diff --git a/tools/mgmt/nodex/nodemanager_mock_test.go b/tools/mgmt/nodex/nodemanager_mock_test.go
index 82b1593..717122b 100644
--- a/tools/mgmt/nodex/nodemanager_mock_test.go
+++ b/tools/mgmt/nodex/nodemanager_mock_test.go
@@ -16,7 +16,7 @@
 	"veyron.io/veyron/veyron/profiles"
 )
 
-type mockNodeInvoker struct {
+type mockDeviceInvoker struct {
 	tape *Tape
 	t    *testing.T
 }
@@ -27,7 +27,7 @@
 	err error
 }
 
-func (mni *mockNodeInvoker) ListAssociations(ipc.ServerContext) (associations []node.Association, err error) {
+func (mni *mockDeviceInvoker) ListAssociations(ipc.ServerContext) (associations []node.Association, err error) {
 	vlog.VI(2).Infof("ListAssociations() was called")
 
 	ir := mni.tape.Record("ListAssociations")
@@ -44,7 +44,7 @@
 
 // simpleCore implements the core of all mock methods that take
 // arguments and return error.
-func (mni *mockNodeInvoker) simpleCore(callRecord interface{}, name string) error {
+func (mni *mockDeviceInvoker) simpleCore(callRecord interface{}, name string) error {
 	ri := mni.tape.Record(callRecord)
 	switch r := ri.(type) {
 	case nil:
@@ -56,21 +56,21 @@
 	return nil
 }
 
-func (mni *mockNodeInvoker) AssociateAccount(call ipc.ServerContext, identityNames []string, accountName string) error {
+func (mni *mockDeviceInvoker) AssociateAccount(call ipc.ServerContext, identityNames []string, accountName string) error {
 	return mni.simpleCore(AddAssociationStimulus{"AssociateAccount", identityNames, accountName}, "AssociateAccount")
 }
 
-func (mni *mockNodeInvoker) Claim(call ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Claim(call ipc.ServerContext) error {
 	return mni.simpleCore("Claim", "Claim")
 }
 
-func (*mockNodeInvoker) Describe(ipc.ServerContext) (node.Description, error) {
+func (*mockDeviceInvoker) Describe(ipc.ServerContext) (node.Description, error) {
 	return node.Description{}, nil
 }
-func (*mockNodeInvoker) IsRunnable(_ ipc.ServerContext, description binary.Description) (bool, error) {
+func (*mockDeviceInvoker) IsRunnable(_ ipc.ServerContext, description binary.Description) (bool, error) {
 	return false, nil
 }
-func (*mockNodeInvoker) Reset(call ipc.ServerContext, deadline uint64) error { return nil }
+func (*mockDeviceInvoker) Reset(call ipc.ServerContext, deadline uint64) error { return nil }
 
 // Mock Install
 type InstallStimulus struct {
@@ -83,26 +83,26 @@
 	err   error
 }
 
-func (mni *mockNodeInvoker) Install(call ipc.ServerContext, appName string) (string, error) {
+func (mni *mockDeviceInvoker) Install(call ipc.ServerContext, appName string) (string, error) {
 	ir := mni.tape.Record(InstallStimulus{"Install", appName})
 	r := ir.(InstallResponse)
 	return r.appId, r.err
 }
 
-func (*mockNodeInvoker) Refresh(ipc.ServerContext) error { return nil }
-func (*mockNodeInvoker) Restart(ipc.ServerContext) error { return nil }
+func (*mockDeviceInvoker) Refresh(ipc.ServerContext) error { return nil }
+func (*mockDeviceInvoker) Restart(ipc.ServerContext) error { return nil }
 
-func (mni *mockNodeInvoker) Resume(_ ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Resume(_ ipc.ServerContext) error {
 	return mni.simpleCore("Resume", "Resume")
 }
-func (i *mockNodeInvoker) Revert(call ipc.ServerContext) error { return nil }
+func (i *mockDeviceInvoker) Revert(call ipc.ServerContext) error { return nil }
 
 type StartResponse struct {
 	appIds []string
 	err    error
 }
 
-func (mni *mockNodeInvoker) Start(ipc.ServerContext) ([]string, error) {
+func (mni *mockDeviceInvoker) Start(ipc.ServerContext) ([]string, error) {
 	ir := mni.tape.Record("Start")
 	r := ir.(StartResponse)
 	return r.appIds, r.err
@@ -113,16 +113,16 @@
 	timeDelta uint32
 }
 
-func (mni *mockNodeInvoker) Stop(_ ipc.ServerContext, timeDelta uint32) error {
+func (mni *mockDeviceInvoker) Stop(_ ipc.ServerContext, timeDelta uint32) error {
 	return mni.simpleCore(StopStimulus{"Stop", timeDelta}, "Stop")
 }
 
-func (mni *mockNodeInvoker) Suspend(_ ipc.ServerContext) error {
+func (mni *mockDeviceInvoker) Suspend(_ ipc.ServerContext) error {
 	return mni.simpleCore("Suspend", "Suspend")
 }
-func (*mockNodeInvoker) Uninstall(ipc.ServerContext) error        { return nil }
-func (i *mockNodeInvoker) Update(ipc.ServerContext) error         { return nil }
-func (*mockNodeInvoker) UpdateTo(ipc.ServerContext, string) error { return nil }
+func (*mockDeviceInvoker) Uninstall(ipc.ServerContext) error        { return nil }
+func (i *mockDeviceInvoker) Update(ipc.ServerContext) error         { return nil }
+func (*mockDeviceInvoker) UpdateTo(ipc.ServerContext, string) error { return nil }
 
 // Mock ACL getting and setting
 type GetACLResponse struct {
@@ -137,11 +137,11 @@
 	etag string
 }
 
-func (mni *mockNodeInvoker) SetACL(_ ipc.ServerContext, acl access.TaggedACLMap, etag string) error {
+func (mni *mockDeviceInvoker) SetACL(_ ipc.ServerContext, acl access.TaggedACLMap, etag string) error {
 	return mni.simpleCore(SetACLStimulus{"SetACL", acl, etag}, "SetACL")
 }
 
-func (mni *mockNodeInvoker) GetACL(ipc.ServerContext) (access.TaggedACLMap, string, error) {
+func (mni *mockDeviceInvoker) GetACL(ipc.ServerContext) (access.TaggedACLMap, string, error) {
 	ir := mni.tape.Record("GetACL")
 	r := ir.(GetACLResponse)
 	return r.acl, r.etag, r.err
@@ -157,7 +157,7 @@
 }
 
 func (d *dispatcher) Lookup(suffix string) (interface{}, security.Authorizer, error) {
-	return node.DeviceServer(&mockNodeInvoker{tape: d.tape, t: d.t}), nil, nil
+	return node.DeviceServer(&mockDeviceInvoker{tape: d.tape, t: d.t}), nil, nil
 }
 
 func startServer(t *testing.T, r veyron2.Runtime, tape *Tape) (ipc.Server, naming.Endpoint, error) {
diff --git a/tools/mgmt/test.sh b/tools/mgmt/test.sh
index f253152..5cd276f 100755
--- a/tools/mgmt/test.sh
+++ b/tools/mgmt/test.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Test the node manager and related services and tools.
+# Test the device manager and related services and tools.
 
 source "${VEYRON_ROOT}/scripts/lib/shell_test.sh"
 
@@ -13,7 +13,7 @@
   APPLICATION_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/application')"
   AGENTD_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/security/agent/agentd')"
   SUIDHELPER_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/services/mgmt/suidhelper')"
-  NODEMANAGER_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/services/mgmt/node/noded')"
+  DEVICEMANAGER_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/services/mgmt/node/noded')"
   NODEX_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/mgmt/nodex')"
   NAMESPACE_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/namespace')"
   PRINCIPAL_BIN="$(shell_test::build_go_binary 'veyron.io/veyron/veyron/tools/principal')"
@@ -54,7 +54,7 @@
   build
 
   BIN_STAGING_DIR=$(shell::tmp_dir)
-  cp "${AGENTD_BIN}" "${SUIDHELPER_BIN}" "${NODEMANAGER_BIN}" "${BIN_STAGING_DIR}"
+  cp "${AGENTD_BIN}" "${SUIDHELPER_BIN}" "${DEVICEMANAGER_BIN}" "${BIN_STAGING_DIR}"
   shell_test::setup_server_test
   # Unset VEYRON_CREDENTIALS set in setup_server_test.
   export VEYRON_CREDENTIALS=
@@ -62,14 +62,14 @@
   # TODO(caprita): Expose an option to turn --single_user off, so we can run
   # test.sh by hand and exercise the code that requires root privileges.
 
-  # Install and start node manager.
+  # Install and start device manager.
   shell_test::start_server "${NMINSTALL_SCRIPT}" --single_user $(shell::tmp_dir) \
-    "${BIN_STAGING_DIR}" -- --veyron.tcp.address=127.0.0.1:0 || shell_test::fail "line ${LINENO} failed to start node manager"
+    "${BIN_STAGING_DIR}" -- --veyron.tcp.address=127.0.0.1:0 || shell_test::fail "line ${LINENO} failed to start device manager"
   # Dump nminstall's log, just to provide visibility into its steps.
   cat "${START_SERVER_LOG_FILE}"
 
   local -r NM_NAME=$(hostname)
-  # Verify that node manager is published under the expected name (hostname).
+  # Verify that device manager is published under the expected name (hostname).
   shell_test::assert_ne "$("${NAMESPACE_BIN}" glob "${NM_NAME}")" "" "${LINENO}"
 
   # Create the client principal, "alice".
@@ -79,10 +79,10 @@
   # All the commands executed henceforth will run as alice.
   export VEYRON_CREDENTIALS=./alice
 
-  # Claim the node as "alice/myworkstation".
+  # Claim the device as "alice/myworkstation".
   "${NODEX_BIN}" claim "${NM_NAME}/nm" myworkstation
 
-  # Verify the node's default blessing is as expected.
+  # Verify the device's default blessing is as expected.
   shell_test::assert_eq "$("${DEBUG_BIN}" stats read "${NM_NAME}/__debug/stats/security/principal/blessingstore" | head -1 | sed -e 's/^.*Default blessings: '//)" \
     "alice/myworkstation" "${LINENO}"
 
@@ -117,10 +117,10 @@
   shell_test::assert_eq "$("${APPLICATION_BIN}" match "${SAMPLE_APP_NAME}" test | grep Title | sed -e 's/^.*"Title": "'// | sed -e 's/",//')" \
     "BINARYD" "${LINENO}"
 
-  # Install the app on the node.
+  # Install the app on the device.
   local -r INSTALLATION_NAME=$("${NODEX_BIN}" install "${NM_NAME}/apps" "${SAMPLE_APP_NAME}" | sed -e 's/Successfully installed: "//' | sed -e 's/"//')
 
-  # Verify that the installation shows up when globbing the node manager.
+  # Verify that the installation shows up when globbing the device manager.
   shell_test::assert_eq "$("${NAMESPACE_BIN}" glob "${NM_NAME}/apps/BINARYD/*")" \
     "${INSTALLATION_NAME}" "${LINENO}"
 
@@ -128,7 +128,7 @@
   local -r INSTANCE_NAME=$("${NODEX_BIN}" start "${INSTALLATION_NAME}" myapp | sed -e 's/Successfully started: "//' | sed -e 's/"//')
   wait_for_mountentry "${NAMESPACE_BIN}" "5" "${APP_PUBLISH_NAME}"
 
-  # Verify that the instance shows up when globbing the node manager.
+  # Verify that the instance shows up when globbing the device manager.
   shell_test::assert_eq "$("${NAMESPACE_BIN}" glob "${NM_NAME}/apps/BINARYD/*/*")" "${INSTANCE_NAME}" "${LINENO}"
 
   # Verify the app's default blessing.
diff --git a/tools/mgmt/vbash b/tools/mgmt/vbash
index 9a04701..a62bd1c 100755
--- a/tools/mgmt/vbash
+++ b/tools/mgmt/vbash
@@ -58,7 +58,7 @@
 }
 
 ###############################################################################
-# Fetches binaries needed by node manager installation.
+# Fetches binaries needed by device manager installation.
 # Globals:
 #   BIN_NAMES
 #   VEYRON_ROOT