diff --git a/nova_dpm/tests/unit/virt/dpm/test_vm.py b/nova_dpm/tests/unit/virt/dpm/test_vm.py index 5c8db07..7a2a1c3 100755 --- a/nova_dpm/tests/unit/virt/dpm/test_vm.py +++ b/nova_dpm/tests/unit/virt/dpm/test_vm.py @@ -267,7 +267,7 @@ class VmPartitionInstanceTestCase(TestCase): vif.type = "non_dpm_vswitch" self.assertRaises( - Exception, + exceptions.InvalidVIFTypeError, self.partition_inst.attach_nic, vif) @mock.patch.object(vm.PartitionInstance, 'attach_nic') diff --git a/nova_dpm/virt/dpm/exceptions.py b/nova_dpm/virt/dpm/exceptions.py index 7376828..98c7453 100644 --- a/nova_dpm/virt/dpm/exceptions.py +++ b/nova_dpm/virt/dpm/exceptions.py @@ -26,6 +26,13 @@ class MaxAmountOfInstancePortsExceededError(NovaException): .format(max_ports=MAX_NICS_PER_PARTITION) +class InvalidVIFTypeError(NovaException): + msg_fmt = _("The vif type %(type)s is not supported by nova-dpm. The " + "only supported type is 'dpm_vswitch'. Please " + "configure the networking-dpm agent to only use OSA or " + "hipersockets adapters.") + + class BootOsSpecificParametersPropertyExceededError(NovaException): """The boot-os-specific-parameters property would exceed the allowed max""" msg_fmt = _("Exceeded the maximum len for the partitions " diff --git a/nova_dpm/virt/dpm/vm.py b/nova_dpm/virt/dpm/vm.py index b052383..34d5e99 100644 --- a/nova_dpm/virt/dpm/vm.py +++ b/nova_dpm/virt/dpm/vm.py @@ -236,7 +236,7 @@ class PartitionInstance(object): # Only dpm_vswitch attachments are supported for now if vif_obj.type != "dpm_vswitch": - raise Exception + raise exceptions.InvalidVIFTypeError(type=vif_obj.type) dpm_nic_dict = self._get_nic_properties_dict(vif_obj) LOG.debug("Creating NIC with properties: %s", dpm_nic_dict)