Beispiel #1
0
 def _to_sizes(self, element):
     """
     Create a NodeSize object given a libcloud XML element.
     Extra information is available in nodesize.extra dictionary.
     """
     # elem_sizes = element/availabilityZoneInfo/item.
     # elem_sizes[0]  == zone and ip
     # elem_sizes[1]  == column descriptors
     # elem_sizes[2]+ == occupancy and type information.
     elem_sizes = findall(element=element,
                          xpath='availabilityZoneInfo/item',
                          namespace=NAMESPACE)[2:]
     sizes = []
     for s in elem_sizes:
         pieces = re.findall(r'\w+|!/', s[1].text)
         # expected format of pieces is
         # ['0058', '0215', '2', '4096', '10']
         # ['remaining', 'total', 'cpu', 'ram', 'disk']
         id = s[0].text.split()[1]
         size_info = {'id': id,
                      'name': id,
                      'ram': int(pieces[3]),
                      'disk': int(pieces[4]),
                      'bandwidth': 0,
                      'price': 0}
         node_size = NodeSize(driver=self, **size_info)
         node_size.extra = {'cpu': int(pieces[2]),
                            'occupancy': {'remaining': int(pieces[0]),
                                          'total': int(pieces[1])}}
         sizes.append(node_size)
     return sizes
Beispiel #2
0
    def test_create_node_idempotent(self):
        EC2MockHttp.type = 'idempotent'
        image = NodeImage(id='ami-be3adfd7',
                          name=self.image_name,
                          driver=self.driver)
        size = NodeSize('m1.small', 'Small Instance', None, None, None, None,
                        driver=self.driver)
        token = 'testclienttoken'
        node = self.driver.create_node(name='foo', image=image, size=size,
                ex_clienttoken=token)
        self.assertEqual(node.id, 'i-2ba64342')
        self.assertEqual(node.extra['clienttoken'], token)

        # from: http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?Run_Instance_Idempotency.html
        #    If you repeat the request with the same client token, but change
        #    another request parameter, Amazon EC2 returns an
        #    IdempotentParameterMismatch error.
        # In our case, changing the parameter doesn't actually matter since we
        # are forcing the error response fixture.
        EC2MockHttp.type = 'idempotent_mismatch'

        idem_error = None
        # different count
        try:
            self.driver.create_node(name='foo', image=image, size=size,
                    ex_mincount='2', ex_maxcount='2',
                    ex_clienttoken=token)
        except IdempotentParamError:
            e = sys.exc_info()[1]
            idem_error = e
        self.assertTrue(idem_error is not None)
Beispiel #3
0
    def test_ex_change_node_size(self):
        size = NodeSize('m1.large', 'Small Instance', None, None, None, None, driver=self.driver)
        node = Node('i-4382922a', None, None, None, None, self.driver,
                    extra={'instancetype': 'm1.small'})

        result = self.driver.ex_change_node_size(node=node, new_size=size)
        self.assertTrue(result)
    def setUp(self):
        ECSMockHttp.test = self
        ECSDriver.connectionCls.conn_classes = (ECSMockHttp, ECSMockHttp)
        ECSMockHttp.use_param = 'Action'
        ECSMockHttp.type = None

        self.driver = ECSDriver(*ECS_PARAMS, region=self.region)
        self.fake_size = NodeSize('ecs.t1.small', 'ecs t1 small',
                                  None, None, None, None,
                                  self.driver)
        self.fake_image = NodeImage(self.image_id, name='ubuntu 14.04 64bit',
                                    driver=self.driver)
        self.fake_node = Node(id='fake-node1', name='fake-node',
                              state=NodeState.RUNNING,
                              public_ips=None,
                              private_ips=None,
                              driver=self.driver)
        self.fake_volume = StorageVolume(id='fake-volume1', name='fake-volume',
                                         size=self.fake_size,
                                         driver=self.driver)
        self.fake_snapshot = VolumeSnapshot(id='fake-snapshot1',
                                            driver=self.driver)
        self.fake_location = NodeLocation(id=self.region, name=self.region,
                                          country=None, driver=self.driver)
        self.fake_instance_id = 'fake_instance_id'
