コード例 #1
0
 def setUp(self):
     super(TestDeletePartition, self).setUp()
     # create a partition
     self.partition = dbutils.create_test_partition(
         forihostid=self.ihost.id,
         idisk_id=self.disk.id,
         idisk_uuid=self.disk.uuid,
         size_mib=128)
コード例 #2
0
    def test_unscoped_list_returns_empty(self):
        # create a partition
        self.partition = dbutils.create_test_partition(
            forihostid=self.ihost.id,
            idisk_id=self.disk.id,
            idisk_uuid=self.disk.uuid,
            type_guid=constants.USER_PARTITION_PHYSICAL_VOLUME,
            size_mib=128)

        # Querying the base URL (unscoped)
        response = self.get_json(self.API_PREFIX)
        self.assertEqual(0, len(response[self.RESULT_KEY]))
コード例 #3
0
 def setUp(self):
     super(TestPatchPartition, self).setUp()
     # Only partition Add/Delete operations are allowed on an unprovisioned host
     # create a partition in ready state
     # device_path is required. Only the last partition can be modified.
     # setting the size small, since patching typically increases it.
     self.partition = dbutils.create_test_partition(
         forihostid=self.ihost.id,
         idisk_id=self.disk.id,
         idisk_uuid=self.disk.uuid,
         type_guid=constants.USER_PARTITION_PHYSICAL_VOLUME,
         status=constants.PARTITION_READY_STATUS,
         device_path=self.partition_device_path,
         size_mib=32)
コード例 #4
0
    def test_many_entries_in_list(self):
        result_list = []
        for obj_id in range(100):
            partition = dbutils.create_test_partition(
                id=obj_id,
                forihostid=self.ihost.id,
                idisk_id=self.disk.id,
                idisk_uuid=self.disk.uuid,
                type_guid=constants.USER_PARTITION_PHYSICAL_VOLUME,
                size_mib=1)
            result_list.append(partition['uuid'])

        response = self.get_json(self.get_host_scoped_url(self.ihost.uuid))
        self.assertEqual(len(result_list), len(response[self.RESULT_KEY]))

        # Verify that the sorted list of uuids is the same
        uuids = [n['uuid'] for n in response[self.RESULT_KEY]]
        self.assertEqual(result_list.sort(), uuids.sort())
コード例 #5
0
    def test_single_entry_by_host_list(self):
        expected_size = 32
        # create a partition
        self.partition = dbutils.create_test_partition(
            forihostid=self.ihost.id,
            idisk_id=self.disk.id,
            idisk_uuid=self.disk.uuid,
            type_guid=constants.USER_PARTITION_PHYSICAL_VOLUME,
            size_mib=expected_size)

        # Querying the URL scoped by host
        response = self.get_json(self.get_host_scoped_url(self.ihost.uuid))

        self.assertEqual(1, len(response[self.RESULT_KEY]))
        # Check the single result
        for result in response[self.RESULT_KEY]:
            # check fields are appropriate
            self.assert_fields(result)
            # check that the partition was created with the input size
            self.assertEqual(expected_size, result['size_mib'])