Revision 25a8792c

b/lib/cli.py
88 88
  "NODE_PLACEMENT_OPT",
89 89
  "NOHDR_OPT",
90 90
  "NOIPCHECK_OPT",
91
  "NO_INSTALL_OPT",
91 92
  "NONAMECHECK_OPT",
92 93
  "NOLVM_STORAGE_OPT",
93 94
  "NOMODIFY_ETCHOSTS_OPT",
......
591 592
                               action="store_true", default=False,
592 593
                               help="Force an unknown variant")
593 594

  
595
NO_INSTALL_OPT = cli_option("--no-install", dest="no_install",
596
                            action="store_true", default=False,
597
                            help="Do not install the OS (will"
598
                            " enable no-start)")
599

  
594 600
BACKEND_OPT = cli_option("-B", "--backend-parameters", dest="beparams",
595 601
                         type="keyval", default={},
596 602
                         help="Backend parameters")
......
1553 1559
    os_type = opts.os
1554 1560
    src_node = None
1555 1561
    src_path = None
1562
    no_install = opts.no_install
1556 1563
  elif mode == constants.INSTANCE_IMPORT:
1557 1564
    start = False
1558 1565
    os_type = None
1559 1566
    src_node = opts.src_node
1560 1567
    src_path = opts.src_dir
1568
    no_install = None
1561 1569
  else:
1562 1570
    raise errors.ProgrammerError("Invalid creation mode %s" % mode)
1563 1571

  
......
1579 1587
                                start=start,
1580 1588
                                os_type=os_type,
1581 1589
                                src_node=src_node,
1582
                                src_path=src_path)
1590
                                src_path=src_path,
1591
                                no_install=no_install)
1583 1592

  
1584 1593
  SubmitOrSend(op, opts)
1585 1594
  return 0
b/lib/cmdlib.py
5826 5826
    # for tools
5827 5827
    if not hasattr(self.op, "name_check"):
5828 5828
      self.op.name_check = True
5829
    if not hasattr(self.op, "no_install"):
5830
      self.op.no_install = False
5831
    if self.op.no_install and self.op.start:
5832
      self.LogInfo("No-installation mode selected, disabling startup")
5833
      self.op.start = False
5829 5834
    # validate/normalize the instance name
5830 5835
    self.op.instance_name = utils.HostInfo.NormalizeName(self.op.instance_name)
5831 5836
    if self.op.ip_check and not self.op.name_check:
......
6070 6075
      # works again!
6071 6076
      self.op.force_variant = True
6072 6077

  
6078
      if self.op.no_install:
6079
        self.LogInfo("No-installation mode has no effect during import")
6080

  
6073 6081
    else: # INSTANCE_CREATE
6074 6082
      if getattr(self.op, "os_type", None) is None:
6075 6083
        raise errors.OpPrereqError("No guest OS specified",
......
6441 6449

  
6442 6450
    if iobj.disk_template != constants.DT_DISKLESS and not self.adopt_disks:
6443 6451
      if self.op.mode == constants.INSTANCE_CREATE:
6444
        feedback_fn("* running the instance OS create scripts...")
6445
        # FIXME: pass debug option from opcode to backend
6446
        result = self.rpc.call_instance_os_add(pnode_name, iobj, False,
6447
                                               self.op.debug_level)
6448
        result.Raise("Could not add os for instance %s"
6449
                     " on node %s" % (instance, pnode_name))
6452
        if not self.op.no_install:
6453
          feedback_fn("* running the instance OS create scripts...")
6454
          # FIXME: pass debug option from opcode to backend
6455
          result = self.rpc.call_instance_os_add(pnode_name, iobj, False,
6456
                                                 self.op.debug_level)
6457
          result.Raise("Could not add os for instance %s"
6458
                       " on node %s" % (instance, pnode_name))
6450 6459

  
6451 6460
      elif self.op.mode == constants.INSTANCE_IMPORT:
6452 6461
        feedback_fn("* running the instance OS import scripts...")
b/lib/opcodes.py
460 460
  OP_ID = "OP_INSTANCE_CREATE"
461 461
  OP_DSC_FIELD = "instance_name"
462 462
  __slots__ = [
463
    "instance_name", "os_type", "force_variant",
463
    "instance_name",
464
    "os_type", "force_variant", "no_install",
464 465
    "pnode", "disk_template", "snode", "mode",
465 466
    "disks", "nics",
466 467
    "src_node", "src_path", "start",
b/man/gnt-instance.sgml
85 85
          <arg>--no-ip-check</arg>
86 86
          <arg>--no-name-check</arg>
87 87
          <arg>--no-start</arg>
88
          <arg>--no-install</arg>
88 89
          <sbr>
89 90
          <group>
90 91
            <arg rep="repeat">--net=<replaceable>N</replaceable><arg rep="repeat">:options</arg></arg>
......
243 244
        <para>
244 245
          The <option>-o</option> options specifies the operating
245 246
          system to be installed. The available operating systems can
246
          be listed with <command>gnt-os list</command>.
247
          be listed with <command>gnt-os
248
          list</command>. Passing <option>--no-install</option> will
249
          however skip the OS installation, allowing a manual import
250
          if so desired. Note that the no-installation mode will
251
          automatically disable the start-up of the instance (without
252
          an OS, it most likely won't be able to start-up
253
          successfully).
247 254
        </para>
248 255

  
249 256
        <para>
b/scripts/gnt-instance
1341 1341
  NWSYNC_OPT,
1342 1342
  OS_OPT,
1343 1343
  FORCE_VARIANT_OPT,
1344
  NO_INSTALL_OPT,
1344 1345
  OS_SIZE_OPT,
1345 1346
  SUBMIT_OPT,
1346 1347
  ]

Also available in: Unified diff