#!/usr/bin/python # -*- coding: utf-8 -*- # This file is part of Cockpit. # # Copyright (C) 2015 Red Hat, Inc. # # Cockpit is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Cockpit is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Cockpit; If not, see . import parent from testlib import * from storagelib import * @skipImage("storaged-iscsi not packaged", "centos-7", "debian-testing") @skipImage("UDisks doesn't have support for iSCSI", "debian-stable", "ubuntu-1604", "ubuntu-stable") class TestStorage(StorageCase): def testISCSI(self): m = self.machine b = self.browser b.wait_timeout(120) # rhel-7 is missing the iSCSI session API if m.image in ["rhel-7", "rhel-7-4"]: self.login_and_go("/storage") # The optional parts of the UI have been configured # properly before the page is shown, so we can now # reliably check for the visibility of the iSCSI panel. # It won't show up later asynchronously. b.wait_not_visible("#iscsi-sessions") return target_iqn = "iqn.2015-09.cockpit.lan" initiator_iqn = "iqn.2015-10.cockpit.lan" # Increase the iSCSI timeouts for heavy load during our testing m.execute("""sed -i 's|^\(node\..*log.*_timeout = \).*|\\1 60|' /etc/iscsi/iscsid.conf""") # Setup a iSCSI target with authentication for discovery and join # # HACK - some versions of targetcli crash when TERM is not set # and stdout is not a tty. # # https://bugzilla.redhat.com/show_bug.cgi?id=1441121 m.execute(""" export TERM=dumb targetcli /backstores/ramdisk create test 50M targetcli /iscsi set discovery_auth enable=1 userid=admin password=foobar targetcli /iscsi create %(tgt)s targetcli /iscsi/%(tgt)s/tpg1/luns create /backstores/ramdisk/test targetcli /iscsi/%(tgt)s/tpg1 set attribute authentication=1 targetcli /iscsi/%(tgt)s/tpg1/acls create %(ini)s targetcli /iscsi/%(tgt)s/tpg1/acls/%(ini)s set auth userid=admin password=barfoo """ % { "tgt": target_iqn, "ini": initiator_iqn }) # m.execute("targetcli ls") self.login_and_go("/storage") # Set initiator IQN # orig_iqn = m.execute("sed