Example #1
0
    def __init__(self, **kwargs):
        """ Initialize a topology node
        """
        super(SharedNode, self).__init__(**kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # private attributes
        self._num = self.get_inc_counter(self.machine, "cfg_shared")
Example #2
0
    def __init__(self, _parent=None, **kwargs):
        """ Initialize a topology node
        """
        super(VirtualboxInterfaceNode, self).__init__(_parent=_parent, **kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        if not self.cfg_connected:
            logger.warning('interface is not connected')
Example #3
0
    def __init__(self, _parent=None, **kwargs):
        """ Initialize a network node
        """
        super(VirtualboxNetworkNode, self).__init__(_parent=_parent, **kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # private attributes
        self._dhcp_server = None
Example #4
0
    def __init__(self, _parent=None, **kwargs):
        """ Initialize a provisioner node
        """
        super(ProvisionerNode, self).__init__(_parent=_parent, **kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # private attributes
        self._num = self.get_inc_counter(self.machine, "cfg_provisioners")
Example #5
0
    def __init__(self, _parent=None, **kwargs):
        """ Initialize a topology node
        """
        super(SharedNode, self).__init__(_parent=_parent, **kwargs)
        TopologyAttribute.setall(self, kwargs, self._SharedNode__known_attributes)

        from candelabra.provider.virtualbox import VirtualboxMachineNode

        assert self._container is not None and isinstance(self._container, VirtualboxMachineNode)

        self.installed = False
Example #6
0
    def __init__(self, _parent=None, **kwargs):
        """ Initialize a network
        """
        super(NetworkNode, self).__init__(_parent=_parent, **kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # check the attributes
        if self.cfg_scope:
            if not self.cfg_scope in SUPPORTED_SCOPES:
                raise MalformedTopologyException('unknown network scope "%s": should be one of %s',
                                                 self.cfg_scope,
                                                 SUPPORTED_SCOPES)

        # private attributes
        self._created = False
Example #7
0
    def __init__(self, **kwargs):
        """ Initialize a machines definition
        """
        super(MachineNode, self).__init__(**kwargs)

        # set the default class for nodes if it has not been set
        if not self.cfg_class:
            self.cfg_class = config.get_key(CFG_DEFAULT_PROVIDER)
            logger.debug('using default node class: %s', self.cfg_class)

        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        self.guest = None
        self.communicator = None

        # validate the attributes
        if not self.cfg_name and not self.is_global:
            raise MalformedTopologyException('machines must have a name')
Example #8
0
    def __init__(self, **kwargs):
        """ Initialize a VirtualBox machine
        """
        super(VirtualboxMachineNode, self).__init__(**kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # get any VirtualBox default parameters from the config file
        if config.has_section(DEFAULT_CFG_SECTION_VIRTUALBOX):
            self._cfg = config.items(section=DEFAULT_CFG_SECTION_VIRTUALBOX)
            if len(self._cfg) > 0:
                logger.debug('VirtualBox default config:')
                for k, v in self._cfg:
                    logger.debug('... %s = %s', k, v)
                    setattr(self, 'default_' + k, v)
        else:
            self._cfg = None

        self._vbox = _virtualbox.VirtualBox()
        self._vbox_uuid = self.cfg_uuid if getattr(self, 'cfg_uuid', None) else None
        self._vbox_machine = None
        self._vbox_guest = None
        self._vbox_guest_os_type = None
        self._vbox_wait_events = {}

        self._created_shared_folders = []

        # check and fix topology parameters
        if not self.cfg_gui in ['headless', 'gui']:
            raise MalformedTopologyException('invalid GUI type %s', self.cfg_gui)
        if not self.cfg_updown_timeout:
            self.cfg_updown_timeout = config.get_key(CFG_MACHINE_UPDOWN_TIMEOUT)
        if not self.cfg_userland_timeout:
            self.cfg_userland_timeout = config.get_key(CFG_USERLAND_TIMEOUT)
        if not self.cfg_commands_timeout:
            self.cfg_commands_timeout = config.get_key(CFG_MACHINE_COMMANDS_TIMEOUT)

        # create a communicator for this machine
        self.communicator = build_communicator_instance(_class='virtualbox', machine=self)
Example #9
0
    def __init__(self, **kwargs):
        """ Initialize a network interface in the machine
        """
        super(InterfaceNode, self).__init__(**kwargs)
        TopologyAttribute.setall(self, kwargs, self.__known_attributes)

        # check the attributes
        if self.cfg_type not in _SUPPORTED_IFACE_TYPES:
            raise MalformedTopologyException('unknown interface type "%s": should be one of %s' % (
                self.cfg_type, _SUPPORTED_IFACE_TYPES))

        if not self.cfg_connected:
            raise MalformedTopologyException('interfaces must be "connected" to some network')

        # get the network this interface is connected to, but as a NetworkNode (or subclass) instance
        network = self.machine.get_network_by_name(self.cfg_connected)
        if not network:
            raise MalformedTopologyException('interface "%s" is connected to unknown network "%s"' %
                                             (self.cfg_name, self.cfg_connected))
        self.cfg_connected = network

        # private attributes
        self._created = False
Example #10
0
 def __init__(self, _parent=None, **kwargs):
     """ Initialize a topology node
     """
     super(SharedNode, self).__init__(_parent=_parent, **kwargs)
     TopologyAttribute.setall(self, kwargs, self.__known_attributes)
Example #11
0
 def __init__(self, **kwargs):
     """ Initialize a VirtualBox machine
     """
     super(PuppetProvisioner, self).__init__(**kwargs)
     TopologyAttribute.setall(self, kwargs, self.__known_attributes)
Example #12
0
 def __init__(self, _parent=None, **kwargs):
     super(TestNode, self).__init__(_parent=_parent, **kwargs)
     TopologyAttribute.setall(self, kwargs, self.__known_attributes)