components/openstack/nova/patches/03-Solaris-flavors.patch
changeset 1760 353323c7bdc1
child 1944 56ac2df1785b
equal deleted inserted replaced
1759:b412ae0aa701 1760:353323c7bdc1
       
     1 In-house patch to update the default flavors for use with Solaris.
       
     2 This patch has not yet been submitted upstream.
       
     3 
       
     4 --- nova-2013.1.4/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py.orig	2014-02-11 08:54:04.148157965 -0700
       
     5 +++ nova-2013.1.4/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py	2014-02-11 08:54:09.036798132 -0700
       
     6 @@ -2,6 +2,8 @@
       
     7  
       
     8  # Copyright 2012 OpenStack Foundation
       
     9  #
       
    10 +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
       
    11 +#
       
    12  #    Licensed under the Apache License, Version 2.0 (the "License"); you may
       
    13  #    not use this file except in compliance with the License. You may obtain
       
    14  #    a copy of the License at
       
    15 @@ -36,17 +38,45 @@
       
    16      return Text().with_variant(dialects.mysql.MEDIUMTEXT(), 'mysql')
       
    17  
       
    18  
       
    19 -def _populate_instance_types(instance_types_table):
       
    20 +def _populate_instance_types(instance_types_table, instance_type_extra_specs):
       
    21      default_inst_types = {
       
    22 -        'm1.tiny': dict(mem=512, vcpus=1, root_gb=0, eph_gb=0, flavid=1),
       
    23 -        'm1.small': dict(mem=2048, vcpus=1, root_gb=20, eph_gb=0, flavid=2),
       
    24 -        'm1.medium': dict(mem=4096, vcpus=2, root_gb=40, eph_gb=0, flavid=3),
       
    25 -        'm1.large': dict(mem=8192, vcpus=4, root_gb=80, eph_gb=0, flavid=4),
       
    26 -        'm1.xlarge': dict(mem=16384, vcpus=8, root_gb=160, eph_gb=0, flavid=5)
       
    27 +        'Oracle Solaris kernel zone - tiny':
       
    28 +            dict(mem=2048, vcpus=1, root_gb=10, eph_gb=0, flavid=1,
       
    29 +                 extra='solaris-kz'),
       
    30 +        'Oracle Solaris kernel zone - small':
       
    31 +            dict(mem=4096, vcpus=4, root_gb=20, eph_gb=0, flavid=2,
       
    32 +                 extra='solaris-kz'),
       
    33 +        'Oracle Solaris kernel zone - medium':
       
    34 +            dict(mem=8192, vcpus=8, root_gb=40, eph_gb=0, flavid=3,
       
    35 +                 extra='solaris-kz'),
       
    36 +        'Oracle Solaris kernel zone - large':
       
    37 +            dict(mem=16384, vcpus=16, root_gb=40, eph_gb=0, flavid=4,
       
    38 +                 extra='solaris-kz'),
       
    39 +        'Oracle Solaris kernel zone - xlarge':
       
    40 +            dict(mem=32768, vcpus=32, root_gb=80, eph_gb=0, flavid=5,
       
    41 +                 extra='solaris-kz'),
       
    42 +
       
    43 +        'Oracle Solaris non-global zone - tiny':
       
    44 +            dict(mem=2048, vcpus=1, root_gb=10, eph_gb=0, flavid=6,
       
    45 +                 extra='solaris'),
       
    46 +        'Oracle Solaris non-global zone - small':
       
    47 +            dict(mem=3072, vcpus=4, root_gb=20, eph_gb=0, flavid=7,
       
    48 +                 extra='solaris'),
       
    49 +        'Oracle Solaris non-global zone - medium':
       
    50 +            dict(mem=4096, vcpus=8, root_gb=40, eph_gb=0, flavid=8,
       
    51 +                 extra='solaris'),
       
    52 +        'Oracle Solaris non-global zone - large':
       
    53 +            dict(mem=8192, vcpus=16, root_gb=40, eph_gb=0, flavid=9,
       
    54 +                 extra='solaris'),
       
    55 +        'Oracle Solaris non-global zone - xlarge':
       
    56 +            dict(mem=16384, vcpus=32, root_gb=80, eph_gb=0, flavid=10,
       
    57 +                 extra='solaris')
       
    58          }
       
    59  
       
    60      try:
       
    61          i = instance_types_table.insert()
       
    62 +        e = instance_type_extra_specs.insert()
       
    63 +        index = 1
       
    64          for name, values in default_inst_types.iteritems():
       
    65              i.execute({'name': name, 'memory_mb': values["mem"],
       
    66                          'vcpus': values["vcpus"], 'deleted': False,
       
    67 @@ -57,6 +87,10 @@
       
    68                          'flavorid': values["flavid"],
       
    69                          'disabled': False,
       
    70                          'is_public': True})
       
    71 +            e.execute({'instance_type_id': index,
       
    72 +                       'deleted': 0, 'key': 'zonecfg:brand',
       
    73 +                       'value': values['extra']})
       
    74 +            index += 1
       
    75      except Exception:
       
    76          LOG.info(repr(instance_types_table))
       
    77          LOG.exception(_('Exception while seeding instance_types table'))
       
    78 @@ -1218,7 +1252,7 @@
       
    79                           name='instance_info_caches_instance_id_key').create()
       
    80  
       
    81      # populate initial instance types
       
    82 -    _populate_instance_types(instance_types)
       
    83 +    _populate_instance_types(instance_types, instance_type_extra_specs)
       
    84  
       
    85  
       
    86  def downgrade(migrate_engine):