Revision e9c3d864 lib/opcodes.py
b/lib/opcodes.py | ||
---|---|---|
1379 | 1379 |
"""Generates a check for modification lists. |
1380 | 1380 |
|
1381 | 1381 |
""" |
1382 |
mod_item_fn = \ |
|
1382 |
# Old format |
|
1383 |
# TODO: Remove in version 2.8 including support in LUInstanceSetParams |
|
1384 |
old_mod_item_fn = \ |
|
1383 | 1385 |
ht.TAnd(ht.TIsLength(2), ht.TItems([ |
1384 | 1386 |
ht.TOr(ht.TElemOf(constants.DDMS_VALUES), ht.TPositiveInt), |
1385 | 1387 |
fn, |
1386 | 1388 |
])) |
1387 | 1389 |
|
1388 |
return ht.TListOf(mod_item_fn) |
|
1390 |
# New format, supporting adding/removing disks/NICs at arbitrary indices |
|
1391 |
mod_item_fn = \ |
|
1392 |
ht.TAnd(ht.TIsLength(3), ht.TItems([ |
|
1393 |
ht.TElemOf(constants.DDMS_VALUES_WITH_MODIFY), |
|
1394 |
ht.Comment("Disk index, can be negative, e.g. -1 for last disk")(ht.TInt), |
|
1395 |
fn, |
|
1396 |
])) |
|
1397 |
|
|
1398 |
return ht.TOr(ht.Comment("Recommended")(ht.TListOf(mod_item_fn)), |
|
1399 |
ht.Comment("Deprecated")(ht.TListOf(old_mod_item_fn))) |
|
1389 | 1400 |
|
1390 | 1401 |
|
1391 | 1402 |
class OpInstanceSetParams(OpCode): |
... | ... | |
1402 | 1413 |
_PForceVariant, |
1403 | 1414 |
_PIgnoreIpolicy, |
1404 | 1415 |
("nics", ht.EmptyList, _TestNicModifications, |
1405 |
"List of NIC changes. Each item is of the form ``(op, settings)``." |
|
1416 |
"List of NIC changes. Each item is of the form ``(op, index, settings)``." |
|
1417 |
" ``op`` is one of ``%s``, ``%s`` or ``%s``. ``index`` can be either -1 to" |
|
1418 |
" refer to the last position, or a zero-based index number. A deprecated" |
|
1419 |
" version of this parameter used the form ``(op, settings)``, where " |
|
1406 | 1420 |
" ``op`` can be ``%s`` to add a new NIC with the specified settings," |
1407 | 1421 |
" ``%s`` to remove the last NIC or a number to modify the settings" |
1408 | 1422 |
" of the NIC with that index." % |
1409 |
(constants.DDM_ADD, constants.DDM_REMOVE)), |
|
1423 |
(constants.DDM_ADD, constants.DDM_MODIFY, constants.DDM_REMOVE, |
|
1424 |
constants.DDM_ADD, constants.DDM_REMOVE)), |
|
1410 | 1425 |
("disks", ht.EmptyList, _TestDiskModifications, |
1411 | 1426 |
"List of disk changes. See ``nics``."), |
1412 | 1427 |
("beparams", ht.EmptyDict, ht.TDict, "Per-instance backend parameters"), |
Also available in: Unified diff