File: instance-reservation.rst

package info (click to toggle)
blazar 16.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,784 kB
  • sloc: python: 22,193; sh: 263; makefile: 68; xml: 1
file content (185 lines) | stat: -rw-r--r-- 10,280 bytes parent folder | download | duplicates (2)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
====================
Instance Reservation
====================

Prerequisites
-------------

The following packages should be installed:

* blazar
* blazar-nova
* python-blazarclient

1. Add hosts into the freepool
------------------------------

1. Add hosts into the Blazar freepool using the host-create command:

.. sourcecode:: console

 # Using the blazar CLI
 blazar host-create compute-1

 # Using the openstack CLI
 openstack reservation host create compute-1

..

2. Check hosts in the freepool:

.. sourcecode:: console

 # Using the blazar CLI
 blazar host-list

 # Using the openstack CLI
 openstack reservation host list

..

Result:

.. sourcecode:: console

    +----+---------------------+-------+-----------+----------+
    | id | hypervisor_hostname | vcpus | memory_mb | local_gb |
    +----+---------------------+-------+-----------+----------+
    | 1  | compute-1           |     2 |      3951 |       38 |
    +----+---------------------+-------+-----------+----------+

..

2. Create a lease
-----------------

1. Create a lease (instance reservation) using lease-create command:

.. sourcecode:: console

 # Using the blazar CLI
 blazar lease-create --reservation resource_type=virtual:instance,vcpus=1,memory_mb=1024,disk_gb=20,amount=1 --start-date "2020-07-24 20:00" --end-date "2020-08-09 21:00" lease-1

 # Using the openstack CLI
 openstack reservation lease create --reservation resource_type=virtual:instance,vcpus=1,memory_mb=1024,disk_gb=20,amount=1 --start-date "2020-07-24 20:00" --end-date "2020-08-09 21:00" lease-1

..

Result:

