Beispiel #1
0
 def _check_volumes(cls, cluster):
     try:
         for node in cluster.nodes:
             if cls._is_disk_checking_required(node):
                 VolumeManager(node).check_volume_sizes_for_deployment()
     except errors.NotEnoughFreeSpace as e:
         raise errors.NotEnoughFreeSpace(
             u"Node '{}' has insufficient disk space\n{}".format(
                 node.human_readable_name, e.message))
Beispiel #2
0
    def check_volume_sizes_for_deployment(self):
        vg_errors = []

        for volume in self.allowed_volumes:
            vg_size = self.get_total_allocated_size(volume['id'])
            min_size = self.expand_generators(volume)['min_size']
            if vg_size < min_size:
                vg_errors.append([volume['label'], min_size])

        if vg_errors:
            msgs = ["Volume group '{0}' requires a minimum of {1}MB".format(*v)
                    for v in vg_errors]
            raise errors.NotEnoughFreeSpace('\n'.join(msgs))
Beispiel #3
0
 def _check_spaces(cls, nodes, checker):
     messages = []
     for node in nodes:
         if cls._is_disk_checking_required(node):
             try:
                 checker(VolumeManager(node))
             except errors.NotEnoughFreeSpace:
                 messages.append(
                     u"Node '{}' has insufficient disk space"
                     .format(node.human_readable_name)
                 )
     if messages:
         raise errors.NotEnoughFreeSpace(u'\n'.join(messages))
Beispiel #4
0
    def check_disk_space_for_deployment(self):
        """Check disks space for minimal installation.

        This method calls in before deployment task.

        :raises: errors.NotEnoughFreeSpace
        """
        disks_space = sum([d.size for d in self.disks])
        minimal_installation_size = self.__calc_minimal_installation_size()

        self.__logger(
            'Checking disks space: disks space {0}, minimal size {1}'.format(
                disks_space, minimal_installation_size))

        if disks_space < minimal_installation_size:
            raise errors.NotEnoughFreeSpace()