Portal:Cloud VPS/Admin/Nova-manage

From Wikitech
Jump to navigation Jump to search

The nova cli command can be used to examine and alter many settings related to a particular Cloud VPS project or the entire OpenStack cluster. These commands are typically run on the cloudcontrol* hosts (e.g. cloudcontrol1003.wikimedia.org).


Credentials

  • administrative: source /root/novaenv.sh
  • novaobserver: /usr/local/bin/observerenv.sh

List all nova subcommands

$ nova help
... lots and lots of stuff ...

List floating IPs

$ nova --os-project-id project-proxy floating-ip-list
+----+----------------+--------------------------------------+-------------+------+
| Id | IP             | Server Id                            | Fixed IP    | Pool |
+----+----------------+--------------------------------------+-------------+------+
| 28 | 208.80.155.156 | 6e83879e-336a-4b01-98f8-5084b41e54b7 | 10.68.21.68 | nova |
+----+----------------+--------------------------------------+-------------+------+

Move a floating IP from one instance to another

Example and discussion here: Moving a floating IP for the Web Proxies in toolforge

Essentially, run:

$ OS_TENANT_NAME=project-proxy openstack ip floating remove 208.80.155.156 <current instance UUID>
$ OS_TENANT_NAME=project-proxy openstack ip floating add 208.80.155.156 9930528e-c824-48e0-932e-862ffe582412

You do really should remove the ip from its prior instance. The backend system may not take care of that automatically per phab:T143639#3116120.

Add an IP to the pool

$ nova ???

Manage project quotas

nova help quota-show
nova help quota-update

List current quotas for a project

$ openstack quota show tools
+----------------------+---------+
| Field                | Value   |
+----------------------+---------+
| cores                | 625     |
| fixed-ips            | 200     |
| floating-ips         | 60      |
| injected-file-size   | 10240   |
| injected-files       | 5       |
| injected-path-size   | 255     |
| instances            | 158     |
| key-pairs            | 100     |
| network              | 10      |
| port                 | 256     |
| project              | tools   |
| properties           | 128     |
| ram                  | 1312500 |
| rbac_policy          | 10      |
| router               | 10      |
| secgroup-rules       | 200     |
| secgroups            | 40      |
| server_group_members | 10      |
| server_groups        | 10      |
| subnet               | 10      |
| subnetpool           | -1      |
+----------------------+---------+
$ neutron quota-show --tenant-id tools
+---------------------+-------+
| Field               | Value |
+---------------------+-------+
| floatingip          | 0     |
| network             | 10    |
| port                | 50    |
| rbac_policy         | 10    |
| router              | 10    |
| security_group      | 40    |
| security_group_rule | 100   |
| subnet              | 10    |
| subnetpool          | -1    |
+---------------------+-------+

Change a quota for a project

CPU, RAM, etc

$ openstack quota set --help
...
optional arguments:
  -h, --help            show this help message and exit
  --class               Set quotas for <class>
  --properties <properties>
                        New value for the properties quota
  --ram <ram>           New value for the ram quota
  --secgroup-rules <secgroup-rules>
                        New value for the secgroup-rules quota
  --instances <instances>
                        New value for the instances quota
  --key-pairs <key-pairs>
                        New value for the key-pairs quota
  --fixed-ips <fixed-ips>
                        New value for the fixed-ips quota
  --secgroups <secgroups>
                        New value for the secgroups quota
  --injected-file-size <injected-file-size>
                        New value for the injected-file-size quota
  --floating-ips <floating-ips>
                        New value for the floating-ips quota
  --injected-files <injected-files>
                        New value for the injected-files quota
  --cores <cores>       New value for the cores quota
  --injected-path-size <injected-path-size>
                        New value for the injected-path-size quota
  --gigabytes <gigabytes>
                        New value for the gigabytes quota
  --volumes <volumes>   New value for the volumes quota
  --snapshots <snapshots>
                        New value for the snapshots quota
  --volume-type <volume-type>
                        Set quotas for a specific <volume-type>
$ openstack quota set --cores 16 --ram 32768 visualeditor

Floating ips

$ neutron quota-update --tenant-id tools --floatingip 60
+---------------------+-------+
| Field               | Value |
+---------------------+-------+
| floatingip          | 60    |
| network             | 10    |
| port                | 50    |
| rbac_policy         | 10    |
| router              | 10    |
| security_group      | 40    |
| security_group_rule | 100   |
| subnet              | 10    |
| subnetpool          | -1    |
+---------------------+-------+
$ nova quota-update --floating_ips 1 iiab