def _configure_virt_driver(self, nova_conf):
     drive_canon = _canon_virt_driver(self._getstr('virt_driver'))
     nova_conf.add('connection_type', VIRT_DRIVER_CON_MAP.get(drive_canon, drive_canon))
     #special driver settings
     if drive_canon == 'xenserver':
         nova_conf.add('xenapi_connection_url', self._getstr('xa_connection_url', XA_DEF_CONNECTION_URL))
         nova_conf.add('xenapi_connection_username', self._getstr('xa_connection_username', XA_DEF_USER))
         nova_conf.add('xenapi_connection_password', self.cfg.get("passwords", "xenapi_connection"))
         nova_conf.add_simple('noflat_injected')
         xs_flat_ifc = self._getstr('xs_flat_interface', XS_DEF_INTERFACE)
         if not utils.is_interface(xs_flat_ifc):
             msg = "Xenserver flat interface %s is not a known interface" % (xs_flat_ifc)
             raise exceptions.ConfigException(msg)
         nova_conf.add('flat_interface', xs_flat_ifc)
         nova_conf.add('firewall_driver', self._getstr('xs_firewall_driver', DEF_FIREWALL_DRIVER))
         nova_conf.add('flat_network_bridge', self._getstr('xs_flat_network_bridge', XS_DEF_BRIDGE))
     elif drive_canon == virsh.VIRT_TYPE:
         nova_conf.add('firewall_driver', self._getstr('libvirt_firewall_driver', DEF_FIREWALL_DRIVER))
         nova_conf.add('flat_network_bridge', self._getstr('flat_network_bridge', DEF_FLAT_VIRT_BRIDGE))
         flat_interface = self._getstr('flat_interface')
         if flat_interface:
             if not utils.is_interface(flat_interface):
                 msg = "Libvirt flat interface %s is not a known interface" % (flat_interface)
                 raise exceptions.ConfigException(msg)
             nova_conf.add('flat_interface', flat_interface)
 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)
     if not utils.is_interface(public_interface):
         msg = "Public interface %r is not a known interface" % (
             public_interface)
         raise exceptions.ConfigException(msg)
     if not utils.is_interface(vlan_interface):
         msg = "VLAN interface %r is not a known interface" % (
             vlan_interface)
         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 utils.is_interface(xs_flat_ifc):
             msg = "Xenserver flat interface %s is not a known interface" % (
                 xs_flat_ifc)
             raise exceptions.ConfigException(msg)
     elif drive_canon == 'libvirt':
         flat_interface = self._getstr('flat_interface')
         if flat_interface and not utils.is_interface(flat_interface):
             msg = "Libvirt flat interface %s is not a known interface" % (
                 flat_interface)
             raise exceptions.ConfigException(msg)
Beispiel #3
0
    def _configure_network_settings(self, nova_conf):
        # TODO this might not be right....
        if 'quantum' in self.options:
            nova_conf.add('network_manager', QUANTUM_MANAGER)
            hostip = self.cfg.get('host', 'ip')
            nova_conf.add('quantum_connection_host',
                          self.cfg.getdefaulted('quantum', 'q_host', hostip))
            nova_conf.add('quantum_connection_port',
                          self.cfg.getdefaulted('quantum', 'q_port', '9696'))
            if self.cfg.get('quantum', 'q_plugin') == 'openvswitch':
                for (key, value) in QUANTUM_OPENSWITCH_OPS.items():
                    nova_conf.add(key, value)
            if 'melange' in self.options:
                nova_conf.add('quantum_ipam_lib', QUANTUM_IPAM_LIB)
                nova_conf.add('use_melange_mac_generation', True)
                nova_conf.add(
                    'melange_host',
                    self.cfg.getdefaulted('melange', 'm_host', hostip))
                nova_conf.add(
                    'melange_port',
                    self.cfg.getdefaulted('melange', 'm_port', '9898'))
        else:
            nova_conf.add(
                'network_manager', NET_MANAGER_TEMPLATE %
                (self._getstr('network_manager', DEF_NET_MANAGER)))

        # Configs dhcp bridge stuff???
        # TODO: why is this the same as the nova.conf?
        nova_conf.add('dhcpbridge_flagfile',
                      sh.joinpths(self.cfg_dir, API_CONF))

        # Network prefix for the IP network that all the projects for future VM guests reside on. Example: 192.168.0.0/12
        nova_conf.add('fixed_range', self._getstr('fixed_range'))

        # The value for vlan_interface may default to the the current value
        # of public_interface. We'll grab the value and keep it handy.
        public_interface = self._getstr('public_interface')
        vlan_interface = self._getstr('vlan_interface', public_interface)

        # Do a little check to make sure actually have that interface/s
        if not utils.is_interface(public_interface):
            msg = "Public interface %s is not a known interface" % (
                public_interface)
            raise exceptions.ConfigException(msg)

        if not utils.is_interface(vlan_interface):
            msg = "VLAN interface %s is not a known interface" % (
                vlan_interface)
            raise exceptions.ConfigException(msg)

        nova_conf.add('public_interface', public_interface)
        nova_conf.add('vlan_interface', vlan_interface)

        # This forces dnsmasq to update its leases table when an instance is terminated.
        nova_conf.add('force_dhcp_release', True)
    def _configure_network_settings(self, nova_conf):
        #TODO this might not be right....
        if utils.service_enabled(settings.QUANTUM, self.instances, False):
            nova_conf.add('network_manager', QUANTUM_MANAGER)
            nova_conf.add('quantum_connection_host', self.cfg.get('quantum', 'q_host'))
            nova_conf.add('quantum_connection_port', self.cfg.get('quantum', 'q_port'))
            if self.cfg.get('quantum', 'q_plugin') == 'openvswitch':
                for (key, value) in QUANTUM_OPENSWITCH_OPS.items():
                    if value is None:
                        nova_conf.add_simple(key)
                    else:
                        nova_conf.add(key, value)
            if utils.service_enabled(settings.MELANGE_CLIENT, self.instances, False):
                nova_conf.add('quantum_ipam_lib', QUANTUM_IPAM_LIB)
                nova_conf.add_simple('use_melange_mac_generation')
                nova_conf.add('melange_host', self.cfg.get('melange', 'm_host'))
                nova_conf.add('melange_port', self.cfg.get('melange', 'm_port'))
        else:
            nova_conf.add('network_manager', NET_MANAGER_TEMPLATE % (self._getstr('network_manager', DEF_NET_MANAGER)))

        #dhcp bridge stuff???
        nova_conf.add('dhcpbridge_flagfile', sh.joinpths(self.cfgdir, API_CONF))

        #Network prefix for the IP network that all the projects for future VM guests reside on. Example: 192.168.0.0/12
        nova_conf.add('fixed_range', self._getstr('fixed_range'))

        # The value for vlan_interface may default to the the current value
        # of public_interface. We'll grab the value and keep it handy.
        public_interface = self._getstr('public_interface')
        vlan_interface = self._getstr('vlan_interface', public_interface)

        #do a little check to make sure actually have that interface set...
        if not utils.is_interface(public_interface):
            msg = "Public interface %s is not a known interface" % (public_interface)
            raise exceptions.ConfigException(msg)

        if not utils.is_interface(vlan_interface):
            msg = "VLAN interface %s is not a known interface" % (vlan_interface)
            raise exceptions.ConfigException(msg)

        nova_conf.add('public_interface', public_interface)
        nova_conf.add('vlan_interface', vlan_interface)

        #This forces dnsmasq to update its leases table when an instance is terminated.
        nova_conf.add_simple('force_dhcp_release')
