Small CR and preparatory work for CI
This commit is contained in:
parent
9252b4e779
commit
da04033abc
|
|
@ -191,7 +191,8 @@ jobs:
|
||||||
max-parallel: 1
|
max-parallel: 1
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- zfs-generic/iscsi.yaml
|
- zfs-generic/iscsi-pcs.yaml
|
||||||
|
- zfs-generic/iscsi-targetcli.yaml
|
||||||
- zfs-generic/nfs.yaml
|
- zfs-generic/nfs.yaml
|
||||||
- zfs-generic/smb.yaml
|
- zfs-generic/smb.yaml
|
||||||
- zfs-generic/nvmeof.yaml
|
- zfs-generic/nvmeof.yaml
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
driver: zfs-generic-iscsi
|
||||||
|
|
||||||
|
sshConnection:
|
||||||
|
host: ${SERVER_HOST}
|
||||||
|
port: 22
|
||||||
|
username: ${SERVER_USERNAME}
|
||||||
|
password: ${SERVER_PASSWORD}
|
||||||
|
|
||||||
|
zfs:
|
||||||
|
datasetParentName: tank/ci/${CI_BUILD_KEY}/v
|
||||||
|
detachedSnapshotsDatasetParentName: tank/ci/${CI_BUILD_KEY}/s
|
||||||
|
|
||||||
|
zvolCompression:
|
||||||
|
zvolDedup:
|
||||||
|
zvolEnableReservation: false
|
||||||
|
zvolBlocksize:
|
||||||
|
|
||||||
|
iscsi:
|
||||||
|
targetPortal: ${SERVER_HOST}
|
||||||
|
interface: ""
|
||||||
|
namePrefix: "csi-ci-${CI_BUILD_KEY}-"
|
||||||
|
nameSuffix: ""
|
||||||
|
shareStrategy: "pcs"
|
||||||
|
shareStrategyPcs:
|
||||||
|
pcs_group: "group-nas"
|
||||||
|
basename: "iqn.2003-01.org.linux-iscsi.ubuntu-19.x8664"
|
||||||
|
auth:
|
||||||
|
enabled: 0
|
||||||
|
|
@ -302,25 +302,22 @@ create /backstores/block/${assetName}
|
||||||
basename = this.options.iscsi.shareStrategyPcs.basename;
|
basename = this.options.iscsi.shareStrategyPcs.basename;
|
||||||
pcs_group = this.options.iscsi.shareStrategyPcs.pcs_group;
|
pcs_group = this.options.iscsi.shareStrategyPcs.pcs_group;
|
||||||
|
|
||||||
let groupText = `group ${pcs_group}`;
|
let groupTerms = ['group', `${pcs_group}`];
|
||||||
let createTargetText = [
|
let createTargetTerms = [
|
||||||
`resource create --future target-${assetName} iSCSITarget`,
|
'resource', 'create', '--future', `target-${assetName}`, 'iSCSITarget',
|
||||||
'implementation="lio-t"',
|
'implementation="lio-t"', `iqn="${basename}:${assetName}"`
|
||||||
`iqn="${basename}:${assetName}"`
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (this.options.iscsi.shareStrategyPcs.auth.enabled) {
|
if (this.options.iscsi.shareStrategyPcs.auth.enabled) {
|
||||||
createTargetText.push(`incoming_username="${this.options.iscsi.shareStrategyPcs.auth.incoming_username}"`);
|
createTargetTerms.push(`incoming_username="${this.options.iscsi.shareStrategyPcs.auth.incoming_username}"`);
|
||||||
createTargetText.push(`incoming_password="${this.options.iscsi.shareStrategyPcs.auth.incoming_password}"`);
|
createTargetTerms.push(`incoming_password="${this.options.iscsi.shareStrategyPcs.auth.incoming_password}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
createTargetText.push(groupText);
|
|
||||||
|
|
||||||
await GeneralUtils.retry(
|
await GeneralUtils.retry(
|
||||||
3,
|
3,
|
||||||
2000,
|
2000,
|
||||||
async () => {
|
async () => {
|
||||||
await this.pcsCommand(createTargetText);
|
await this.pcsCommand(createTargetTerms.concat(groupTerms));
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
retryCondition: (err) => {
|
retryCondition: (err) => {
|
||||||
|
|
@ -332,19 +329,17 @@ create /backstores/block/${assetName}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let createLunText = [
|
let createLunTerms = [
|
||||||
`resource create --future lun-${assetName} iSCSILogicalUnit`,
|
'resource', 'create', '--future', `lun-${assetName}`, 'iSCSILogicalUnit',
|
||||||
'implementation="lio-t"',
|
'implementation="lio-t"', `target_iqn="${basename}:${assetName}" lun="1"`,
|
||||||
`target_iqn="${basename}:${assetName}" lun="1"`,
|
`path="/dev/${extentDiskName}"`
|
||||||
`path="/dev/${extentDiskName}"`,
|
|
||||||
groupText
|
|
||||||
];
|
];
|
||||||
|
|
||||||
await GeneralUtils.retry(
|
await GeneralUtils.retry(
|
||||||
3,
|
3,
|
||||||
2000,
|
2000,
|
||||||
async () => {
|
async () => {
|
||||||
await this.pcsCommand(createLunText);
|
await this.pcsCommand(createLunTerms.concat(groupTerms));
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
retryCondition: (err) => {
|
retryCondition: (err) => {
|
||||||
|
|
@ -754,7 +749,7 @@ delete ${assetName}
|
||||||
break;
|
break;
|
||||||
case "pcs":
|
case "pcs":
|
||||||
let deleteLunText = [
|
let deleteLunText = [
|
||||||
`resource delete lun-${assetName}`
|
'resource', 'delete', `lun-${assetName}`
|
||||||
];
|
];
|
||||||
|
|
||||||
await GeneralUtils.retry(
|
await GeneralUtils.retry(
|
||||||
|
|
@ -774,7 +769,7 @@ delete ${assetName}
|
||||||
);
|
);
|
||||||
|
|
||||||
let deleteTargetText = [
|
let deleteTargetText = [
|
||||||
`resource delete target-${assetName}`
|
'resource', 'delete', `target-${assetName}`
|
||||||
];
|
];
|
||||||
|
|
||||||
await GeneralUtils.retry(
|
await GeneralUtils.retry(
|
||||||
|
|
@ -962,7 +957,7 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pcsCommand(commandLines) {
|
async pcsCommand(commandTerms) {
|
||||||
const execClient = this.getExecClient();
|
const execClient = this.getExecClient();
|
||||||
const driver = this;
|
const driver = this;
|
||||||
|
|
||||||
|
|
@ -978,7 +973,7 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
|
||||||
|
|
||||||
let cliCommand = [];
|
let cliCommand = [];
|
||||||
cliCommand.push(cliArgs.join(" "));
|
cliCommand.push(cliArgs.join(" "));
|
||||||
cliCommand.push(commandLines.join(" "));
|
cliCommand.push(commandTerms.join(" "));
|
||||||
args.push("'" + cliCommand.join(" ") + "'");
|
args.push("'" + cliCommand.join(" ") + "'");
|
||||||
|
|
||||||
let logCommandTmp = command + " " + args.join(" ");
|
let logCommandTmp = command + " " + args.join(" ");
|
||||||
|
|
@ -994,7 +989,7 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
driver.ctx.logger.verbose("Pcs command:" + logCommand);
|
driver.ctx.logger.verbose("pcs command:" + logCommand);
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
pty: true,
|
pty: true,
|
||||||
|
|
@ -1004,7 +999,7 @@ save_config filename=${this.options.nvmeof.shareStrategySpdkCli.configPath}
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
driver.ctx.logger.verbose(
|
driver.ctx.logger.verbose(
|
||||||
"Pcs response: " + JSON.stringify(response)
|
"pcs response: " + JSON.stringify(response)
|
||||||
);
|
);
|
||||||
if (response.code != 0) {
|
if (response.code != 0) {
|
||||||
throw response;
|
throw response;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue