Пример #1
0
 def verify(self):
     # Do a little check to make sure actually have that interface/s
     public_interface = self.installer.get_option("public_interface")
     vlan_interface = self.installer.get_option("vlan_interface", default_value=public_interface)
     known_interfaces = utils.get_interfaces()
     if not public_interface in known_interfaces:
         msg = "Public interface %r is not a known interface (is it one of %s??)" % (
             public_interface,
             ", ".join(known_interfaces),
         )
         raise exceptions.ConfigException(msg)
     if not vlan_interface in known_interfaces:
         msg = "VLAN interface %r is not a known interface (is it one of %s??)" % (
             vlan_interface,
             ", ".join(known_interfaces),
         )
         raise exceptions.ConfigException(msg)
     # Driver specific interface checks
     drive_canon = utils.canon_virt_driver(self.installer.get_option("virt_driver"))
     if drive_canon == "libvirt":
         flat_interface = self.installer.get_option("flat_interface")
         if flat_interface and not flat_interface in known_interfaces:
             msg = "Libvirt flat interface %s is not a known interface (is it one of %s??)" % (
                 flat_interface,
                 ", ".join(known_interfaces),
             )
             raise exceptions.ConfigException(msg)
Пример #2
0
 def verify(self):
     # Do a little check to make sure actually have that interface/s
     public_interface = self._getstr('public_interface')
     vlan_interface = self._getstr('vlan_interface', public_interface)
     known_interfaces = utils.get_interfaces()
     if not public_interface in known_interfaces:
         msg = "Public interface %r is not a known interface (is it one of %s??)" % (public_interface, ", ".join(known_interfaces))
         raise exceptions.ConfigException(msg)
     if not vlan_interface in known_interfaces:
         msg = "VLAN interface %r is not a known interface (is it one of %s??)" % (vlan_interface, ", ".join(known_interfaces))
         raise exceptions.ConfigException(msg)
     # Driver specific interface checks
     drive_canon = canon_virt_driver(self._getstr('virt_driver'))
     if drive_canon == 'xenserver':
         xs_flat_ifc = self._getstr('xs_flat_interface', XS_DEF_INTERFACE)
         if xs_flat_ifc and not xs_flat_ifc in known_interfaces:
             msg = "Xenserver flat interface %s is not a known interface (is it one of %s??)" % (xs_flat_ifc, ", ".join(known_interfaces))
             raise exceptions.ConfigException(msg)
     elif drive_canon == 'libvirt':
         flat_interface = self._getstr('flat_interface')
         if flat_interface and not flat_interface in known_interfaces:
             msg = "Libvirt flat interface %s is not a known interface (is it one of %s??)" % (flat_interface, ", ".join(known_interfaces))
             raise exceptions.ConfigException(msg)
     mq_type = canon_mq_type(self.installer.get_option('mq'))
     if mq_type not in MQ_TYPES:
         msg = "Unknown message queue type %s (is it one of %s??)" % (mq_type, ", ".join(MQ_TYPES))
         raise exceptions.ConfigException(msg)
Пример #3
0
 def _select_and_verify_interface(self, option_name, default_value=None):
     interfaces = self.installer.get_option(option_name, default_value=default_value)
     if not interfaces:
         raise exceptions.ConfigException("Could not find a value for option '%s'" % (option_name))
     if isinstance(interfaces, six.string_types):
         interfaces = [interfaces]
     valid_interfaces = list(utils.get_interfaces())
     LOG.debug("Checking if any of %s interfaces are valid (comparing against interfaces %s)",
               interfaces, valid_interfaces)
     matches = []
     for name in interfaces:
         if name in valid_interfaces:
             matches.append(name)
     if not matches:
         raise exceptions.ConfigException("Interfaces %s (under key '%s') do not match any known"
                                          " interfaces %s" % (interfaces, option_name, valid_interfaces))
     return matches[0]
Пример #4
0
 def verify(self):
     # Do a little check to make sure actually have that interface/s
     public_interface = self.installer.get_option('public_interface')
     vlan_interface = self.installer.get_option('vlan_interface', default_value=public_interface)
     known_interfaces = utils.get_interfaces()
     if public_interface not in known_interfaces:
         msg = "Public interface %r is not a known interface (is it one of %s??)" % (public_interface, ", ".join(known_interfaces))
         raise exceptions.ConfigException(msg)
     if vlan_interface not in known_interfaces:
         msg = "VLAN interface %r is not a known interface (is it one of %s??)" % (vlan_interface, ", ".join(known_interfaces))
         raise exceptions.ConfigException(msg)
     # Driver specific interface checks
     drive_canon = utils.canon_virt_driver(self.installer.get_option('virt_driver'))
     if drive_canon == 'libvirt':
         flat_interface = self.installer.get_option('flat_interface')
         if flat_interface and flat_interface not in known_interfaces:
             msg = "Libvirt flat interface %s is not a known interface (is it one of %s??)" % (flat_interface, ", ".join(known_interfaces))
             raise exceptions.ConfigException(msg)