Пример #1
0
 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)
Пример #2
0
 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
Пример #3
0
 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.')
Пример #4
0
 def _test_set_formed_resource_class(self, rc):
     resource.Resource(provider_uuid=uuids.rp,
                       resource_class=rc,
                       identifier='foo')
Пример #5
0
#    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',