summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/objects/fields.py13
-rw-r--r--nova/tests/unit/objects/test_fields.py22
2 files changed, 1 insertions, 34 deletions
diff --git a/nova/objects/fields.py b/nova/objects/fields.py
index 036e32b887..0b246322cf 100644
--- a/nova/objects/fields.py
+++ b/nova/objects/fields.py
@@ -66,6 +66,7 @@ AutoTypedField = fields.AutoTypedField
BaseEnumField = fields.BaseEnumField
MACAddressField = fields.MACAddressField
ListOfIntegersField = fields.ListOfIntegersField
+PCIAddressField = fields.PCIAddressField
# NOTE(danms): These are things we need to import for some of our
@@ -1000,14 +1001,6 @@ class AddressBase(FieldType):
return {'type': ['string'], 'pattern': self.PATTERN}
-class PCIAddress(AddressBase):
- PATTERN = '[a-f0-9]{4}:[a-f0-9]{2}:[a-f0-9]{2}.[a-f0-9]'
-
- @staticmethod
- def coerce(obj, attr, value):
- return AddressBase.coerce(PCIAddress, attr, value)
-
-
class USBAddress(AddressBase):
PATTERN = '[a-f0-9]+:[a-f0-9]+'
@@ -1040,10 +1033,6 @@ class XenAddress(AddressBase):
return AddressBase.coerce(XenAddress, attr, value)
-class PCIAddressField(AutoTypedField):
- AUTO_TYPE = PCIAddress()
-
-
class USBAddressField(AutoTypedField):
AUTO_TYPE = USBAddress()
diff --git a/nova/tests/unit/objects/test_fields.py b/nova/tests/unit/objects/test_fields.py
index cb891218e5..d220da32f8 100644
--- a/nova/tests/unit/objects/test_fields.py
+++ b/nova/tests/unit/objects/test_fields.py
@@ -640,28 +640,6 @@ class TestNotificationAction(TestField):
self.assertRaises(ValueError, self.field.stringify, 'magic')
-class TestPCIAddress(TestField):
- def setUp(self):
- super(TestPCIAddress, self).setUp()
- self.field = fields.Field(fields.PCIAddressField())
- self.coerce_good_values = [('0000:00:02.0', '0000:00:02.0')]
- self.coerce_bad_values = [
- '000:00:02.0',
- '0000:0:02.0',
- '0000:00:2.0',
- '0000:00:02.',
- '-000:00:02.0',
- '0000:0-:02.0',
- '0000:00:-2.0',
- '0000:00:02.-',
- '000000:02.0',
- '0000:0:02.0',
- '0000:00:020',
- ]
- self.to_primitive_values = self.coerce_good_values
- self.from_primitive_values = self.coerce_good_values
-
-
class TestUSBAddress(TestField):
def setUp(self):
super(TestUSBAddress, self).setUp()