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

Add support for libvirt removable disks and bus types #2446

Closed
wants to merge 1 commit into from

Conversation

bkopilov
Copy link
Contributor

@bkopilov bkopilov commented Jun 2, 2024

Added support for test disks different bus types: usb, virtio, sata, scsi In case usb we set the disk to removable

Added support for test disks  different bus types: usb, virtio, sata, scsi
In case usb we set the disk to removable
@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 2, 2024
@openshift-ci openshift-ci bot requested review from avishayt and tsorya June 2, 2024 07:36
Copy link

openshift-ci bot commented Jun 2, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bkopilov
Once this PR has been reviewed and has the lgtm label, please assign omertuc for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Jun 2, 2024

Hi @bkopilov. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 2, 2024
@bkopilov
Copy link
Contributor Author

bkopilov commented Jun 2, 2024

@adriengentil
Copy link
Contributor

/ok-to-test

@adriengentil
Copy link
Contributor

/cc @eliorerz

@openshift-ci openshift-ci bot requested a review from eliorerz June 4, 2024 12:44
@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2024
@adriengentil
Copy link
Contributor

@bkopilov we need to update the usb controller as well, right?

@bkopilov
Copy link
Contributor Author

bkopilov commented Jun 4, 2024

@bkopilov we need to update the usb controller as well, right?

yes , i think terraform

Copy link

openshift-ci bot commented Jun 4, 2024

@bkopilov: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 3cca54f link true /test lint
ci/prow/e2e-metal-assisted-none 3cca54f link false /test e2e-metal-assisted-none

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@eliorerz
Copy link
Contributor

eliorerz commented Jun 4, 2024

Please change the title and commit message to contain the issue number or NO-ISSUE if there isn't any.

try:
result = next(candidate for candidate in string.ascii_lowercase if candidate not in identifiers_in_use)
except StopIteration as e:
raise ValueError(f"Couldn't find available scsi disk letter, all are taken: {identifiers_in_use}") from e

return result

def attach_test_disk(self, node_name, disk_size, bootable=False, persistent=False, with_wwn=False):
def attach_test_disk(self, node_name, disk_size, bus="scsi", bootable=False, persistent=False, with_wwn=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole method is relevant only to libvirt, not sure we want it here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method called from base_test .
Calling to self.node_controller.attach_test_disk which is exists in other controllers.
libvirt is the only that use it .
What do you suggest ?

@staticmethod
    def attach_disk_flags(persistent):
        modified_nodes = set()

        def attach(node, disk_size, bus="scsi", bootable=False, with_wwn=False):
            nonlocal modified_nodes
            node.attach_test_disk(disk_size, bus=bus, bootable=bootable, persistent=persistent, with_wwn=with_wwn)
            modified_nodes.add(node)

dev = {"scsi": "sd", "sata": "sd", "usb": "sd", "virtio": "vd"}
target_dev = f"{dev[bus]}{self._get_available_identifier(node, None)}"
# Allow to create multiple devices when node shutdown required (sata)
disk_alias = f"{self.TEST_DISKS_PREFIX}{str(random.randint(0, 10000))}-{bus}-{target_dev}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain what is the random for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two ways to add:

  • VIR_DOMAIN_AFFECT_LIVE when support hotplugin (apply when execute on running node )
  • VIR_DOMAIN_AFFECT_CURRENT - for SATA we must shutdown /start the node.

Not mandatory but if the change does not return new target_dev and we want to run the command multiple time it is going to prevent duplicate disk_alias which bubble libvirt exceptions...
for example:
attach_disk_persistent(master, ODF_DISK_SIZE, bus="sata") --> success
attach_disk_persistent(master, ODF_DISK_SIZE, bus="sata") --> fail without restart but indicate that target sdb already exists ......

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 3, 2024
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 4, 2024
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Nov 3, 2024
Copy link

openshift-ci bot commented Nov 3, 2024

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants