Revision 274c7cab

b/lib/cli.py
95 95
  "GLOBAL_FILEDIR_OPT",
96 96
  "HID_OS_OPT",
97 97
  "GLOBAL_SHARED_FILEDIR_OPT",
98
  "HOTPLUG_OPT",
98 99
  "HVLIST_OPT",
99 100
  "HVOPTS_OPT",
100 101
  "HYPERVISOR_OPT",
......
1645 1646
                                 default=False, action="store_true",
1646 1647
                                 help="Include default values")
1647 1648

  
1649
HOTPLUG_OPT = cli_option("--hotplug", dest="hotplug",
1650
                         action="store_true", default=False,
1651
                         help="Try to hotplug device")
1652

  
1648 1653
#: Options provided by all commands
1649 1654
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
1650 1655

  
b/lib/client/gnt_instance.py
1320 1320
                      allowed_values=[constants.VALUE_DEFAULT])
1321 1321

  
1322 1322
  nics = _ConvertNicDiskModifications(opts.nics)
1323
  for action, _, __ in nics:
1324
    if action == constants.DDM_MODIFY and opts.hotplug:
1325
      usertext = ("You are about to hot-modify a NIC. This will be done"
1326
                  " by removing the exisiting and then adding a new one."
1327
                  " Network connection might be lost. Continue?")
1328
      if not AskUser(usertext):
1329
        return 1
1330

  
1323 1331
  disks = _ParseDiskSizes(_ConvertNicDiskModifications(opts.disks))
1324 1332

  
1325 1333
  if (opts.disk_template and
......
1339 1347
  op = opcodes.OpInstanceSetParams(instance_name=args[0],
1340 1348
                                   nics=nics,
1341 1349
                                   disks=disks,
1350
                                   hotplug=opts.hotplug,
1342 1351
                                   disk_template=opts.disk_template,
1343 1352
                                   remote_node=opts.node,
1344 1353
                                   pnode=opts.new_primary_node,
......
1361 1370
    ToStdout("Modified instance %s", args[0])
1362 1371
    for param, data in result:
1363 1372
      ToStdout(" - %-5s -> %s", param, data)
1364
    ToStdout("Please don't forget that most parameters take effect"
1365
             " only at the next (re)start of the instance initiated by"
1366
             " ganeti; restarting from within the instance will"
1367
             " not be enough.")
1373
    if not opts.hotplug:
1374
      ToStdout("Please don't forget that most parameters take effect"
1375
               " only at the next (re)start of the instance initiated by"
1376
               " ganeti; restarting from within the instance will"
1377
               " not be enough.")
1368 1378
  return 0
1369 1379

  
1370 1380

  
......
1546 1556
    [DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
1547 1557
     OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT,
1548 1558
     ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT,
1549
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT],
1559
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT],
1550 1560
    "<instance>", "Alters the parameters of an instance"),
1551 1561
  "shutdown": (
1552 1562
    GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
b/lib/opcodes.py
1740 1740
     "Whether to wait for the disk to synchronize, when changing template"),
1741 1741
    ("offline", None, ht.TMaybeBool, "Whether to mark instance as offline"),
1742 1742
    ("conflicts_check", True, ht.TBool, "Check for conflicting IPs"),
1743
    ("hotplug", None, ht.TMaybeBool, "Whether to hotplug devices"),
1743 1744
    ]
1744 1745
  OP_RESULT = _TSetParamsResult
1745 1746

  

Also available in: Unified diff