[OpenStack Beginner’s Guide for Ubuntu 11.04] OpenStack Commands
Nova Manage commands
OpenStack provides commands for administrative tasks such as user/role management, network management etc. In all the examples we will use username as “novadmin” and project name as “proj”. All the nova-manage commands will need to be run as “root”. Either run them as root or run them under sudo.
Add a new user
nova-manage user create novaadmin
Add a user with admin privileges
nova-manage user admin novaadmin
List existing users
nova-manage user list
Delete an existing user
nova-manage user delete novaadmin
Associate a user to a specific existing project
nova-manage project add proj novaadmin
Remove a user from a specific existing project.
nova-manage project remove proj novaadmin
View access key and secret keys of particular user.
nova-manage user exports novaadmin
Add a role to a particular user. Please refer to the chapter on “Role Based Access Controls” for more details on role management
nova-manage role add novaadmin netadmin
Remove a role from a particular user
nova-manage role remove novaadmin netadmin
With the command below, you can change any or all of access key, secret key and admin role flag for a particular user.
Syntax: nova-manage user modify <username> <new access key> <new secret key> <admin flag - T or F> nova-manage user modify novaadmin mygreatnewaccesskey "" "" nova-manage user modify novaadmin "" mygreatsecretkey "" nova-manage user modify novaadmin "" "" T
Check if a particular user has a specific role or not. The role can be either local or global. The output of the command will be True or False
nova-manage role has novaadmin cloudadmin True nova-manage role has novaadmin netadmin proj False
The following commands help you create and manage projects. “nova-manage account” command is an alias to “nova-manage project” and you can use them interchangeably.
Create a project. It requires you to mention name of the project admin as well. css1 is the name of the project and user5 is the name of the project admin here.
nova-manage project create css1 user5
List the registered projects.
nova-manage project list
Download the credentials and associated file for a specific project. Please refer to the chapter on “Installation & Configuration” for more details.
nova-manage project zipfile csscorp user5 /home/user5/mysec.zip
delete an existing project
nova-manage project delete css1
Check the project wise resource allocation. The output will look like this:
nova-manage project quota css1 metadata_items: 128 gigabytes: 1000 floating_ips: 10 instances: 10 volumes: 10 cores: 20
Nova stores the data related to the projects, users, resources etc. in a database, by default in a MySQL database.
Print the current database version.
nova-manage db version
Sync the DB schema to be in sync with the current configuration.
nova-manage db sync
Instance Type Management
Nova has the concept of instance types. Each instance type is defined with certain amount of RAM and certain size of the hard disk. When an instance is launched with a particular instance type, Nova resizes the disk image to suit the instance type and allocates the RAM as defined for the instance type chosen. Nova calls instance types as ‘flavors’ and lets you add to the list of flavors. By default Nova has 5 types – m1.tiny, m1.small, m1.medium, m1.large and m1.xlarge.
List the current instance types
nova-manage flavor list m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
Define a new instance type
nova-manage flavor create m1.verytiny 256 2 20 6 0 0 0
Remove an existing instance type.
nova-manage flavor delete m1.verytiny m1.verytiny deleted
Check state of available services.
nova-manage service list server1 nova-scheduler enabled :- ) 2011-04-06 17:01:21 server1 nova-network enabled :- ) 2011-04-06 17:01:30 server1 nova-compute enabled :- ) 2011-04-06 17:01:22 server2 nova-compute enabled :- ) 2011-04-06 17:01:28
Disable a running service
nova-manage service disable <hostname> <service> nova-manage service disable server2 nova-compute nova-manage service list server1 nova-network enabled :- ) 2011-04-06 17:05:11 server1 nova-compute enabled :- ) 2011-04-06 17:05:13 server1 nova-scheduler enabled :- ) 2011-04-06 17:05:17 server2 nova-compute disabled :- ) 2011-04-06 17:05:19
Re-enable a service that is currently disabled
Syntax: nova-manage service enable <hostname> <service> nova-manage service enable server2 nova-compute nova-manage service list server1 nova-scheduler enabled :- ) 2011-04-06 17:08:23 server1 nova-network enabled :- ) 2011-04-06 17:08:22 server1 nova-compute enabled :- ) 2011-04-06 17:08:23 server2 nova-compute enabled :- ) 2011-04-06 17:08:19
Get Information about resource utlization of the OpenStack components
Syntax: nova-manage service describe_resource <hostname> nova-manage service describe_resource server1 HOST PROJECT cpu mem(mb) disk(gb) server1(total) 2 3961 224 server1(used) 1 654 30 server1 proj 2 1024 0
euca2ools provide a set of commands to communicate with the cloud. All these commands require you to authenticate and this is done by sourcing novarc file as detailed in the chapter on “Installation & Configuration”
Most of the euca2ools command line utilities work with OpenStack, just as they work with EC2 of AWS. There may be some differences due to some of the functionality that is yet to be implemented in OpenStack. Help is available for each of these commands with the switch –help.