Beispiel #5
0
 def _configure_virt_driver(self, nova_conf):
     drive_canon = _canon_virt_driver(self._getstr('virt_driver'))
     nova_conf.add('connection_type',
                   VIRT_DRIVER_CON_MAP.get(drive_canon, drive_canon))
     # Special driver settings
     if drive_canon == 'xenserver':
         nova_conf.add(
             'xenapi_connection_url',
             self._getstr('xa_connection_url', XA_DEF_CONNECTION_URL))
         nova_conf.add('xenapi_connection_username',
                       self._getstr('xa_connection_username', XA_DEF_USER))
         nova_conf.add('xenapi_connection_password',
                       self.cfg.get("passwords", "xenapi_connection"))
         nova_conf.add('noflat_injected', True)
         xs_flat_ifc = self._getstr('xs_flat_interface', XS_DEF_INTERFACE)
         if not utils.is_interface(xs_flat_ifc):
             msg = "Xenserver flat interface %s is not a known interface" % (
                 xs_flat_ifc)
             raise exceptions.ConfigException(msg)
         nova_conf.add('flat_interface', xs_flat_ifc)
         nova_conf.add(
             'firewall_driver', FIRE_MANAGER_TEMPLATE %
             (self._getstr('xs_firewall_driver', DEF_FIREWALL_DRIVER)))
         nova_conf.add(
             'flat_network_bridge',
             self._getstr('xs_flat_network_bridge', XS_DEF_BRIDGE))
     elif drive_canon == 'libvirt':
         nova_conf.add(
             'firewall_driver', FIRE_MANAGER_TEMPLATE %
             (self._getstr('libvirt_firewall_driver', DEF_FIREWALL_DRIVER)))
         nova_conf.add(
             'flat_network_bridge',
             self._getstr('flat_network_bridge', DEF_FLAT_VIRT_BRIDGE))
         flat_interface = self._getstr('flat_interface')
         if flat_interface:
             if not utils.is_interface(flat_interface):
                 msg = "Libvirt flat interface %s is not a known interface" % (
                     flat_interface)
                 raise exceptions.ConfigException(msg)
             nova_conf.add('flat_interface', flat_interface)
Beispiel #6
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)
     if not utils.is_interface(public_interface):
         msg = "Public interface %r is not a known interface" % (public_interface)
         raise exceptions.ConfigException(msg)
     if not utils.is_interface(vlan_interface):
         msg = "VLAN interface %r is not a known interface" % (vlan_interface)
         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 utils.is_interface(xs_flat_ifc):
             msg = "Xenserver flat interface %s is not a known interface" % (xs_flat_ifc)
             raise exceptions.ConfigException(msg)
     elif drive_canon == 'libvirt':
         flat_interface = self._getstr('flat_interface')
         if flat_interface and not utils.is_interface(flat_interface):
             msg = "Libvirt flat interface %s is not a known interface" % (flat_interface)
             raise exceptions.ConfigException(msg)