openshift-metal3 / dev-scripts

Scripts to automate development/test setup for openshift integration with https://github.com/metal3-io/
Apache License 2.0
92 stars 182 forks source link

appliance: fix disk attach using virt-xml #1667

Open danielerez opened 1 month ago

danielerez commented 1 month ago

When running the appliance flow, virt-xml fails when trying to add a new disk with the following error:

+(./agent/06_agent_create_cluster.sh:141): attach_appliance_diskimage(): sudo virt-xml ostest_master_0 --add-device --disk ocp/ostest/appliance.raw_master_0,device=disk,target.dev=sda
ERROR    XML error: target 'sda' duplicated for disk sources '<null>' and '/root/dev-scripts/ocp/ostest/appliance.raw_master_0'

The error is raised since the first device in domain xml is an empty cdrom disk:

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

I.e. only the cdrom disk is removed before attaching the disk image, which is causing the aforementioned error.

Hence, removing 'all' disks (instead of the first one) using virt-xml before attaching the new disks.

Note: seems that the issue is caused by this change, which has recently been reverted. But, the new behaviour should be more robust regardless.

openshift-ci[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign zaneb 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: - **[agent/OWNERS](https://github.com/openshift-metal3/dev-scripts/blob/master/agent/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
openshift-ci[bot] commented 1 month ago

Hi @danielerez. Thanks for your PR.

I'm waiting for a openshift-metal3 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](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
openshift-ci[bot] commented 1 month ago

@danielerez: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to [this](https://github.com/openshift-metal3/dev-scripts/pull/1667#issuecomment-2173807104): >/test ? Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
danielerez commented 1 month ago

/cc @bfournie /cc @andfasano