Este conteúdo não está disponível no idioma selecionado.
1.5. Interacting with the CLI
Example 1.1. Entering a shell command
[RHEVM shell (connected)]# show vm RHEL6-Server
TAB key twice, similar to the bash shell.
Example 1.2. Listing and automatic completion of commands and parameters
TAB at a blank prompt to list all available commands.
[RHEVM shell (connected)]# TAB TAB
EOF clear echo history remove summary
action connect exit info shell update
add console file list show
capabilities disconnect help ping status
TAB to view the next set of available parameters for the command. For the add command, this lists all resources.
[RHEVM shell (connected)]# add TAB TAB
affinitygroup datacenter event group nic
quota label template vmpool cdrom
disk filter host permission role
storagedomain user cluster qos glustervolume
network permit snapshot tag vm
TAB also completes commands and parameters.
[RHEVM shell (connected)]# add vm TAB TAB
comment console-enabled cpu-architecture delete_protected
description disks-clone display-type io-threads
memory name os-type rng_device-source
stateless soundcard_enabled start_paused timezone
[RHEVM shell (connected)]# add vm naTAB TAB
[RHEVM shell (connected)]# add vm --name
TAB also automatically formats na to the --name parameter, including the prefix.
TAB lists them.
[RHEVM shell (connected)]# add vTAB TAB
vmpool vm
shell command or the bang (!) character.
Example 1.3. Running Linux shell commands
shell command:
[RHEVM shell (connected)]# shell ls -la
!) character:
[RHEVM shell (connected)]# !ls -la
Example 1.4. Piping CLI commands
[RHEVM shell (connected)]# list vms --show-all | grep "Example"
name : Example1
name : Example2
name : ExampleEngineering
description : An Example description
name : BestExampleVM
[RHEVM shell (connected)]# list vms --show-all > list vms --show-all > VM_List.txt
help command.
Example 1.5. Using online help for the show command
[RHEVM shell (connected)]# help show
Example 1.6. Connecting to the Manager to execute specific commands
--execute or -E parameter to connect to the Manager to execute the specific commands.
# ovirt-shell -c -l "https://[server]/ovirt-engine/api" -P [port] -u "[user@domain]" -A "[certificate]" -E "list vms;list hosts"
[RHEVM shell (connected)]# list vms
id : 9e6977f4-4351-4feb-bba0-dc7c22adec30
name : desktop-01
id : 60b12e28-7965-4296-86bf-c991aa32c2d5
name : server-01
[RHEVM shell (connected)]# list hosts
id : 3598cdb9-d21b-49bd-9491-59faff89b113
name : Gluster
id : a0c384f9-0940-4562-9c42-4ceaadf8f1f1
name : Host-01
id : 593ec966-c3ea-4bdc-84ad-5dc3f9fe64c7
name : Host-03