~themue/clouddocs/009-openstack

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
Title: Scaling - OpenStack
Status: In Progress

# Scaling - OpenStack

## Introduction

Whereas traditional applications required larger hardware to scale ("vertical scaling"), 
cloud-based applications typically request more, discrete hardware ("horizontal scaling"). 
If your cloud is successful, eventually you must add resources to meet the increasing 
demand.

To suit the cloud paradigm, OpenStack itself is designed to be horizontally scalable. 
Rather than switching to larger servers, you procure more servers and simply install 
identically configured services. Ideally, you scale out and load balance among groups 
of functionally identical services.

But to scale the services running on OpenStack sometimes even OpenStack itself has to
be scaled. This means nodes for computing or storage have to be added.

## Scope

**TODO**

## Nova

### Analyzis

To list the hosts and the nova-related services that run on them call

```
$ nova host-list
+------------------+-------------+----------+
| host_name        | service     | zone     |
+------------------+-------------+----------+
| devstack-grizzly | conductor   | internal |
| devstack-grizzly | compute     | nova     |
| devstack-grizzly | cert        | internal |
| devstack-grizzly | network     | internal |
| devstack-grizzly | scheduler   | internal |
| devstack-grizzly | consoleauth | internal |
+------------------+-------------+----------+
```

To get a summary of resource usage of all of the instances running on the host call

```
$ nova host-describe devstack-grizzly
+------------------+----------------------------------+-----+-----------+---------+
| HOST             | PROJECT                          | cpu | memory_mb | disk_gb |
+------------------+----------------------------------+-----+-----------+---------+
| devstack-grizzly | (total)                          | 2   | 4003      | 157     |
| devstack-grizzly | (used_now)                       | 3   | 5120      | 40      |
| devstack-grizzly | (used_max)                       | 3   | 4608      | 40      |
| devstack-grizzly | b70d90d65e464582b6b2161cf3603ced | 1   | 512       | 0       |
| devstack-grizzly | 66265572db174a7aa66eba661f58eb9e | 2   | 4096      | 40      |
+------------------+----------------------------------+-----+-----------+---------+
```

These information help you understand how this host is used.

- The `cpu` column shows the sum of the virtual CPUs for instances running on the host.
- The `memory_mb` column shows the sum of the memory (in MB) allocated to the instances 
  that run on the hosts.
- The `disk_gb` column shows the sum of the root and ephemeral disk sizes (in GB) of 
  the instances that run on the hosts.
- The `used_now` row shows the sum of the resources allocated to the instances that run 
  on the host plus the resources allocated to the virtual machine of the host itself.
- The `used_max` row shows the sum of the resources allocated to the instances that run 
  on the host.

**Note:** These values are computed by using only information about the flavors of the 
instances that run on the hosts. This command does not query the CPU usage, memory usage, 
or hard disk usage of the physical host.

Now you an retrieve the CPU, memory, I/O, and network statistics for an instance. First
list all instances.

```
$ nova list
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
| ID                                   | Name                 | Status | Task State | Power State | Networks         |
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
| 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 | myCirrosServer       | ACTIVE | None       | Running     | private=10.0.0.3 |
| 8a99547e-7385-4ad1-ae50-4ecfaaad5f42 | myInstanceFromVolume | ACTIVE | None       | Running     | private=10.0.0.4 |
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
```

Then, get diagnostic statistics:

```
$ nova diagnostics myCirrosServer
+------------------+----------------+
| Property         | Value          |
+------------------+----------------+
| vnet1_rx         | 1210744        |
| cpu0_time        | 19624610000000 |
| vda_read         | 0              |
| vda_write        | 0              |
| vda_write_req    | 0              |
| vnet1_tx         | 863734         |
| vnet1_tx_errors  | 0              |
| vnet1_rx_drop    | 0              |
| vnet1_tx_packets | 3855           |
| vnet1_tx_drop    | 0              |
| vnet1_rx_errors  | 0              |
| memory           | 2097152        |
| vnet1_rx_packets | 5485           |
| vda_read_req     | 0              |
| vda_errors       | -1             |
+------------------+----------------+
```

Finally you can get summary statistics for each tenant.

```
$ nova usage-list
Usage from 2013-06-25 to 2013-07-24:
+----------------------------------+-----------+--------------+-----------+---------------+
| Tenant ID                        | Instances | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+----------------------------------+-----------+--------------+-----------+---------------+
| b70d90d65e464582b6b2161cf3603ced | 1         | 344064.44    | 672.00    | 0.00          |
| 66265572db174a7aa66eba661f58eb9e | 3         | 671626.76    | 327.94    | 6558.86       |
+----------------------------------+-----------+--------------+-----------+---------------+
```

**TODO** How to interpret this information to know when to scale?

### Scaling

Adding compute nodes is straightforward. They are easily picked up by the existing 
installation. Simply call

```
juju add-unit nova-compute
```

## Cinder

**TODO**