.. sourcecode:: console

    +---------------+--------------------------------------------------------------------------------------------------------------------------+
    | Field         | Value                                                                                                                    |
    +---------------+--------------------------------------------------------------------------------------------------------------------------+
    | action        |                                                                                                                          |
    | created_at    | 2017-07-31 07:55:59                                                                                                      |
    | end_date      | 2020-08-09T21:00:00.000000                                                                                               |
    | events        | {"status": "UNDONE", "lease_id": "becf2f3b-0177-4c0f-a7e7-0123370849a3", "event_type": "end_lease", "created_at":        |
    |               | "2017-07-31 07:55:59", "updated_at": null, "time": "2020-08-09T21:00:00.000000", "id": "0f269526-c32d-4e53-bc6b-         |
    |               | 09fb7adf4354"}                                                                                                           |
    |               | {"status": "UNDONE", "lease_id": "becf2f3b-0177-4c0f-a7e7-0123370849a3", "event_type": "start_lease", "created_at":      |
    |               | "2017-07-31 07:55:59", "updated_at": null, "time": "2020-07-24T20:00:00.000000", "id": "7dbf3904-7d23-4db3-bfbd-         |
    |               | 5cc8cb9d4d92"}                                                                                                           |
    |               | {"status": "UNDONE", "lease_id": "becf2f3b-0177-4c0f-a7e7-0123370849a3", "event_type": "before_end_lease", "created_at": |
    |               | "2017-07-31 07:55:59", "updated_at": null, "time": "2020-08-07T21:00:00.000000", "id": "f16151d4-04b4-403c-              |
    |               | b0d7-f60d3810e37e"}                                                                                                      |
    | id            | becf2f3b-0177-4c0f-a7e7-0123370849a3                                                                                     |
    | name          | lease-1                                                                                                                  |
    | project_id    | 6f6f9b596d47441294eb40f565063833                                                                                         |
    | reservations  | {"status": "pending", "memory_mb": 1024, "lease_id": "becf2f3b-0177-4c0f-a7e7-0123370849a3", "disk_gb": 20,              |
    |               | "resource_id": "061198b0-53e4-4545-9d85-405ca93a7bdf", "created_at": "2017-07-31 07:55:59", "updated_at": "2017-07-31    |
    |               | 07:55:59", "aggregate_id": 3, "server_group_id": "ba03ebb4-e55c-4da4-9d39-87e13354f3b7", "amount": 1, "affinity": null,  |
    |               | "flavor_id": "db83d6fd-c69c-4259-92cf-012db2e55a58", "id": "db83d6fd-c69c-4259-92cf-012db2e55a58", "vcpus": 1,           |
    |               | "resource_type": "virtual:instance"}                                                                                     |
    | start_date    | 2020-07-24T20:00:00.000000                                                                                               |
    | status        |                                                                                                                          |
    | status_reason |                                                                                                                          |
    | trust_id      | 65da707498914c7992ee7170647a3472                                                                                         |
    | updated_at    |                                                                                                                          |
    | user_id       |                                                                                                                          |
    +---------------+--------------------------------------------------------------------------------------------------------------------------+

..

2. Check leases:

.. sourcecode:: console

 # Using the blazar CLI
 blazar lease-list

 # Using the openstack CLI
 openstack reservation lease list

..

Result:

.. sourcecode:: console

    +--------------------------------------+---------+----------------------------+----------------------------+
    | id                                   | name    | start_date                 | end_date                   |
    +--------------------------------------+---------+----------------------------+----------------------------+
    | becf2f3b-0177-4c0f-a7e7-0123370849a3 | lease-1 | 2020-07-24T20:00:00.000000 | 2020-08-09T21:00:00.000000 |
    +--------------------------------------+---------+----------------------------+----------------------------+

..

3. Use the leased resources
---------------------------

While the reservation you created is active you can see and use the flavor of your reservation.

.. sourcecode:: console

    openstack flavor list

..

Result:

.. sourcecode:: console

    +--------------------------------------+--------------------------------------------------+-----------+------+-----------+------+-------+-------------+-----------+
    | ID                                   | Name                                             | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
    +--------------------------------------+--------------------------------------------------+-----------+------+-----------+------+-------+-------------+-----------+
    | 1                                    | m1.tiny                                          | 512       | 1    | 0         |      | 1     | 1.0         | True      |
    | 2                                    | m1.small                                         | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
    | 3                                    | m1.medium                                        | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
    | 4                                    | m1.large                                         | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
    | 5                                    | m1.xlarge                                        | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
    | c1                                   | cirros256                                        | 256       | 0    | 0         |      | 1     | 1.0         | True      |
    | d1                                   | ds512M                                           | 512       | 5    | 0         |      | 1     | 1.0         | True      |
    | d2                                   | ds1G                                             | 1024      | 10   | 0         |      | 1     | 1.0         | True      |
    | d3                                   | ds2G                                             | 2048      | 10   | 0         |      | 2     | 1.0         | True      |
    | d4                                   | ds4G                                             | 4096      | 20   | 0         |      | 4     | 1.0         | True      |
    | db83d6fd-c69c-4259-92cf-012db2e55a58 | reservation:db83d6fd-c69c-4259-92cf-012db2e55a58 | 1024      | 20   | 0         |      | 1     | 1.0         | False     |
    +--------------------------------------+--------------------------------------------------+-----------+------+-----------+------+-------+-------------+-----------+

..

1. Create a server: Please specify the flavor of the reservation.

.. sourcecode:: console

    openstack server create --flavor db83d6fd-c69c-4259-92cf-012db2e55a58 --image <image> --network <network> <server-name>

..


Affinity
--------

A lease can be created with the optional ``--affinity`` parameter. This
provides the following behavior:

* ``affinity=True``: Instances will be deployed on the same host for this
  reservation, by adding them to a server group with an affinity policy.

* ``affinity=False``: Instances will be deployed on different hosts for this
  reservation, by adding them to a server group with an anti-affinity policy.

* ``affinity=None`` (default): Instances can be deployed on any host,
  regardless of other instances in this reservation. No server group is
  created.