Revision 6bce7ba2 lib/cmdlib/instance.py
b/lib/cmdlib/instance.py | ||
---|---|---|
37 | 37 |
from ganeti import netutils |
38 | 38 |
from ganeti import objects |
39 | 39 |
from ganeti import pathutils |
40 |
from ganeti import serializer |
|
40 | 41 |
import ganeti.rpc.node as rpc |
41 | 42 |
from ganeti import utils |
42 | 43 |
|
... | ... | |
847 | 848 |
if name not in self.op.osparams: |
848 | 849 |
self.op.osparams[name] = value |
849 | 850 |
|
851 |
if einfo.has_section(constants.INISECT_OSP_PRIVATE): |
|
852 |
# use the parameters, without overriding |
|
853 |
for name, value in einfo.items(constants.INISECT_OSP_PRIVATE): |
|
854 |
if name not in self.op.osparams_private: |
|
855 |
self.op.osparams_private[name] = serializer.Private(value, descr=name) |
|
856 |
|
|
850 | 857 |
def _RevertToDefaults(self, cluster): |
851 | 858 |
"""Revert the instance parameters to the default values. |
852 | 859 |
|
... | ... | |
873 | 880 |
if name in os_defs and os_defs[name] == self.op.osparams[name]: |
874 | 881 |
del self.op.osparams[name] |
875 | 882 |
|
883 |
os_defs_ = cluster.SimpleFillOS(self.op.os_type, {}, |
|
884 |
os_params_private={}) |
|
885 |
for name in self.op.osparams_private.keys(): |
|
886 |
if name in os_defs_ and os_defs_[name] == self.op.osparams_private[name]: |
|
887 |
del self.op.osparams_private[name] |
|
888 |
|
|
876 | 889 |
def _CalculateFileStorageDir(self): |
877 | 890 |
"""Calculate final instance file storage dir. |
878 | 891 |
|
... | ... | |
977 | 990 |
self.be_full = _ComputeFullBeParams(self.op, cluster) |
978 | 991 |
|
979 | 992 |
# build os parameters |
980 |
self.os_full = cluster.SimpleFillOS(self.op.os_type, self.op.osparams) |
|
993 |
if self.op.osparams_private is None: |
|
994 |
self.op.osparams_private = serializer.PrivateDict() |
|
995 |
if self.op.osparams_secret is None: |
|
996 |
self.op.osparams_secret = serializer.PrivateDict() |
|
997 |
|
|
998 |
self.os_full = cluster.SimpleFillOS( |
|
999 |
self.op.os_type, |
|
1000 |
self.op.osparams, |
|
1001 |
os_params_private=self.op.osparams_private, |
|
1002 |
os_params_secret=self.op.osparams_secret |
|
1003 |
) |
|
981 | 1004 |
|
982 | 1005 |
# now that hvp/bep are in final format, let's reset to defaults, |
983 | 1006 |
# if told to do so |
... | ... | |
1332 | 1355 |
hvparams=self.op.hvparams, |
1333 | 1356 |
hypervisor=self.op.hypervisor, |
1334 | 1357 |
osparams=self.op.osparams, |
1358 |
osparams_private=self.op.osparams_private, |
|
1335 | 1359 |
) |
1336 | 1360 |
|
1337 | 1361 |
if self.op.tags: |
... | ... | |
1428 | 1452 |
feedback_fn("* running the instance OS create scripts...") |
1429 | 1453 |
# FIXME: pass debug option from opcode to backend |
1430 | 1454 |
os_add_result = \ |
1431 |
self.rpc.call_instance_os_add(self.pnode.uuid, (iobj, None), False, |
|
1455 |
self.rpc.call_instance_os_add(self.pnode.uuid, |
|
1456 |
(iobj, self.op.osparams_secret), |
|
1457 |
False, |
|
1432 | 1458 |
self.op.debug_level) |
1433 | 1459 |
if pause_sync: |
1434 | 1460 |
feedback_fn("* resuming disk sync") |
... | ... | |
3008 | 3034 |
hvspecs) |
3009 | 3035 |
|
3010 | 3036 |
# osparams processing |
3011 |
if self.op.osparams or self.op.osparams_private_cluster:
|
|
3037 |
if self.op.osparams or self.op.osparams_private: |
|
3012 | 3038 |
public_parms = self.op.osparams or {} |
3013 |
private_parms = self.op.osparams_private_cluster or {}
|
|
3039 |
private_parms = self.op.osparams_private or {} |
|
3014 | 3040 |
dupe_keys = utils.GetRepeatedKeys(public_parms, private_parms) |
3015 | 3041 |
|
3016 | 3042 |
if dupe_keys: |
Also available in: Unified diff