Basic Commands - meridor/perspective-backend GitHub Wiki
Placeholders
A placeholder is a notation starting with dollar sign like $name
or $date
similar to how you declare variables in PHP or Bash. Placeholders are mostly used in bulk operations. For example you would like to create instance snapshots based on instance name:
my-instance-1 -> my-instance1_image
my-instance-2 -> my-instance2_image
In that case you can do bulk operation like that:
perspective> add images --name $name_image --instances my-instance-[12]
This works because in $name_image
expression $name
will be replaced by real instance name for each processed instance.
Projects Commands
Show projects
Shows a list of available projects. Can optionally filter projects by name.
perspective> show projects
perspective> show projects --name one,two,three
Show flavors
Shows available flavors optionally filtering by name, project name or cloud.
perspective> show flavors
perspective> show flavors --project test
Show keypairs
Shows available keypairs optionally filtering by name, project name or cloud.
perspective> show keypairs
perspective> show flavors --name my-keypair
Show networks
Shows available networks optionally filtering by name, project name or cloud.
perspective> show networks
perspective> show networks --name my-keypair
Instances Commands
Add instances
Adds one or more instances. Without arguments launches a step-by-step wizard:
perspective> add instances
This wizard will ask you some questions about instance name, flavor, network configuration or image and then generate respective arguments. You can also specify arguments manually:
perspective> add instances --project test-project --name my-vm-$number --flavor m1.small --image ^ubuntu-14.04$ --network ^my-network$ --range 1,3-5,7
This command will create 5 instances by replacing $number
with 1, 3, 4, 5 and 7 respectively.
Show instances
Lists instances optionally filtering by name, state, flavor, image or project.
perspective> show instances
perspective> show instances --state error
perspective> show instances --name one,two --project test
perspective> show instances --image my-img --flavor m1.test
Show console
Shows instance console if such information is available.
perspective> show console vm-one,vm-two,test.*
An example console is shown below: /img/console.png
Reboot
Reboots instance.
perspective> reboot test-instance,one-more-instance
Hard Reboot
Hard-reboots (resets) instance.
perspective> hard-reboot test-instance,one-more-instance
perspective> reboot my-vm --hard
Shutdown
Shuts instance down. The same as doing ACPI shutdown. In some clouds tries normal shutdown and after timeout does power off.
perspective> shutdown test-instance,one-more-instance
Start
Starts previously shutdown instance.
perspective> start test-instance,one-more-instance
Pause
Pauses instance. Instance memory is still stored in hypervisor RAM.
perspective> pause test-instance,one-more-instance
Suspend
Suspends (hibernates) instance. Instance memory is copied to disk.
perspective> suspend test-instance,one-more-instance
Resume
Activates previously suspended or paused instance.
perspective> resume test-instance,one-more-instance
Rebuild
Rebuilds instance, i.e. changes its image without recreating VM. Without arguments launches respective wizard:
perspective> rebuild
Manually typed command is like the following:
perspective> rebuild --project test-project --instances test-instance,one-more-instance --image new-image
Resize
Resize instance, i.e. modifies its flavor: number of VCPUS, memory and disk size. Without arguments launches respective wizard:
perspective> resize
Manually typed command is like the following:
perspective> resize --project test-project --instances test-instance,one-more-instance --flavor new-flavor
Rename
Change instance name. For some clouds this can lead to automatic hostname change. You may want to use $name
or $date
placeholders to consider current instance name or date in new name.
perspective> rename --instances test-instance,one-more-instance --name $name-new
Delete instances
Completely deletes one or more instances.
perspective> delete instances my-vm-[123]
Images Commands
Add images
Adds one or more images. Without arguments launches a step-by-step wizard similar to add instances
command:
perspective> add images
You can also specify arguments manually:
perspective> add images --name $name-$date --instances test-.*
In this command $name
placeholder will be replaced by instance name and $date
by current date formatted using date_format
setting.
Show images
Lists images optionally filtering by name, state or cloud.
perspective> show images --name my-image,one-more-image
perspective> show images --state saving
Delete images
Deletes one or more images.
perspective> delete images my-cool-image-.*,test-img-2
Misc Commands
Show settings
Shows a list of available settings.
perspective> show settings
perspective> show settings --all
Show filters
Shows a list of available filters.
perspective> show filters
perspective> show filters --all
Show mail
Shows a list of incoming letters.
perspective> show mail
Set
Sets value for filter or setting. Value can optionally contain multiple comma separated strings.
perspective> set some_name = value1,value2,value3
Unset
Unsets previously set value for filter or setting.
perspective> unset some_name
Help
Shows help information for specified command or a list of available commands.
perspective> help
perspective> help show projects
Version
Shows shell version.
perspective> version