Example #1
0
 def _handle_ucsm_exception(self, exception_type, profile_type,
                            profile_name, ucsm_ip):
     if const.DUPLICATE_EXCEPTION in str(exception_type):
         LOG.debug('UCS Manager network driver ignoring duplicate '
                   'create/update of %s with %s',
             profile_type, profile_name)
         return True
     else:
         # Raise a Neutron exception. Include a description of
         # the original  exception.
         raise cexc.UcsmConfigFailed(config=profile_name,
                                     ucsm_ip=ucsm_ip,
                                     exc=exception_type)
Example #2
0
 def new_create_ucsm_profile(mech_context, host_id, vlan_id):
     new_create_ucsm_profile.counter += 1
     try:
         if new_create_ucsm_profile.counter == 0:
             raise Exception("Invalid Operation")
         elif new_create_ucsm_profile.counter > 1:
             raise Exception(const.DUPLICATE_EXCEPTION)
         else:
             return True
     except Exception as e:
         if const.DUPLICATE_EXCEPTION in str(e):
             return True
         else:
             raise exceptions.UcsmConfigFailed(
                 config=vlan_id, ucsm_ip=UCSM_IP_ADDRESS_1, exc=e)
    def _delete_vlan_profile(self, handle, vlan_id, ucsm_ip):
        """Deletes VLAN Profile from UCS Manager."""
        vlan_name = self.make_vlan_name(vlan_id)
        vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX +
                             vlan_name)
        try:
            obj = handle.query_dn(vlan_profile_dest)

            if obj:
                handle.remove_mo(obj)

            handle.commit()

        except Exception as e:
            # Raise a Neutron exception. Include a description of
            # the original  exception.
            raise cexc.UcsmConfigFailed(config=vlan_id, ucsm_ip=ucsm_ip, exc=e)
Example #4
0
    def _delete_vlan_profile(self, handle, vlan_id, ucsm_ip):
        """Deletes VLAN Profile from UCS Manager."""
        vlan_name = self.make_vlan_name(vlan_id)
        vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX +
                             vlan_name)
        try:
            handle.StartTransaction()
            obj = handle.GetManagedObject(
                None, self.ucsmsdk.FabricVlan.ClassId(),
                {self.ucsmsdk.FabricVlan.DN: vlan_profile_dest})

            if obj:
                handle.RemoveManagedObject(obj)

            handle.CompleteTransaction()

        except Exception as e:
            # Raise a Neutron exception. Include a description of
            # the original  exception.
            raise cexc.UcsmConfigFailed(config=vlan_id, ucsm_ip=ucsm_ip, exc=e)