Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This patch will instaall targetcli-fb package to bionic version. #1445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion virttest/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,10 @@ def create_iSCSI(params, root_dir=data_dir.get_tmp_dir()):
raise exceptions.TestError("Failed to install iscsi initiator"
" packages")
# Install linux iscsi target software targetcli
iscsi_package = ["targetcli"]
if distro.detect().version == '18' and distro.detect().name == 'Ubuntu':
Copy link
Member

@balamuruhans balamuruhans Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break in future Ubuntu releases,

iscsi_package = ["targetcli"]
if distro.detect().name == 'Ubuntu' and int(distro.detect().version) >= 18:
    iscsi_package = ["targetcli-fb"]

iscsi_package = ["targetcli-fb"]
else:
iscsi_package = ["targetcli"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have try... block,
to handle it generic for all distros, future some other distro versions might also have this naming.
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i try to install targetcli on 18.04 version it will not error out because wait_for_login(), and some times guest got crashed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better way for this would to implement a API in utils_package that would give you the package name by querying irrespective of distro, like yum whatprovides targetcli in this case for RHEL based package manager and similar in Ubuntu

if not utils_package.package_install(iscsi_package):
logging.error("Failed to install targetcli trying with scsi-"
"target-utils or tgt package")
Expand Down