Beispiel #5
0
    def test_create_node_invalid_disk_size(self):
        image = NodeImage(id=1,
                          name='Ubuntu 8.10 (intrepid)',
                          driver=self.driver)
        size = NodeSize(1,
                        '256 slice',
                        None,
                        None,
                        None,
                        None,
                        driver=self.driver)
        location = NodeLocation(id=1,
                                name='Europe',
                                country='England',
                                driver=self.driver)

        try:
            self.driver.create_node(name='foo',
                                    image=image,
                                    size=size,
                                    location=location)
        except ValueError:
            pass
        else:
            self.fail('Invalid disk size provided but an exception was not'
                      ' thrown')
Beispiel #6
0
    def test_create_node_and_deployment_second_node_307_response(self):
        kwargs = {
            "ex_storage_service_name": "mtlytics",
            "ex_deployment_name": "dcoddkinztest04",
            "ex_deployment_slot": "Production",
            "ex_admin_user_id": "azurecoder"
        }

        auth = NodeAuthPassword("Pa55w0rd", False)
        kwargs["auth"] = auth

        kwargs["size"] = NodeSize(id="ExtraSmall",
                                  name="ExtraSmall",
                                  ram=1024,
                                  disk="30gb",
                                  bandwidth=0,
                                  price=0,
                                  driver=self.driver)
        kwargs["image"] = NodeImage(
            id="5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-65-20140415",
            name="FakeImage",
            driver=self.driver,
            extra={'vm_image': False})
        kwargs["name"] = "dcoddkinztest04"

        with self.assertRaises(LibcloudError):
            self.driver.create_node(ex_cloud_service_name="testdcabc3",
                                    **kwargs)
Beispiel #7
0
    def test_ex_create_node_with_ex_blockdevicemappings_attribute_error(self):
        EC2MockHttp.type = 'create_ex_blockdevicemappings'

        image = NodeImage(id='ami-be3adfd7',
                          name=self.image_name,
                          driver=self.driver)
        size = NodeSize('m1.small',
                        'Small Instance',
                        None,
                        None,
                        None,
                        None,
                        driver=self.driver)

        mappings = 'this should be a list'
        self.assertRaises(AttributeError,
                          self.driver.create_node,
                          name='foo',
                          image=image,
                          size=size,
                          ex_blockdevicemappings=mappings)

        mappings = ['this should be a dict']
        self.assertRaises(AttributeError,
                          self.driver.create_node,
                          name='foo',
                          image=image,
                          size=size,
                          ex_blockdevicemappings=mappings)
Beispiel #8
0
    def _to_size(self, data):
        cpus = data['specs']['cpus'][0].get('count')
        extra = {
            'description': data['description'],
            'line': data['line'],
            'cpus': cpus
        }

        ram = data['specs']['memory']['total']
        disk = 0
        for disks in data['specs']['drives']:
            disk_size = disks['size'].replace('GB', '')
            if 'TB' in disk_size:
                disk_size = float(disks['size'].replace('TB', '')) * 1000
            disk += disks['count'] * int(disk_size)
        name = "%s - %s RAM" % (data.get('name'), ram)
        price = data['pricing'].get('hour')
        return NodeSize(id=data['slug'],
                        name=name,
                        ram=int(ram.replace('GB', '')) * 1024,
                        disk=disk,
                        bandwidth=0,
                        price=price,
                        extra=extra,
                        driver=self)
Beispiel #9
0
    def test_create_node(self):
        location = NodeLocation('any_location', '', '', self.driver)
        size = NodeSize('any_size', '', 0, 0, 0, 0, driver=self.driver)
        image = NodeImage('1', '1', self.driver)
        auth = NodeAuthPassword('any_password')

        node = self.driver.create_node('test-node-1',
                                       size,
                                       image,
                                       auth,
                                       location=location,
                                       ex_resource_group='000000',
                                       ex_storage_account='000000',
                                       ex_user_name='any_user',
                                       ex_network='000000',
                                       ex_subnet='000000',
                                       ex_use_managed_disks=True)
        hardware_profile = node.extra['properties']['hardwareProfile']
        os_profile = node.extra['properties']['osProfile']
        storage_profile = node.extra['properties']['storageProfile']

        self.assertEqual(node.name, 'test-node-1')
        self.assertEqual(node.state, NodeState.UPDATING)
        self.assertEqual(node.private_ips, ['10.0.0.1'])
        self.assertEqual(node.public_ips, [])
        self.assertEqual(node.extra['location'], location.id)
        self.assertEqual(hardware_profile['vmSize'], size.id)
        self.assertEqual(os_profile['adminUsername'], 'any_user')
        self.assertEqual(os_profile['adminPassword'], 'any_password')
        self.assertTrue('managedDisk' in storage_profile['osDisk'])
        self.assertTrue(storage_profile['imageReference'], {'id': image.id})
