lib/Kernel/storage_qnap.pm

SYNOPSIS

API client for the QNAP storage used in kernel storage tests. It provisions the storage that tests use, for example iSCSI targets and LUNs.

QTS has no documented REST API. This module uses the CGI interface of the QTS web UI, as the QNAP driver of OpenStack Cinder does. The calls run from the openQA worker, not from the SUT.

Job settings: QNAP_USER, _SECRET_QNAP_PASSWORD, optionally QNAP_PORT (default 8080).

The calls match the requests of the QTS 5.2.4 web UI.

Each function dies if QTS reports an error, so the caller does not need to check a return value. Each change on the QNAP is shown with record_info.

create_iscsi_target

my $target = create_iscsi_target(host => $host, name => 'openqa', interface => 'eth1');

Creates an iSCSI target that listens on interface and returns {index => ..., iqn => ...}. interface is the QTS name of the network adapter: QTS counts from eth0, so "Adapter 2" is eth1. CHAP is disabled.

remove_iscsi_target

remove_iscsi_target(host => $host, index => $target->{index});

create_iscsi_lun

my $lun = create_iscsi_lun(host => $host, name => 'openqa_lun0', size_gb => 10, pool => 1);

Creates a thin block-based LUN in the storage pool pool (default 1) and returns its index.

remove_iscsi_lun

remove_iscsi_lun(host => $host, index => $lun);

Removes an unmapped LUN. QTS removes it in the background.

map_iscsi_lun

map_iscsi_lun(host => $host, target => $target->{index}, lun => $lun);

Maps a LUN to a target.

unmap_iscsi_lun

unmap_iscsi_lun(host => $host, target => $target->{index}, lun => $lun);

Disables a LUN and unmaps it from a target.