def test_equal_without_metadata(self): resource_0 = resource.Resource(provider_uuid=uuids.rp, resource_class='bar', identifier='foo') resource_1 = resource.Resource(provider_uuid=uuids.rp, resource_class='bar', identifier='foo') self.assertEqual(resource_0, resource_1)
def _create_resource(self, metadata=None): fake_resource = resource.Resource(provider_uuid=uuids.rp, resource_class='bar', identifier='foo') if metadata: fake_resource.metadata = metadata return fake_resource
def _test_set_malformed_resource_class(self, rc): try: resource.Resource(provider_uuid=uuids.rp, resource_class=rc, identifier='foo') except ValueError as e: self.assertEqual('Malformed Resource Class %s' % rc, str(e)) else: self.fail('Check malformed resource class failed.')
def _test_set_formed_resource_class(self, rc): resource.Resource(provider_uuid=uuids.rp, resource_class=rc, identifier='foo')
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from nova.objects import resource from nova.tests.unit.objects import test_objects fake_resources = resource.ResourceList(objects=[ resource.Resource(provider_uuid=uuids.rp, resource_class='CUSTOM_RESOURCE', identifier='foo'), resource.Resource(provider_uuid=uuids.rp, resource_class='CUSTOM_RESOURCE', identifier='bar') ]) fake_vpmems = [ resource.LibvirtVPMEMDevice(label='4GB', name='ns_0', devpath='/dev/dax0.0', size=4292870144, align=2097152), resource.LibvirtVPMEMDevice(label='4GB', name='ns_1', devpath='/dev/dax0.0',