Beispiel #10
0
    def test_ex_create_node_with_ex_blockdevicemappings(self):
        EC2MockHttp.type = 'create_ex_blockdevicemappings'

        image = NodeImage(id='ami-be3adfd7',
                          name=self.image_name,
                          driver=self.driver)
        size = NodeSize('m1.small',
                        'Small Instance',
                        None,
                        None,
                        None,
                        None,
                        driver=self.driver)
        mappings = [{
            'DeviceName': '/dev/sda1',
            'Ebs.VolumeSize': 10
        }, {
            'DeviceName': '/dev/sdb',
            'VirtualName': 'ephemeral0'
        }, {
            'DeviceName': '/dev/sdc',
            'VirtualName': 'ephemeral1'
        }]
        node = self.driver.create_node(name='foo',
                                       image=image,
                                       size=size,
                                       ex_blockdevicemappings=mappings)
        self.assertEqual(node.id, 'i-2ba64342')
    def _to_size(self, data):
        extra = {'description': data['description'], 'line': data['line']}

        ram = data['specs'].get('memory', {}).get('total')
        if ram:
            ram = ram.lower()
            if 'mb' in ram:
                ram = int(ram.replace('mb', ''))
            elif 'gb' in ram:
                ram = int(ram.replace('gb', '')) * 1024

        disk = 0
        for disks in data['specs'].get('drives', []):
            if 'GB' in disks['size']:
                disk_size = int(disks['size'].replace('GB', ''))
            elif 'TB' in disks['size']:
                size = disks['size'].replace('TB', '')
                disk_size = (float(size) if '.' in size else int(size)) * 1024
            else:
                raise Exception('Unknown disk size metric "{}"'.format(
                    disks['size']))
            disk += disks['count'] * disk_size

        price = data['pricing']['hour']

        return NodeSize(id=data['slug'],
                        name=data['name'],
                        ram=ram,
                        disk=disk,
                        bandwidth=0,
                        price=price,
                        extra=extra,
                        driver=self)
Beispiel #12
0
    def test_create_node_with_ssh_keys(self):
        image = NodeImage(id='01000000-0000-4000-8000-000030060200',
                          name='Ubuntu Server 16.04 LTS (Xenial Xerus)',
                          extra={'type': 'template'},
                          driver=self.driver)
        location = NodeLocation(id='fi-hel1',
                                name='Helsinki #1',
                                country='FI',
                                driver=self.driver)
        size = NodeSize(id='1xCPU-1GB',
                        name='1xCPU-1GB',
                        ram=1024,
                        disk=30,
                        bandwidth=2048,
                        extra={'storage_tier': 'maxiops'},
                        price=None,
                        driver=self.driver)

        auth = NodeAuthSSHKey('publikey')
        node = self.driver.create_node(name='test_server',
                                       size=size,
                                       image=image,
                                       location=location,
                                       auth=auth)
        self.assertTrue(
            re.match(
                '^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$',
                node.id))
        self.assertEquals(node.name, 'test_server')
        self.assertEquals(node.state, NodeState.STARTING)
        self.assertTrue(len(node.public_ips) > 0)
        self.assertTrue(len(node.private_ips) > 0)
        self.assertEquals(node.driver, self.driver)
Beispiel #13
0
    def list_sizes(self, location=None):
        """
        List available Linode plans

        Gets the sizes that can be used for creating a Linode.  Since available
        Linode plans vary per-location, this method can also be passed a
        location to filter the availability.

        :keyword location: the facility to retrieve plans in
        :type    location: :class:`NodeLocation`

        :rtype: ``list`` of :class:`NodeSize`
        """
        params = {"api_action": "avail.linodeplans"}
        data = self.connection.request(API_ROOT, params=params).objects[0]
        sizes = []
        for obj in data:
            n = NodeSize(id=obj["PLANID"],
                         name=obj["LABEL"],
                         ram=obj["RAM"],
                         disk=(obj["DISK"] * 1024),
                         bandwidth=obj["XFER"],
                         price=obj["PRICE"],
                         driver=self.connection.driver)
            sizes.append(n)
        return sizes
