Commit 3523f520 authored by Sebastien Gougeaud's avatar Sebastien Gougeaud Committed by Thomas Leibovici
Browse files

scheduler: fix medium selection if locked but in a device



In the previous version, if a medium was already loaded in a device, the
scheduler did not check its admin status before selecting it. Now, it
does.

Tests will be added in a future patch, to check this behavior.

Change-Id: I469a88e01cc949f3159000a2edaa86886961670e
Signed-off-by: default avatarSebastien Gougeaud <sebastien.gougeaud@cea.fr>
Reviewed-on: https://cws-fleury.labs.ocre.cea.fr/gerrit/6640


Reviewed-by: Linter
Tested-by: default avatarJenkins s8open_nr <s8open_nr@ccc.ocre.cea.fr>
Reviewed-by: default avatarQuentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: default avatarThomas Leibovici <thomas.leibovici@cea.fr>
parent e8f402f0
......@@ -1134,10 +1134,16 @@ retry:
}
/*
* The intent is to write: exclude medias that are full or do not have
* the requested tags
* The intent is to write: exclude media that are administratively
* locked, full or do not have the requested tags
*/
if (required_size > 0 && itr->dss_media_info) {
if (itr->dss_media_info->rsc.adm_status !=
PHO_RSC_ADM_ST_UNLOCKED) {
pho_debug("Media '%s' is not unlocked",
itr->dss_media_info->rsc.id.name);
continue;
}
if (itr->dss_media_info->fs.status == PHO_FS_STATUS_FULL) {
pho_debug("Media '%s' is full",
itr->dss_media_info->rsc.id.name);
......@@ -1875,6 +1881,9 @@ static int sched_media_prepare(struct lrs_sched *sched,
if (med->fs.status == PHO_FS_STATUS_BLANK)
LOG_RETURN(-EINVAL, "Cannot do I/O on unformatted media '%s'",
id->name);
if (med->rsc.adm_status != PHO_RSC_ADM_ST_UNLOCKED)
LOG_RETURN(-EPERM, "Cannot do I/O on an unavailable medium '%s'",
id->name);
post_fs_mount = true;
break;
case LRS_OP_FORMAT:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment