1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
# govc.el
Interface to govc for managing VMware ESXi and vCenter.
The goal of this package is to provide a simple interface for commonly used
govc commands within Emacs. This includes table based inventory/state modes
for vms, hosts, datastores and pools. The keymap for each mode provides
shortcuts for easily feeding the data in view to other govc commands.
Within the various govc modes, press `?` to see a popup menu of options.
A menu bar is enabled for certain modes, such as `govc-vm-mode` and `govc-host-mode`.
There is also a `govc` menu at all times under the `Tools` menu.
The recommended way to install govc.el is via MELPA (http://melpa.org/).
## govc-mode
Running `govc-global-mode` creates key bindings to the various govc modes.
The default prefix is `C-c ;` and can be changed by setting `govc-keymap-prefix`.
### govc-command-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>h</kbd> | Host info via govc
<kbd>p</kbd> | Pool info via govc
<kbd>v</kbd> | VM info via govc
<kbd>s</kbd> | Datastore info via govc
### govc-urls
List of URLs for use with `govc-session`.
The `govc-session-name` displayed by `govc-mode-line` uses `url-target` (anchor)
if set, otherwise `url-host` is used.
Example:
```
(setq govc-urls `("root:vagrant@localhost:18443#Vagrant-ESXi"
"root:password@192.168.1.192#Intel-NUC"
"Administrator@vsphere.local:password!@vcva-clovervm"))
```
To enter a URL that is not in the list, prefix `universal-argument`, for example:
`C-u M-x govc-vm`
To avoid putting your credentials in a variable, you can use the
auth-source search integration.
```
(setq govc-urls `("myserver-vmware-2"))
```
And then put this line in your `auth-sources` (e.g. `~/.authinfo.gpg`):
```
machine myserver-vmware-2 login tzz password mypass url "myserver-vmware-2.some.domain.here:443?insecure=true"
```
Which will result in the URL "tzz:mypass@myserver-vmware-2.some.domain.here:443?insecure=true".
For more details on `auth-sources`, see Info node `(auth) Help for users`.
When in `govc-vm` or `govc-host` mode, a default URL is composed with the
current session credentials and the IP address of the current vm/host and
the vm/host name as the session name. This makes it easier to connect to
nested ESX/vCenter VMs or directly to an ESX host.
### govc-session-url
ESX or vCenter URL set by `govc-session` via `govc-urls` selection.
### govc-session-insecure
Skip verification of server certificate when true.
This variable is set to the value of the `GOVC_INSECURE` env var by default.
It can also be set per-url via the query string (insecure=true). For example:
```
(setq govc-urls `("root:password@hostname?insecure=true"))
```
### govc-session-datacenter
Datacenter to use for the current `govc-session`.
If the endpoint has a single Datacenter it will be used by default, otherwise
`govc-session` will prompt for selection. It can also be set per-url via the
query string. For example:
```
(setq govc-urls `("root:password@hostname?datacenter=dc1"))
```
### govc-session-datastore
Datastore to use for the current `govc-session`.
If the endpoint has a single Datastore it will be used by default, otherwise
`govc-session` will prompt for selection. It can also be set per-url via the
query string. For example:
```
(setq govc-urls `("root:password@hostname?datastore=vsanDatastore"))
```
### govc-session-network
Network to use for the current `govc-session`.
## govc-tabulated-list-mode
Generic table bindings to mark/unmark rows.
In addition to any hooks its parent mode `tabulated-list-mode` might have run,
this mode runs the hook `govc-tabulated-list-mode-hook`, as the final step
during initialization.
### govc-tabulated-list-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>m</kbd> | Mark and move to the next line
<kbd>u</kbd> | Unmark and move to the next line
<kbd>t</kbd> | Toggle mark
<kbd>U</kbd> | Unmark all
<kbd>M-&</kbd> | Shell CMD in BUFFER with current `govc-session` exported as GOVC_ env vars
<kbd>M-w</kbd> | Copy current selection or region to the kill ring
<kbd>M-E</kbd> | Export session to `process-environment` and `kill-ring`
## govc-host-mode
Major mode for handling a list of govc hosts.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-host-mode-hook`, as the final step
during initialization.
### govc-host-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>E</kbd> | Events via govc events -n `govc-max-events`
<kbd>L</kbd> | Logs via govc logs -n `govc-max-events`
<kbd>J</kbd> | JSON via govc host
<kbd>M</kbd> | Metrics info
<kbd>N</kbd> | Netstat via `govc-esxcli-netstat-info` with current host id
<kbd>O</kbd> | Object browser via govc object
<kbd>T</kbd> | Tasks via govc tasks
<kbd>c</kbd> | Connect new session for the current govc mode
<kbd>p</kbd> | Pool-mode with current session
<kbd>s</kbd> | Datastore-mode with current session
<kbd>v</kbd> | VM-mode with current session
## govc-pool-mode
Major mode for handling a list of govc pools.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-pool-mode-hook`, as the final step
during initialization.
### govc-pool-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>D</kbd> | Destroy via `govc-pool-destroy` on the pool selection
<kbd>E</kbd> | Events via govc events -n `govc-max-events`
<kbd>J</kbd> | JSON via govc pool
<kbd>M</kbd> | Metrics info
<kbd>O</kbd> | Object browser via govc object
<kbd>T</kbd> | Tasks via govc tasks
<kbd>c</kbd> | Connect new session for the current govc mode
<kbd>h</kbd> | Host-mode with current session
<kbd>s</kbd> | Datastore-mode with current session
<kbd>v</kbd> | VM-mode with current session
## govc-datastore-mode
Major mode for govc datastore.info.
In addition to any hooks its parent mode `tabulated-list-mode` might have run,
this mode runs the hook `govc-datastore-mode-hook`, as the final step
during initialization.
### govc-datastore-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>J</kbd> | JSON via govc datastore
<kbd>M</kbd> | Metrics info
<kbd>O</kbd> | Object browser via govc object
<kbd>RET</kbd> | Browse datastore
<kbd>c</kbd> | Connect new session for the current govc mode
<kbd>h</kbd> | Host-mode with current session
<kbd>p</kbd> | Pool-mode with current session
<kbd>v</kbd> | VM-mode with current session
## govc-datastore-ls-mode
Major mode govc datastore.ls.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-datastore-ls-mode-hook`, as the final step
during initialization.
### govc-datastore-ls-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>I</kbd> | Info datastore disk
<kbd>J</kbd> | JSON via govc datastore
<kbd>S</kbd> | Search via govc datastore
<kbd>D</kbd> | Delete selected datastore paths
<kbd>T</kbd> | Tail datastore FILE
<kbd>+</kbd> | Mkdir via govc datastore
<kbd>DEL</kbd> | Up to parent folder
<kbd>RET</kbd> | Open datastore folder or file
## govc-vm-mode
Major mode for handling a list of govc vms.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-vm-mode-hook`, as the final step
during initialization.
### govc-vm-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>E</kbd> | Events via govc events -n `govc-max-events`
<kbd>L</kbd> | Logs via `govc-datastore-tail` with logDirectory of current selection
<kbd>J</kbd> | JSON via govc vm
<kbd>O</kbd> | Object browser via govc object
<kbd>T</kbd> | Tasks via govc tasks
<kbd>X</kbd> | ExtraConfig via `govc-vm-extra-config` on the current selection
<kbd>RET</kbd> | Devices via `govc-device` on the current selection
<kbd>C</kbd> | Console via `govc-vm-console` on the current selection
<kbd>V</kbd> | VNC via `govc-vm-vnc` on the current selection
<kbd>D</kbd> | Destroy via `govc-vm-destroy` on the current selection
<kbd>^</kbd> | Start via `govc-vm-start` on the current selection
<kbd>!</kbd> | Shutdown via `govc-vm-shutdown` on the current selection
<kbd>@</kbd> | Reboot via `govc-vm-reboot` on the current selection
<kbd>&</kbd> | Suspend via `govc-vm-suspend` on the current selection
<kbd>H</kbd> | Host info via `govc-host` with host(s) of current selection
<kbd>M</kbd> | Metrics info
<kbd>P</kbd> | Ping VM
<kbd>S</kbd> | Datastore via `govc-datastore-ls` with datastore of current selection
<kbd>c</kbd> | Connect new session for the current govc mode
<kbd>h</kbd> | Host-mode with current session
<kbd>p</kbd> | Pool-mode with current session
<kbd>s</kbd> | Datastore-mode with current session
## govc-device-mode
Major mode for handling a govc device.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-device-mode-hook`, as the final step
during initialization.
### govc-device-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>J</kbd> | JSON via govc device
<kbd>RET</kbd> | Tabulated govc device
## govc-object-mode
Major mode for handling a govc object.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-object-mode-hook`, as the final step
during initialization.
### govc-object-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>J</kbd> | JSON object selection via govc object
<kbd>N</kbd> | Next managed object reference
<kbd>O</kbd> | Object browser via govc object
<kbd>DEL</kbd> | Parent object selection if reachable, otherwise prompt with `govc-object-history`
<kbd>RET</kbd> | Expand object selection via govc object
## govc-metric-mode
Major mode for handling a govc metric.
In addition to any hooks its parent mode `govc-tabulated-list-mode` might have run,
this mode runs the hook `govc-metric-mode-hook`, as the final step
during initialization.
### govc-metric-mode-map
Keybinding | Description
---------------|------------------------------------------------------------
<kbd>RET</kbd> | Sample metrics
<kbd>P</kbd> | Plot metric sample
<kbd>s</kbd> | Select metric names
|