Beispiel #14
0
    def setUp(self):
        ECSMockHttp.test = self
        ECSDriver.connectionCls.conn_class = ECSMockHttp
        ECSMockHttp.use_param = "Action"
        ECSMockHttp.type = None

        self.driver = ECSDriver(*ECS_PARAMS, region=self.region)
        self.fake_size = NodeSize(
            "ecs.t1.small", "ecs t1 small", None, None, None, None, self.driver
        )
        self.fake_image = NodeImage(
            self.image_id, name="ubuntu 14.04 64bit", driver=self.driver
        )
        self.fake_node = Node(
            id="fake-node1",
            name="fake-node",
            state=NodeState.RUNNING,
            public_ips=None,
            private_ips=None,
            driver=self.driver,
        )
        self.fake_volume = StorageVolume(
            id="fake-volume1",
            name="fake-volume",
            size=self.fake_size,
            driver=self.driver,
        )
        self.fake_snapshot = VolumeSnapshot(id="fake-snapshot1", driver=self.driver)
        self.fake_location = NodeLocation(
            id=self.region, name=self.region, country=None, driver=self.driver
        )
        self.fake_instance_id = "fake_instance_id"
        self.fake_security_group_id = "fake_security_group_id"
Beispiel #15
0
    def test_ex_create_node_with_ex_iam_profile(self):
        iamProfile = {
            'id': 'AIDGPMS9RO4H3FEXAMPLE',
            'name': 'Foo',
            'arn': 'arn:aws:iam:...'
        }

        image = NodeImage(id='ami-be3adfd7',
                          name=self.image_name,
                          driver=self.driver)
        size = NodeSize('m1.small',
                        'Small Instance',
                        None,
                        None,
                        None,
                        None,
                        driver=self.driver)

        EC2MockHttp.type = None
        node1 = self.driver.create_node(name='foo', image=image, size=size)
        EC2MockHttp.type = 'ex_iam_profile'
        node2 = self.driver.create_node(name='bar',
                                        image=image,
                                        size=size,
                                        ex_iam_profile=iamProfile['name'])
        node3 = self.driver.create_node(name='bar',
                                        image=image,
                                        size=size,
                                        ex_iam_profile=iamProfile['arn'])

        self.assertFalse(node1.extra['iam_profile'])
        self.assertEqual(node2.extra['iam_profile'], iamProfile['id'])
        self.assertEqual(node3.extra['iam_profile'], iamProfile['id'])
Beispiel #16
0
    def run(self, credentials, name, size_id, image_id, location_id=None):
        driver = self._get_driver_for_credentials(credentials=credentials)
        size = NodeSize(id=size_id,
                        name=None,
                        ram=None,
                        disk=None,
                        bandwidth=None,
                        price=None,
                        driver=driver)
        image = NodeImage(id=image_id, name=None, driver=driver)
        location = NodeLocation(id=location_id,
                                name=None,
                                country=None,
                                driver=driver)

        self.logger.info('Creating node...')

        kwargs = {'name': name, 'size': size, 'image': image}

        if location_id:
            kwargs['location'] = location

        node = driver.create_node(**kwargs)

        self.logger.info('Node successfully created: %s' % (node))
        return node
Beispiel #17
0
    def test_create_node_success(self):
        image = self.driver.list_images()[0]
        size = NodeSize(
            id=0,
            name="test",
            bandwidth=0,
            price=0,
            ram=10240,
            driver=self.driver,
            disk=50,
            extra={"cores": 2},
        )
        location = self.driver.list_locations()[0]
        sshkey = ["b1682d3a-1869-4bdc-8ffe-e74a261d300c"]
        GridscaleMockHttp.type = "POST"
        node = self.driver.create_node(
            name="test",
            size=size,
            image=image,
            location=location,
            ex_ssh_key_ids=sshkey,
        )

        self.assertEqual(node.name, "test.test")
        self.assertEqual(node.public_ips,
                         ["185.102.95.236", "2a06:2380:0:1::211"])
