Skip to content

Supported instance lists on aws_instance should be more easier to maintain #670

Open
@syuu1228

Description

@syuu1228

Currently, we have such code on aws_instance:

    def is_supported_instance_class(self):
        if self.instance_class() in ['i2', 'i3', 'i3en', 'c5d', 'm5d', 'm5ad', 'r5d', 'z1d', 'c6gd', 'm6gd', 'r6gd', 'x2gd', 'im4gn', 'is4gen', 'i4i', 'i4g', 'i7ie']:
            return True
        return False

    def is_dev_instance_type(self):
        if self.instancetype in ['t3.micro']:
            return True
        return False

    def get_en_interface_type(self):
        instance_class = self.instance_class()
        instance_size = self.instance_size()
        if instance_class in ['c3', 'c4', 'd2', 'i2', 'r3']:
            return 'ixgbevf'
        if instance_class in ['a1', 'c5', 'c5a', 'c5d', 'c5n', 'c6g', 'c6gd', 'f1', 'g3', 'g4', 'h1', 'i3', 'i3en', 'inf1', 'm5', 'm5a', 'm5ad', 'm5d', 'm5dn', 'm5n', 'm6g', 'm6gd', 'p2', 'p3', 'r4', 'r5', 'r5a', 'r5ad', 'r5b', 'r5d', 'r5dn', 'r5n', 't3', 't3a', 'u-6tb1', 'u-9tb1', 'u-12tb1', 'u-18tn1', 'u-24tb1', 'x1', 'x1e', 'z1d', 'c6g', 'c6gd', 'm6g', 'm6gd', 't4g', 'r6g', 'r6gd', 'x2gd', 'im4gn', 'is4gen', 'i4i', 'i4g', 'i7ie']:
            return 'ena'
        if instance_class == 'm4':
            if instance_size == '16xlarge':
                return 'ena'
            else:
                return 'ixgbevf'
        return None

This can be easy to inconsistent with aws_io_params.yaml.
I guess is_supported_instance_class() is identical as node list on aws_io_params.yaml, we can refer the yaml file not manually define the list.
We cannot do same on get_en_interface_type(), but I suppose we actually don't need this.
It is only referenced from scylla_ec2_check, and it wants to verify enhanced network is enabled or not.
To do so, we probably just need to compare NIC driver like this:

    if nic_driver == 'ena' || nic_driver == 'ixgbevf':
        en = True
   else:
       en=False
   if not en:
       print('{nic_name} doesn't supported enhanced networking!')

So we actually no need to have instance type list here.

is_dev_instance_type() is special, it should be not listed on aws_io_params.yaml so we have to keep it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions