Revision 411cbbf4
b/snf-tools/synnefo_tools/burnin/common.py | ||
---|---|---|
249 | 249 |
self.info("Pithos url is %s", self.clients.pithos_url) |
250 | 250 |
self.info("Image url is %s", self.clients.image_url) |
251 | 251 |
|
252 |
user_uuid = self._get_uuid() |
|
253 | 252 |
self.quotas = self._get_quotas() |
254 | 253 |
for puuid, quotas in self.quotas.items(): |
255 |
project_name = self._get_project_name(puuid, user_uuid)
|
|
254 |
project_name = self._get_project_name(puuid) |
|
256 | 255 |
self.info(" Project %s:", project_name) |
257 | 256 |
self.info(" Disk usage is %s bytes", |
258 | 257 |
quotas['cyclades.disk']['usage']) |
... | ... | |
580 | 579 |
|
581 | 580 |
# ---------------------------------- |
582 | 581 |
# Projects |
583 |
def _get_project_name(self, puuid, uuid=None):
|
|
582 |
def _get_project_name(self, puuid): |
|
584 | 583 |
"""Get the name of a project""" |
585 |
if uuid is None: |
|
586 |
uuid = self._get_uuid() |
|
584 |
uuid = self._get_uuid() |
|
587 | 585 |
if puuid == uuid: |
588 | 586 |
return "base" |
589 | 587 |
else: |
b/snf-tools/synnefo_tools/burnin/projects_tests.py | ||
---|---|---|
39 | 39 |
import random |
40 | 40 |
|
41 | 41 |
from synnefo_tools.burnin.common import Proper |
42 |
from synnefo_tools.burnin.cyclades_common import CycladesTests |
|
42 |
from synnefo_tools.burnin.cyclades_common import CycladesTests, \ |
|
43 |
QADD, QREMOVE, MB, GB, QDISK, QVM, QRAM, QCPU |
|
43 | 44 |
|
44 | 45 |
|
45 | 46 |
# pylint: disable=too-many-public-methods |
... | ... | |
69 | 70 |
# Wait for server to become active |
70 | 71 |
self._insist_on_server_transition( |
71 | 72 |
self.server, ["BUILD"], "ACTIVE") |
73 |
|
|
74 |
def test_003_assign(self): |
|
75 |
"""Re-Assign the machine to a different project""" |
|
76 |
# We will use the base project for now |
|
77 |
new_project = self._get_uuid() |
|
78 |
project_name = self._get_project_name(new_project) |
|
79 |
self.info("Assign %s to project %s", self.server['name'], project_name) |
|
80 |
|
|
81 |
# Reassign server |
|
82 |
old_project = self.server['tenant_id'] |
|
83 |
self.clients.cyclades.reassign_server(self.server['id'], new_project) |
|
84 |
|
|
85 |
# Check tenant_id |
|
86 |
self.server = self._get_server_details(self.server, quiet=True) |
|
87 |
self.assertEqual(self.server['tenant_id'], new_project) |
|
88 |
|
|
89 |
# Check new quotas |
|
90 |
flavor = self.clients.compute.get_flavor_details( |
|
91 |
self.server['flavor']['id']) |
|
92 |
changes = \ |
|
93 |
{old_project: |
|
94 |
[(QDISK, QREMOVE, flavor['disk'], GB), |
|
95 |
(QVM, QREMOVE, 1, None), |
|
96 |
(QRAM, QREMOVE, flavor['ram'], MB), |
|
97 |
(QCPU, QREMOVE, flavor['vcpus'], None)], |
|
98 |
new_project: |
|
99 |
[(QDISK, QADD, flavor['disk'], GB), |
|
100 |
(QVM, QADD, 1, None), |
|
101 |
(QRAM, QADD, flavor['ram'], MB), |
|
102 |
(QCPU, QADD, flavor['vcpus'], None)]} |
|
103 |
self._check_quotas(changes) |
|
104 |
|
|
105 |
def test_004_cleanup(self): |
|
106 |
"""Remove test server""" |
|
107 |
self._delete_servers([self.server]) |
Also available in: Unified diff