Esempio n. 1
0
    def on_login_clicked(self, *args):
        """Start the login task."""
        row = self._find_row_for_login()

        # Skip, if there is nothing to do.
        if not row:
            return

        # First update widgets.
        self._set_login_sensitive(False)
        self._okButton.set_sensitive(False)
        self._cancelButton.set_sensitive(False)
        self._loginButton.set_sensitive(False)
        self._loginConditionNotebook.set_current_page(0)

        # Get data.
        portal = self._get_portal()
        node = self._find_node_for_row(row)
        _style, credentials = self._get_login_style_and_credentials()

        # Get the login task.
        task_path = self._iscsi_module.LoginWithTask(
            Portal.to_structure(portal),
            Credentials.to_structure(credentials),
            Node.to_structure(node)
        )
        task_proxy = STORAGE.get_proxy(task_path)

        # Start the login.
        async_run_task(task_proxy, lambda task_proxy: self.process_login_result(task_proxy, row))

        self._loginSpinner.start()
        self._loginSpinner.show()
Esempio n. 2
0
    def test_login_with_task(self, publisher):
        """Test the login task."""
        task_path = self.iscsi_interface.LoginWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials),
            Node.to_structure(self._node),
        )

        obj = check_task_creation(task_path, publisher, ISCSILoginTask)

        assert obj.implementation._portal == self._portal
        assert obj.implementation._credentials == self._credentials
        assert obj.implementation._node == self._node
Esempio n. 3
0
    def login_with_task_test(self, publisher):
        """Test the login task."""
        task_path = self.iscsi_interface.LoginWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials),
            Node.to_structure(self._node),
        )

        obj = check_task_creation(self, task_path, publisher, ISCSILoginTask)

        self.assertEqual(obj.implementation._portal, self._portal)
        self.assertEqual(obj.implementation._credentials, self._credentials)
        self.assertEqual(obj.implementation._node, self._node)
Esempio n. 4
0
    def test_discover_with_task(self, publisher):
        """Test the discover task."""
        interfaces_mode = "default"
        task_path = self.iscsi_interface.DiscoverWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials), interfaces_mode)

        obj = check_task_creation(task_path, publisher, ISCSIDiscoverTask)

        assert isinstance(obj, ISCSIDiscoverTaskInterface)

        assert obj.implementation._portal == self._portal
        assert obj.implementation._credentials == self._credentials
        assert obj.implementation._interfaces_mode == IscsiInterfacesMode.DEFAULT
Esempio n. 5
0
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        interfaces_mode = "default"
        task_path = self.iscsi_interface.DiscoverWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials), interfaces_mode)

        obj = check_task_creation(self, task_path, publisher,
                                  ISCSIDiscoverTask)

        self.assertIsInstance(obj, ISCSIDiscoverTaskInterface)

        self.assertEqual(obj.implementation._portal, self._portal)
        self.assertEqual(obj.implementation._credentials, self._credentials)
        self.assertEqual(obj.implementation._interfaces_mode,
                         IscsiInterfacesMode.DEFAULT)
Esempio n. 6
0
    def on_start_clicked(self, *args):
        """Start the discovery task."""
        # First update widgets.
        self._startButton.hide()
        self._cancelButton.set_sensitive(False)
        self._okButton.set_sensitive(False)
        self._conditionNotebook.set_current_page(1)
        self._set_configure_sensitive(False)
        self._initiatorEntry.set_sensitive(False)

        # Get the node discovery credentials.
        style = self._authNotebook.get_current_page()
        portal = self._get_portal()
        credentials = self._get_discover_credentials(style)
        initiator = self._get_text("initiatorEntry")

        self._discoveredLabel.set_markup(_(
            "The following nodes were discovered using the iSCSI initiator "
            "<b>%(initiatorName)s</b> using the portal IP address "
            "<b>%(portalAddress)s</b>.  Please select which nodes you "
            "wish to log into:") %
            {
                "initiatorName": escape_markup(initiator),
                "portalAddress": escape_markup(portal.ip_address)
            }
        )

        # Get the discovery task.
        if self._bindCheckbox.get_active():
            interfaces_mode = ISCSI_INTERFACE_IFACENAME
        else:
            interfaces_mode = ISCSI_INTERFACE_DEFAULT
        task_path = self._iscsi_module.DiscoverWithTask(
            Portal.to_structure(portal),
            Credentials.to_structure(credentials),
            interfaces_mode
        )
        task_proxy = STORAGE.get_proxy(task_path)

        if self._iscsi_module.CanSetInitiator():
            self._iscsi_module.Initiator = initiator

        # Start the discovery.
        async_run_task(task_proxy, self.process_discovery_result)

        self._discoverySpinner.start()