components/openstack/nova/patches/03-Solaris-flavors.patch
author saurabh.vyas@oracle.com
Fri, 08 May 2015 11:22:54 -0700
changeset 4264 7d52b0c22474
parent 3998 5bd484384122
child 5189 f0a856685b0e
permissions -rw-r--r--
21027466 problem in SERVICE/KEYSTONE

In-house patch to update the default flavors for use with Solaris.
This patch has not yet been submitted upstream.

--- nova-2014.2.2/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py.~1~	2014-10-16 04:52:25.000000000 -0700
+++ nova-2014.2.2/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py	2014-10-21 15:34:50.909529171 -0700
@@ -1,5 +1,7 @@
 # Copyright 2012 OpenStack Foundation
 #
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+#
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
 #    not use this file except in compliance with the License. You may obtain
 #    a copy of the License at
@@ -85,17 +87,45 @@ def _create_shadow_tables(migrate_engine
             raise
 
 
-def _populate_instance_types(instance_types_table):
+def _populate_instance_types(instance_types_table, instance_type_extra_specs):
     default_inst_types = {
-        'm1.tiny': dict(mem=512, vcpus=1, root_gb=1, eph_gb=0, flavid=1),
-        'm1.small': dict(mem=2048, vcpus=1, root_gb=20, eph_gb=0, flavid=2),
-        'm1.medium': dict(mem=4096, vcpus=2, root_gb=40, eph_gb=0, flavid=3),
-        'm1.large': dict(mem=8192, vcpus=4, root_gb=80, eph_gb=0, flavid=4),
-        'm1.xlarge': dict(mem=16384, vcpus=8, root_gb=160, eph_gb=0, flavid=5)
+        'Oracle Solaris kernel zone - tiny': dict(
+            mem=2048, vcpus=1, root_gb=10, eph_gb=0, flavid=1,
+            extra='solaris-kz'),
+        'Oracle Solaris kernel zone - small': dict(
+            mem=4096, vcpus=4, root_gb=20, eph_gb=0, flavid=2,
+            extra='solaris-kz'),
+        'Oracle Solaris kernel zone - medium': dict(
+            mem=8192, vcpus=8, root_gb=40, eph_gb=0, flavid=3,
+            extra='solaris-kz'),
+        'Oracle Solaris kernel zone - large': dict(
+            mem=16384, vcpus=16, root_gb=40, eph_gb=0, flavid=4,
+            extra='solaris-kz'),
+        'Oracle Solaris kernel zone - xlarge': dict(
+            mem=32768, vcpus=32, root_gb=80, eph_gb=0, flavid=5,
+            extra='solaris-kz'),
+
+        'Oracle Solaris non-global zone - tiny': dict(
+            mem=2048, vcpus=1, root_gb=10, eph_gb=0, flavid=6,
+            extra='solaris'),
+        'Oracle Solaris non-global zone - small': dict(
+            mem=3072, vcpus=4, root_gb=20, eph_gb=0, flavid=7,
+            extra='solaris'),
+        'Oracle Solaris non-global zone - medium': dict(
+            mem=4096, vcpus=8, root_gb=40, eph_gb=0, flavid=8,
+            extra='solaris'),
+        'Oracle Solaris non-global zone - large': dict(
+            mem=8192, vcpus=16, root_gb=40, eph_gb=0, flavid=9,
+            extra='solaris'),
+        'Oracle Solaris non-global zone - xlarge': dict(
+            mem=16384, vcpus=32, root_gb=80, eph_gb=0, flavid=10,
+            extra='solaris')
         }
 
     try:
         i = instance_types_table.insert()
+        e = instance_type_extra_specs.insert()
+        index = 1
         for name, values in default_inst_types.iteritems():
             i.execute({'name': name, 'memory_mb': values["mem"],
                         'vcpus': values["vcpus"], 'deleted': 0,
@@ -106,6 +136,10 @@ def _populate_instance_types(instance_ty
                         'flavorid': values["flavid"],
                         'disabled': False,
                         'is_public': True})
+            e.execute({'instance_type_id': index,
+                       'deleted': 0, 'key': 'zonecfg:brand',
+                       'value': values['extra']})
+            index += 1
     except Exception:
         LOG.info(repr(instance_types_table))
         LOG.exception(_('Exception while seeding instance_types table'))
@@ -1548,7 +1582,7 @@ def upgrade(migrate_engine):
     _create_shadow_tables(migrate_engine)
 
     # populate initial instance types
-    _populate_instance_types(instance_types)
+    _populate_instance_types(instance_types, instance_type_extra_specs)
 
     _create_dump_tables(migrate_engine)