old_contents: from lab.decorators import section
  from lab.cloud import CloudObject
  
  
  class CloudFlavor(CloudObject):
      TYPE_VTS = 'vts'
      FLAVOR_TYPES = {'vts': {'cmd': 'openstack flavor create {} --vcpu 2 --ram 4096 --disk 20 --public -f json', 'opt': 'openstack flavor set {} --property hw:mem_page_size=large'},
                      'old': {'cmd': 'openstack flavor create {} --vcpu 2 --ram 4096 --disk 20 --public -f json', 'opt': 'openstack flavor set {} --property hw:numa_nodes=1'}}
  
      def __init__(self, cloud, dic):
          super(CloudFlavor, self).__init__(cloud=cloud, dic=dic)
  
      @staticmethod
      @section('Creating custom flavor')
      def create(cloud, flavor_type):
  
          name = CloudObject.UNIQUE_PATTERN_IN_NAME + flavor_type + '-flavor'
          try:
              t = CloudFlavor.FLAVOR_TYPES[flavor_type]
              dic = cloud.os_cmd([t['cmd'].format(name)])[0]
              if t['opt']:
                  cloud.os_cmd([t['opt'].format(name)])
              return CloudFlavor(cloud=cloud, dic=dic)
          except KeyError:
              raise ValueError('CloudFlavor: wrong flavor "{}" possibles: {}'.format(flavor_type, CloudFlavor.FLAVOR_TYPES.keys()))
  
new_contents: from lab.decorators import section
  from lab.cloud import CloudObject
  
  
  class CloudFlavor(CloudObject):
      TYPE_VTS = 'vts'
      FLAVOR_TYPES = {'vts': {'cmd': 'openstack flavor create {} --vcpu 2 --ram 4096 --disk 20 --public -f json', 'opt': 'openstack flavor set {} --property hw:mem_page_size=large'},
                      'old': {'cmd': 'openstack flavor create {} --vcpu 2 --ram 4096 --disk 20 --public -f json', 'opt': 'openstack flavor set {} --property hw:numa_nodes=1'},
                      'm1.large': {'cmd': 'openstack flavor create {} --vcpu 4 --ram 8192 --disk 80 --public -f json'}
                      }
  
      def __init__(self, cloud, dic):
          super(CloudFlavor, self).__init__(cloud=cloud, dic=dic)
  
      @staticmethod
      @section('Creating custom flavor')
      def create(cloud, flavor_type):
  
          name = CloudObject.UNIQUE_PATTERN_IN_NAME + flavor_type + '-flavor'
          try:
              t = CloudFlavor.FLAVOR_TYPES[flavor_type]
              dic = cloud.os_cmd([t['cmd'].format(name)])[0]
              if t['opt']:
                  cloud.os_cmd([t['opt'].format(name)])
              return CloudFlavor(cloud=cloud, dic=dic)
          except KeyError:
              raise ValueError('CloudFlavor: wrong flavor "{}" possibles: {}'.format(flavor_type, CloudFlavor.FLAVOR_TYPES.keys()))
  
subject: add m1.large