Revision 8d4c25f2
b/lib/bootstrap.py | ||
---|---|---|
858 | 858 |
nodes=nodes, |
859 | 859 |
instances={}, |
860 | 860 |
networks={}, |
861 |
disks={}, |
|
861 | 862 |
serial_no=1, |
862 | 863 |
ctime=now, mtime=now) |
863 | 864 |
utils.WriteFile(cfg_file, |
b/lib/objects.py | ||
---|---|---|
395 | 395 |
"nodegroups", |
396 | 396 |
"instances", |
397 | 397 |
"networks", |
398 |
"disks", |
|
398 | 399 |
"serial_no", |
399 | 400 |
] + _TIMESTAMPS |
400 | 401 |
|
401 | 402 |
def ToDict(self, _with_private=False): |
402 | 403 |
"""Custom function for top-level config data. |
403 | 404 |
|
404 |
This just replaces the list of instances, nodes and the cluster
|
|
405 |
with standard python types. |
|
405 |
This just replaces the list of nodes, instances, nodegroups,
|
|
406 |
networks, disks and the cluster with standard python types.
|
|
406 | 407 |
|
407 | 408 |
""" |
408 | 409 |
mydict = super(ConfigData, self).ToDict(_with_private=_with_private) |
409 | 410 |
mydict["cluster"] = mydict["cluster"].ToDict() |
410 |
for key in "nodes", "instances", "nodegroups", "networks": |
|
411 |
for key in "nodes", "instances", "nodegroups", "networks", "disks":
|
|
411 | 412 |
mydict[key] = outils.ContainerToDicts(mydict[key]) |
412 | 413 |
|
413 | 414 |
return mydict |
... | ... | |
425 | 426 |
obj.nodegroups = \ |
426 | 427 |
outils.ContainerFromDicts(obj.nodegroups, dict, NodeGroup) |
427 | 428 |
obj.networks = outils.ContainerFromDicts(obj.networks, dict, Network) |
429 |
obj.disks = outils.ContainerFromDicts(obj.disks, dict, Disk) |
|
428 | 430 |
return obj |
429 | 431 |
|
430 | 432 |
def HasAnyDiskOfType(self, dev_type): |
... | ... | |
465 | 467 |
self.networks = {} |
466 | 468 |
for network in self.networks.values(): |
467 | 469 |
network.UpgradeConfig() |
470 |
for disk in self.disks.values(): |
|
471 |
disk.UpgradeConfig() |
|
468 | 472 |
|
469 | 473 |
def _UpgradeEnabledDiskTemplates(self): |
470 | 474 |
"""Upgrade the cluster's enabled disk templates by inspecting the currently |
b/src/Ganeti/Objects.hs | ||
---|---|---|
744 | 744 |
, simpleField "nodegroups" [t| Container NodeGroup |] |
745 | 745 |
, simpleField "instances" [t| Container Instance |] |
746 | 746 |
, simpleField "networks" [t| Container Network |] |
747 |
, simpleField "disks" [t| Container Disk |] |
|
747 | 748 |
] |
748 | 749 |
++ timeStampFields |
749 | 750 |
++ serialFields) |
b/test/hs/Test/Ganeti/Objects.hs | ||
---|---|---|
296 | 296 |
else GenericContainer nodemap |
297 | 297 |
continsts = GenericContainer Map.empty |
298 | 298 |
networks = GenericContainer Map.empty |
299 |
disks = GenericContainer Map.empty |
|
299 | 300 |
let contgroups = GenericContainer $ Map.singleton guuid grp |
300 | 301 |
serial <- arbitrary |
301 | 302 |
-- timestamp fields |
... | ... | |
303 | 304 |
mtime <- arbitrary |
304 | 305 |
cluster <- resize 8 arbitrary |
305 | 306 |
let c = ConfigData version cluster contnodes contgroups continsts networks |
306 |
ctime mtime serial |
|
307 |
disks ctime mtime serial
|
|
307 | 308 |
return c |
308 | 309 |
|
309 | 310 |
-- | FIXME: make an even simpler base version of creating a cluster. |
Also available in: Unified diff