Beispiel #18
0
    def test_create_node(self):
        VoxelMockHttp.type = 'CREATE_NODE'
        image = NodeImage(id=1,
                          name='Ubuntu 8.10 (intrepid)',
                          driver=self.driver)
        size = NodeSize(1,
                        '256 slice',
                        1024,
                        500,
                        None,
                        None,
                        driver=self.driver)
        location = NodeLocation(id=1,
                                name='Europe',
                                country='England',
                                driver=self.driver)

        node = self.driver.create_node(name='foo',
                                       image=image,
                                       size=size,
                                       location=location)
        self.assertEqual(node.id, '1234')

        node = self.driver.create_node(name='foo',
                                       image=image,
                                       size=size,
                                       location=location,
                                       voxel_access=True)
        self.assertEqual(node.id, '1234')
Beispiel #19
0
 def _to_size(self, data):
     extra = {'vcpus': data['vcpus'],
              'regions': data['regions'],
              'price_monthly': data['price_monthly']}
     return NodeSize(id=data['slug'], name=data['slug'], ram=data['memory'],
                     disk=data['disk'], bandwidth=data['transfer'],
                     price=data['price_hourly'], driver=self, extra=extra)
Beispiel #20
0
 def list_sizes(self, location=None):
     szs = self._sync_request('listServiceOfferings')
     sizes = []
     for sz in szs['serviceoffering']:
         sizes.append(NodeSize(sz['id'], sz['name'], sz['memory'], 0, 0,
                               0, self))
     return sizes
Beispiel #21
0
 def list_sizes(self, location=None):
     szs = self._sync_request('listAvailableProductTypes')
     sizes = []
     for sz in szs['producttypes']:
         sizes.append(NodeSize(sz['diskofferingid'],
         sz['diskofferingdesc'], 0, 0, 0, 0, self))
     return sizes
    def list_sizes(self, location=None):
        """
        Returns a list of all hardware templates

        @inherits: L{NodeDriver.list_sizes}
        """

        #Make the call
        response = self.connection.request(
            '/rest/hosting/htemplate/list').parse_body()

        #Turn the response into an array of NodeSize objects
        sizes = []
        for htemplate in response['templates']:
            sizes.append(
                NodeSize(
                    id=htemplate['uuid'],
                    name=htemplate['name'],
                    ram=htemplate['memory'],
                    disk=0,  # Disk is independent of hardware template.
                    bandwidth=0,  # There is no way to keep track of bandwidth.
                    price=0,  # The billing system is external.
                    driver=self,
                ))

        return sizes
    def test_create_node(self):
        """
        Test create_node functionality.
        """
        image = NodeImage(id=5, name='Ubuntu 9.04 LAMP', driver=self.driver)
        size = NodeSize(id=1, name='small', ram=None, disk=None,
                        bandwidth=None, price=None, driver=self.driver)
        networks = list()
        networks.append(OpenNebulaNetwork(id=5, name='Network 5',
                        address='192.168.0.0', size=256, driver=self.driver))
        networks.append(OpenNebulaNetwork(id=15, name='Network 15',
                        address='192.168.1.0', size=256, driver=self.driver))

        node = self.driver.create_node(name='Compute 5', image=image,
                                       size=size, networks=networks)

        self.assertEqual(node.id, '5')
        self.assertEqual(node.name, 'Compute 5')
        self.assertEqual(node.state,
                         OpenNebulaNodeDriver.NODE_STATE_MAP['ACTIVE'])
        self.assertIsNone(node.public_ips[0].name)
        self.assertEqual(node.public_ips[0].id, '5')
        self.assertEqual(node.public_ips[0].address, '192.168.0.1')
        self.assertEqual(node.public_ips[0].size, 1)
        self.assertIsNone(node.public_ips[1].name)
        self.assertEqual(node.public_ips[1].id, '15')
        self.assertEqual(node.public_ips[1].address, '192.168.1.1')
        self.assertEqual(node.public_ips[1].size, 1)
        self.assertEqual(node.private_ips, [])
        self.assertEqual(node.image.id, '5')
        self.assertEqual(node.image.extra['dev'], 'sda1')
