Revision df58ca1c

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",
......
1641 1642
                                 default=False, action="store_true",
1642 1643
                                 help="Include default values")
1643 1644

  
1645
HOTPLUG_OPT = cli_option("--hotplug", dest="hotplug",
1646
                         action="store_true", default=False,
1647
                         help="Try to hotplug device")
1648

  
1644 1649
#: Options provided by all commands
1645 1650
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
1646 1651

  
b/lib/client/gnt_instance.py
1314 1314
                      allowed_values=[constants.VALUE_DEFAULT])
1315 1315

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

  
1317 1325
  disks = _ParseDiskSizes(_ConvertNicDiskModifications(opts.disks))
1318 1326

  
1319 1327
  if (opts.disk_template and
......
1333 1341
  op = opcodes.OpInstanceSetParams(instance_name=args[0],
1334 1342
                                   nics=nics,
1335 1343
                                   disks=disks,
1344
                                   hotplug=opts.hotplug,
1336 1345
                                   disk_template=opts.disk_template,
1337 1346
                                   remote_node=opts.node,
1338 1347
                                   pnode=opts.new_primary_node,
......
1355 1364
    ToStdout("Modified instance %s", args[0])
1356 1365
    for param, data in result:
1357 1366
      ToStdout(" - %-5s -> %s", param, data)
1358
    ToStdout("Please don't forget that most parameters take effect"
1359
             " only at the next (re)start of the instance initiated by"
1360
             " ganeti; restarting from within the instance will"
1361
             " not be enough.")
1367
    if not opts.hotplug:
1368
      ToStdout("Please don't forget that most parameters take effect"
1369
               " only at the next (re)start of the instance initiated by"
1370
               " ganeti; restarting from within the instance will"
1371
               " not be enough.")
1362 1372
  return 0
1363 1373

  
1364 1374

  
......
1540 1550
    [DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
1541 1551
     OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT,
1542 1552
     ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT,
1543
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT],
1553
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT],
1544 1554
    "<instance>", "Alters the parameters of an instance"),
1545 1555
  "shutdown": (
1546 1556
    GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
b/src/Ganeti/OpCodes.hs
657 657
     , pWaitForSync
658 658
     , withDoc "Whether to mark the instance as offline" pOffline
659 659
     , pIpConflictsCheck
660
     , pHotplug
660 661
     ],
661 662
     "instance_name")
662 663
  , ("OpInstanceGrowDisk",
b/src/Ganeti/OpParams.hs
94 94
  , pHvState
95 95
  , pDiskState
96 96
  , pIgnoreIpolicy
97
  , pHotplug
97 98
  , pAllowRuntimeChgs
98 99
  , pInstDisks
99 100
  , pDiskTemplate
......
511 512
  withDoc "Group name" $
512 513
  simpleField "group_name" [t| NonEmptyString |]
513 514

  
515
-- | Whether to hotplug device.
516
pHotplug :: Field
517
pHotplug = defaultFalse "hotplug"
518

  
514 519
pInstances :: Field
515 520
pInstances =
516 521
  withDoc "List of instances" .
b/test/hs/Test/Ganeti/OpCodes.hs
290 290
          pure emptyJSObject <*> arbitrary <*> genMaybe genNodeNameNE <*>
291 291
          return Nothing <*> genMaybe genNodeNameNE <*> return Nothing <*>
292 292
          genMaybe genNameNE <*> pure emptyJSObject <*> arbitrary <*>
293
          arbitrary <*> arbitrary
293
          arbitrary <*> arbitrary <*> arbitrary
294 294
      "OP_INSTANCE_GROW_DISK" ->
295 295
        OpCodes.OpInstanceGrowDisk <$> genFQDN <*> return Nothing <*>
296 296
          arbitrary <*> arbitrary <*> arbitrary <*> arbitrary

Also available in: Unified diff