Revision 33a360ff

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

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

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

  
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/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
......
524 525
  withDoc "Group name" $
525 526
  simpleField "group_name" [t| NonEmptyString |]
526 527

  
528
-- | Whether to hotplug device.
529
pHotplug :: Field
530
pHotplug = defaultFalse "hotplug"
531

  
527 532
pInstances :: Field
528 533
pInstances =
529 534
  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