Revision 00429c48
b/snf-cyclades-app/conf/20-snf-cyclades-app-backend.conf | ||
---|---|---|
45 | 45 |
## Maximum number of NICs per Ganeti instance. This value must be less or equal |
46 | 46 |
## than 'max:nic-count' option of Ganeti's ipolicy. |
47 | 47 |
#GANETI_MAX_NICS_PER_INSTANCE = 8 |
48 |
# |
|
49 |
## The following setting defines a dictionary with key-value parameters to be |
|
50 |
## passed to each Ganeti ExtStorage provider. The setting defines a mapping |
|
51 |
## from the provider name, e.g. 'archipelago' to a dictionary with the actual |
|
52 |
## arbitrary parameters. |
|
53 |
#GANETI_DISK_PROVIDER_KWARGS = {} |
b/snf-cyclades-app/synnefo/app_settings/default/backend.py | ||
---|---|---|
45 | 45 |
# Maximum number of NICs per Ganeti instance. This value must be less or equal |
46 | 46 |
# than 'max:nic-count' option of Ganeti's ipolicy. |
47 | 47 |
GANETI_MAX_NICS_PER_INSTANCE = 8 |
48 |
|
|
49 |
# The following setting defines a dictionary with key-value parameters to be |
|
50 |
# passed to each Ganeti ExtStorage provider. The setting defines a mapping from |
|
51 |
# the provider name, e.g. 'archipelago' to a dictionary with the actual |
|
52 |
# arbitrary parameters. |
|
53 |
GANETI_DISK_PROVIDER_KWARGS = {} |
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
627 | 627 |
if provider: |
628 | 628 |
kw['disks'][0]['provider'] = provider |
629 | 629 |
kw['disks'][0]['origin'] = flavor.disk_origin |
630 |
extra_disk_params = settings.GANETI_DISK_PROVIDER_KWARGS.get(provider) |
|
631 |
if extra_disk_params is not None: |
|
632 |
kw["disks"][0].update(extra_disk_params) |
|
630 | 633 |
|
631 | 634 |
kw['nics'] = [{"name": nic.backend_uuid, |
632 | 635 |
"network": nic.network.backend_id, |
b/snf-cyclades-app/synnefo/logic/tests/servers.py | ||
---|---|---|
52 | 52 |
"password": "1234", |
53 | 53 |
"flavor": flavor, |
54 | 54 |
"image": {"id": "foo", "backend_id": "foo", "format": "diskdump", |
55 |
"checksum": "test_checksum", |
|
55 | 56 |
"metadata": "{}"}, |
56 | 57 |
"networks": [], |
57 | 58 |
"metadata": {"foo": "bar"}, |
... | ... | |
64 | 65 |
|
65 | 66 |
mfactory.IPv4SubnetFactory(network__public=True) |
66 | 67 |
mfactory.IPv6SubnetFactory(network__public=True) |
67 |
mfactory.BackendFactory() |
|
68 |
backend = mfactory.BackendFactory()
|
|
68 | 69 |
|
69 | 70 |
# error in nics |
70 | 71 |
req = deepcopy(kwargs) |
... | ... | |
82 | 83 |
for nic in vm.nics.all(): |
83 | 84 |
self.assertEqual(nic.state, "ERROR") |
84 | 85 |
|
86 |
# test ext settings: |
|
87 |
req = deepcopy(kwargs) |
|
88 |
ext_flavor = mfactory.FlavorFactory(disk_template="ext_archipelago", |
|
89 |
disk=1) |
|
90 |
req["flavor"] = ext_flavor |
|
91 |
mrapi().CreateInstance.return_value = 42 |
|
92 |
backend.disk_templates = ["ext"] |
|
93 |
backend.save() |
|
94 |
osettings = { |
|
95 |
"GANETI_DISK_PROVIDER_KWARGS": { |
|
96 |
"archipelago": { |
|
97 |
"foo": "mpaz", |
|
98 |
"lala": "lolo" |
|
99 |
} |
|
100 |
} |
|
101 |
} |
|
102 |
with mocked_quotaholder(): |
|
103 |
with override_settings(settings, **osettings): |
|
104 |
vm = servers.create(**req) |
|
105 |
name, args, kwargs = mrapi().CreateInstance.mock_calls[-1] |
|
106 |
self.assertEqual(kwargs["disks"][0], {"provider": "archipelago", |
|
107 |
"origin": "test_checksum", |
|
108 |
"foo": "mpaz", |
|
109 |
"lala": "lolo", |
|
110 |
"size": 1024}) |
|
111 |
|
|
85 | 112 |
|
86 | 113 |
@patch("synnefo.logic.rapi_pool.GanetiRapiClient") |
87 | 114 |
class ServerTest(TransactionTestCase): |
Also available in: Unified diff