Revision 82b948e4

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

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

  
1641 1646
#: Options provided by all commands
1642 1647
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
1643 1648

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

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

  
1316 1324
  disks = _ParseDiskSizes(_ConvertNicDiskModifications(opts.disks))
1317 1325

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

  
1363 1373

  
......
1535 1545
     DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
1536 1546
     OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT,
1537 1547
     ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT,
1538
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT],
1548
     NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT],
1539 1549
    "<instance>", "Alters the parameters of an instance"),
1540 1550
  "shutdown": (
1541 1551
    GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
b/src/Ganeti/OpCodes.hs
397 397
     , pWaitForSync
398 398
     , pOffline
399 399
     , pIpConflictsCheck
400
     , pHotplug
400 401
     ])
401 402
  , ("OpInstanceGrowDisk",
402 403
     [ pInstanceName
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
......
708 709
              simpleField "diskparams" [t| GenericContainer DiskTemplate
709 710
                                           UncheckedDict |]
710 711

  
712
-- | Whether to hotplug device.
713
pHotplug :: Field
714
pHotplug = defaultFalse "hotplug"
715

  
711 716
-- * Parameters for node resource model
712 717

  
713 718
-- | Set hypervisor states.
b/test/hs/Test/Ganeti/OpCodes.hs
265 265
          pure emptyJSObject <*> arbitrary <*> pure emptyJSObject <*>
266 266
          arbitrary <*> genMaybe genNodeNameNE <*> genMaybe genNodeNameNE <*>
267 267
          genMaybe genNameNE <*> pure emptyJSObject <*> arbitrary <*>
268
          arbitrary <*> arbitrary
268
          arbitrary <*> arbitrary <*> arbitrary
269 269
      "OP_INSTANCE_GROW_DISK" ->
270 270
        OpCodes.OpInstanceGrowDisk <$> genFQDN <*> arbitrary <*>
271 271
          arbitrary <*> arbitrary <*> arbitrary

Also available in: Unified diff