Revision 066f465d

b/lib/bootstrap.py
128 128
                master_netdev, file_storage_dir, candidate_pool_size,
129 129
                secondary_ip=None, vg_name=None, beparams=None,
130 130
                nicparams=None, hvparams=None, enabled_hypervisors=None,
131
                default_hypervisor=None, modify_etc_hosts=True):
131
                modify_etc_hosts=True):
132 132
  """Initialise the cluster.
133 133

  
134 134
  @type candidate_pool_size: int
......
252 252
    cluster_name=clustername.name,
253 253
    file_storage_dir=file_storage_dir,
254 254
    enabled_hypervisors=enabled_hypervisors,
255
    default_hypervisor=default_hypervisor,
256 255
    beparams={constants.PP_DEFAULT: beparams},
257 256
    nicparams={constants.PP_DEFAULT: nicparams},
258 257
    hvparams=hvparams,
b/lib/cmdlib.py
2627 2627
      "architecture": (platform.architecture()[0], platform.machine()),
2628 2628
      "name": cluster.cluster_name,
2629 2629
      "master": cluster.master_node,
2630
      "default_hypervisor": cluster.default_hypervisor,
2630
      "default_hypervisor": cluster.enabled_hypervisors[0],
2631 2631
      "enabled_hypervisors": cluster.enabled_hypervisors,
2632 2632
      "hvparams": dict([(hypervisor_name, cluster.hvparams[hypervisor_name])
2633 2633
                        for hypervisor_name in cluster.enabled_hypervisors]),
b/lib/config.py
658 658
    """Get the hypervisor type for this cluster.
659 659

  
660 660
    """
661
    return self._config_data.cluster.default_hypervisor
661
    return self._config_data.cluster.enabled_hypervisors[0]
662 662

  
663 663
  @locking.ssynchronized(_config_lock, shared=1)
664 664
  def GetHostKey(self):
b/lib/objects.py
811 811
    if self.default_bridge is not None:
812 812
      self.default_bridge = None
813 813

  
814
    # default_hypervisor is just the first enabled one in 2.1
815
    if self.default_hypervisor is not None:
816
      self.enabled_hypervisors = [self.default_hypervisor] + \
817
        [hvname for hvname in self.enabled_hypervisors
818
         if hvname != self.default_hypervisor]
819
      self.default_hypervisor = None
820

  
821

  
814 822
  def ToDict(self):
815 823
    """Custom function for cluster.
816 824

  
b/man/gnt-cluster.sgml
313 313
        The <option>--enabled-hypervisors</option> option allows you
314 314
        to set the list of hypervisors that will be enabled for
315 315
        this cluster. Instance hypervisors can only be choosen from
316
        the list of enabled hypervisors. Currently, the following
317
        hypervisors are available:
316
        the list of enabled hypervisors, and the first entry of this list
317
        will be used by default. Currently, the following hypervisors are
318
        available:
318 319
      </para>
319 320

  
320 321
      <para>
......
361 362
      </para>
362 363

  
363 364
      <para>
364
        With the <option>-t</option> option, the default hypervisor
365
        can be set. It has to be a member of the list of enabled
366
        hypervisors. If not specified, the first entry on the list of
367
        enabled hypervisors will be used by default.
368
      </para>
369

  
370
      <para>
371 365
        The <option>--backend-parameters</option> option allows you to set
372 366
        the default backend parameters for the cluster. The parameter
373 367
        format is a comma-separated list of key=value pairs with the
b/scripts/gnt-cluster
58 58
    vg_name = constants.DEFAULT_VG
59 59

  
60 60
  hvlist = opts.enabled_hypervisors
61
  if hvlist is not None:
62
    hvlist = hvlist.split(",")
63
  else:
64
    hvlist = [opts.default_hypervisor]
65

  
66
  # avoid an impossible situation
67
  if opts.default_hypervisor not in hvlist:
68
    ToStderr("The default hypervisor requested (%s) is not"
69
             " within the enabled hypervisor list (%s)" %
70
             (opts.default_hypervisor, hvlist))
71
    return 1
61
  hvlist = hvlist.split(",")
72 62

  
73 63
  hvparams = dict(opts.hvparams)
74 64
  beparams = opts.beparams
......
101 91
                        master_netdev=opts.master_netdev,
102 92
                        file_storage_dir=opts.file_storage_dir,
103 93
                        enabled_hypervisors=hvlist,
104
                        default_hypervisor=opts.default_hypervisor,
105 94
                        hvparams=hvparams,
106 95
                        beparams=beparams,
107 96
                        nicparams=nicparams,
......
578 567
                        action="store_false", default=True,),
579 568
            make_option("--enabled-hypervisors", dest="enabled_hypervisors",
580 569
                        help="Comma-separated list of hypervisors",
581
                        type="string", default=None),
582
            make_option("-t", "--default-hypervisor",
583
                        dest="default_hypervisor",
584
                        help="Default hypervisor to use for instance creation",
585
                        choices=list(constants.HYPER_TYPES),
570
                        type="string",
586 571
                        default=constants.DEFAULT_ENABLED_HYPERVISOR),
587 572
            ikv_option("-H", "--hypervisor-parameters", dest="hvparams",
588 573
                       help="Hypervisor and hypervisor options, in the"
b/test/ganeti.config_unittest.py
68 68
      volume_group_name="xenvg",
69 69
      nicparams={constants.PP_DEFAULT: constants.NICC_DEFAULTS},
70 70
      tcpudp_port_pool=set(),
71
      default_hypervisor=constants.HT_FAKE,
71
      enabled_hypervisors=[constants.HT_FAKE],
72 72
      master_node=me.name,
73 73
      master_ip="127.0.0.1",
74 74
      master_netdev=constants.DEFAULT_BRIDGE,

Also available in: Unified diff