Beispiel #24
0
    def ex_get_size(self,
                    ramMB,
                    diskSizeGB,
                    cpuType,
                    cpuCores,
                    extraDiskSizesGB=None,
                    monthlyTrafficPackage=None,
                    id=None,
                    name=None):
        """
        Get a NodeSize object to use for other methods

        :param ramMB:     Amount of RAM to allocate in MB (required)
        :type ramMB:      ``int``

        :param diskSizeGB:     disk size GB for primary hard disk (required)
        :type diskSizeGB:      ``int``

        :param cpuType:     CPU type ID (single uppercase letter),
                            see ex_list_capabilities (required)
        :type cpuType:      ``str``

        :param cpuCores:     Number of CPU cores to allocate (required)
        :type cpuCores:      ``int``

        :param extraDiskSizesGB:     additional disk sizes in GB (optional)
        :type extraDiskSizesGB:      ``list`` of :int:

        :param monthlyTrafficPackage:     ID of monthly traffic package
                                          see ex_list_capabilities (optional)
        :type monthlyTrafficPackage:      ``str``

        :param id:     Size ID (optional)
        :type id:      ``str``

        :param name:     Size Name (optional)
        :type name:      ``str``

        :rtype: :class:`.NodeLocation`
        """
        if not id:
            id = str(cpuCores) + cpuType
            id += '-' + str(ramMB) + 'MB-' + str(diskSizeGB) + 'GB'
            if monthlyTrafficPackage:
                id += '-' + monthlyTrafficPackage
        if not name:
            name = id
        return NodeSize(id=id,
                        name=name,
                        ram=ramMB,
                        disk=diskSizeGB,
                        bandwidth=0,
                        price=0,
                        driver=self.connection.driver,
                        extra={
                            'cpuType': cpuType,
                            'cpuCores': cpuCores,
                            'monthlyTrafficPackage': monthlyTrafficPackage,
                            'extraDiskSizesGB': extraDiskSizesGB or []
                        })
Beispiel #25
0
    def list_sizes(self, location=None):
        sizes = []
        for key, values in self._instance_types.items():
            attributes = copy.deepcopy(values)
            attributes.update({'price': self._get_size_price(size_id=key)})
            sizes.append(NodeSize(driver=self.connection.driver, **attributes))

        return sizes
Beispiel #26
0
 def _to_size(self, plan):
     return NodeSize(id=plan['pricing_plan_code'],
                     name=plan['pricing_plan_description'],
                     ram=plan['minimum_memory_mb'],
                     disk=plan['minimum_disk_gb'],
                     bandwidth=plan['minimum_data_transfer_allowance_gb'],
                     price=plan['monthly_recurring_amt']['amt_usd'],
                     driver=self.connection.driver)
Beispiel #27
0
 def _get_test_512Mb_node_size(self):
     return NodeSize(id='512Mb',
                     name=None,
                     ram=None,
                     disk=None,
                     bandwidth=None,
                     price=None,
                     driver=self.driver)
Beispiel #28
0
 def _to_size(self, data):
     return NodeSize(id=data['id'],
                     name=data['name'],
                     ram=data['ram'],
                     disk=data['disk_size'],
                     bandwidth=0,
                     price=0,
                     driver=self)
Beispiel #29
0
    def list_sizes(self, location=None):
        """
        List sizes on a provider.

        Abiquo does not work with sizes. However, this method
        returns a list of predefined ones (copied from :class:`DummyNodeDriver`
        but without price neither bandwidth) to help the users to create their
        own.

        If you call the method :class:`AbiquoNodeDriver.create_node` with the
        size informed, it will just override the 'ram' value of the 'image'
        template. So it is no too much usefull work with sizes...

        :return: The list of sizes
        :rtype:  ``list`` of :class:`NodeSizes`
        """
        return [
            NodeSize(id=1,
                     name='Small',
                     ram=128,
                     disk=4,
                     bandwidth=None,
                     price=None,
                     driver=self),
            NodeSize(id=2,
                     name='Medium',
                     ram=512,
                     disk=16,
                     bandwidth=None,
                     price=None,
                     driver=self),
            NodeSize(id=3,
                     name='Big',
                     ram=4096,
                     disk=32,
                     bandwidth=None,
                     price=None,
                     driver=self),
            NodeSize(id=4,
                     name="XXL Big",
                     ram=4096 * 2,
                     disk=32 * 4,
                     bandwidth=None,
                     price=None,
                     driver=self)
        ]
Beispiel #30
0
    def _to_size(self, data):
        extra = {'vcpu_count': data['vcpu_count']}
        ram = data['memory_gb'] * 1024

        return NodeSize(id=data['slug'], name=data['name'],
                        ram=ram, disk=10,
                        bandwidth=0, price=0,
                        extra=extra, driver=self)
Beispiel #31
0
 def test_base_node_size(self):
     NodeSize(id=0,
              name=0,
              ram=0,
              disk=0,
              bandwidth=0,
              price=0,
              driver=FakeDriver())