def test_block_device_disks(self):
        self.env.create(release_kwargs={'version': self.env_version},
                        cluster_kwargs={
                            'mode': consts.CLUSTER_MODES.ha_compact,
                            'net_provider':
                            consts.CLUSTER_NET_PROVIDERS.neutron,
                            'net_segment_type':
                            consts.NEUTRON_SEGMENT_TYPES.vlan
                        })
        self.cluster_db = self.env.clusters[0]

        self.env.create_node(cluster_id=self.cluster_db.id,
                             roles=['cinder-block-device'])
        self.env.create_node(cluster_id=self.cluster_db.id,
                             roles=['controller'])
        serialized_for_astute = deployment_serializers.serialize(
            AstuteGraph(self.cluster_db), self.cluster_db,
            self.cluster_db.nodes)
        for node in serialized_for_astute:
            self.assertIn("node_volumes", node)
            for node_volume in node["node_volumes"]:
                if node_volume["id"] == "cinder-block-device":
                    self.assertEqual(node_volume["volumes"], [])
                else:
                    self.assertNotEqual(node_volume["volumes"], [])
Example #2
0
 def setUp(self):
     super(TestMultiNodeGroupsSerialization80, self).setUp()
     cluster = self.env.create(release_kwargs={'version': self.env_version},
                               cluster_kwargs={
                                   'net_provider':
                                   consts.CLUSTER_NET_PROVIDERS.neutron,
                                   'net_segment_type':
                                   consts.NEUTRON_SEGMENT_TYPES.vlan
                               })
     self.env.create_nodes_w_interfaces_count(
         nodes_count=3,
         if_count=2,
         roles=['controller', 'cinder'],
         pending_addition=True,
         cluster_id=cluster['id'])
     self.cluster_db = self.db.query(models.Cluster).get(cluster['id'])
     serializer_type = get_serializer_for_cluster(self.cluster_db)
     self.serializer = serializer_type(AstuteGraph(self.cluster_db))
Example #3
0
    def test_disks_attrs(self):
        self.cluster = self.env.create(
            release_kwargs={
                'version': self.env_version,
                'operating_system': consts.RELEASE_OS.ubuntu
            },
            cluster_kwargs={
                'mode': consts.CLUSTER_MODES.ha_compact,
                'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron,
                'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan
            })
        self.cluster_db = self.env.clusters[0]

        disks = [
            {
                "model": "TOSHIBA MK1002TS",
                "name": "sda",
                "disk": "sda",
                "size": 1004886016
            },
        ]
        expected_node_volumes_hash = [{
            u'name':
            u'sda',
            u'extra': [],
            u'free_space':
            330,
            u'volumes': [{
                u'type': u'boot',
                u'size': 300
            }, {
                u'mount': u'/boot',
                u'type': u'partition',
                u'file_system': u'ext2',
                u'name': u'Boot',
                u'size': 200
            }, {
                u'type': u'lvm_meta_pool',
                u'size': 64
            }, {
                u'vg': u'os',
                u'type': u'pv',
                u'lvm_meta_size': 64,
                u'size': 394
            }, {
                u'vg': u'vm',
                u'type': u'pv',
                u'lvm_meta_size': 0,
                u'size': 0
            }],
            u'type':
            u'disk',
            u'id':
            u'sda',
            u'bootable':
            True,
            u'size':
            958
        }, {
            u'_allocate_size':
            u'min',
            u'label':
            u'Base System',
            u'min_size':
            19456,
            u'volumes': [{
                u'mount': u'/',
                u'size': -3766,
                u'type': u'lv',
                u'name': u'root',
                u'file_system': u'ext4'
            }, {
                u'mount': u'swap',
                u'size': 4096,
                u'type': u'lv',
                u'name': u'swap',
                u'file_system': u'swap'
            }],
            u'type':
            u'vg',
            u'id':
            u'os'
        }, {
            u'_allocate_size':
            u'all',
            u'label':
            u'Virtual Storage',
            u'min_size':
            5120,
            u'volumes': [{
                u'mount': u'/var/lib/nova',
                u'size': 0,
                u'type': u'lv',
                u'name': u'nova',
                u'file_system': u'xfs'
            }],
            u'type':
            u'vg',
            u'id':
            u'vm'
        }]
        self.env.create_node(
            cluster_id=self.cluster_db.id,
            roles=['compute'],
            meta={"disks": disks},
        )
        serialized_for_astute = deployment_serializers.serialize(
            AstuteGraph(self.cluster_db), self.cluster_db,
            self.cluster_db.nodes)

        for node in serialized_for_astute['nodes']:
            self.assertIn("node_volumes", node)
            self.assertItemsEqual(expected_node_volumes_hash,
                                  node["node_volumes"])
Example #4
0
 def get_deployment_info(cluster, nodes):
     return deployment_serializers.serialize(AstuteGraph(cluster), cluster,
                                             nodes)
Example #5
0
 def serialize(cluster):
     return deployment_serializers.serialize(AstuteGraph(cluster), cluster,
                                             cluster.nodes)['common']
 def create_serializer(cls, cluster):
     serializer_type = get_serializer_for_cluster(cluster)
     return serializer_type(AstuteGraph(cluster))