예제 #1
0
    def call_generator(self, generator, *args):
        generators = {
            # Calculate swap space based on total RAM
            'calc_swap_size': self._calc_swap_size,
            # 15G <= root <= 50G
            'calc_root_size': self._calc_root_size,
            # boot = 200MB
            'calc_boot_size': lambda: 500,
            # boot records size = 300MB
            'calc_boot_records_size': lambda: 300,
            # let's think that size of mbr is 10MB
            'calc_mbr_size': lambda: 10,
            # lvm meta = 64MB for one volume group
            'calc_lvm_meta_size': lambda: 64,
            'calc_total_vg': self._calc_total_vg,
            # virtual storage = 5GB
            'calc_min_vm_size': lambda: gb_to_mb(5),
            'calc_min_glance_size': lambda: gb_to_mb(5),
            'calc_min_cinder_size': lambda: gb_to_mb(1.5),
            'calc_min_mongo_size': lambda: gb_to_mb(10),
            'calc_total_root_vg': self._calc_total_root_vg,
            # 2GB reuquired for journal, leave 1GB for data
            'calc_min_ceph_size': lambda: gb_to_mb(3),
            'calc_min_ceph_journal_size': lambda: 0,
            'calc_min_mysql_size': lambda: gb_to_mb(10),
            'calc_min_soft_size': lambda: gb_to_mb(10)
        }

        generators['calc_os_size'] = \
            lambda: generators['calc_root_size']() + \
            generators['calc_swap_size']()

        generators['calc_os_vg_size'] = generators['calc_os_size']
        generators['calc_min_os_size'] = generators['calc_os_size']

        if generator not in generators:
            raise errors.CannotFindGenerator(
                u'Cannot find generator %s' % generator)

        result = generators[generator](*args)
        self.__logger('Generator %s with args %s returned result: %s' %
                      (generator, args, result))
        return result
예제 #2
0
파일: manager.py 프로젝트: mahak/fuelweb
    def call_generator(self, generator, *args):
        generators = {
            # Calculate swap space based on total RAM
            'calc_swap_size': self._calc_swap_size,
            # root = 10GB
            'calc_root_size': lambda: gb_to_mb(10),
            # boot = 200MB
            'calc_boot_size': lambda: 200,
            # boot records size = 300MB
            'calc_boot_records_size': lambda: 300,
            # let's think that size of mbr is 10MB
            'calc_mbr_size': lambda: 10,
            # lvm meta = 64MB for one volume group
            'calc_lvm_meta_size': lambda: 64,
            'calc_total_vg': self._calc_total_vg,
            # virtual storage = 5GB
            'calc_min_vm_size': lambda: gb_to_mb(5),
            'calc_min_glance_size': lambda: gb_to_mb(5),
            'calc_min_cinder_size': lambda: gb_to_mb(1.5),
            'calc_total_root_vg': self._calc_total_root_vg
        }

        generators['calc_os_size'] = \
            lambda: generators['calc_root_size']() + \
            generators['calc_swap_size']()

        generators['calc_os_vg_size'] = generators['calc_os_size']
        generators['calc_min_os_size'] = generators['calc_os_size']

        if not generator in generators:
            raise errors.CannotFindGenerator(u'Cannot find generator %s' %
                                             generator)

        result = generators[generator](*args)
        self.__logger('Generator %s with args %s returned result: %s' %
                      (generator, args, result))
        return result