k8snetworkplumbingwg / sriov-network-operator

Operator for provisioning and configuring SR-IOV CNI plugin and device plugin
Apache License 2.0
84 stars 114 forks source link

openstack: dynamically mount the config-drive #773

Closed EmilienM closed 1 month ago

EmilienM commented 2 months ago

When we want to use config-drive in immutable systems, very often the config-drive is only used at boot and then umounted (e.g. ignition does this).

Later when we want to fetch Metadata from the config drive, we actually have to mount it.

In this PR, I'm adding similar code than coreos/ignition where we dynamically mount the config-drive is the device was found with the right label (config-2 or CONFIG-2 as documented in OpenStack). If the device is found, we mount it, fetch the data and umount it.

github-actions[bot] commented 2 months ago

Thanks for your PR, To run vendors CIs, Maintainers can use one of:

coveralls commented 2 months ago

Pull Request Test Coverage Report for Build 10997470993

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/platforms/openstack/openstack.go 5 67 7.46%
<!-- Total: 5 67 7.46% -->
Totals Coverage Status
Change from base Build 10979758277: -0.1%
Covered Lines: 6628
Relevant Lines: 14763

💛 - Coveralls
EmilienM commented 2 months ago

It's open for review but I haven't tested it yet.

/hold

bn222 commented 2 months ago

/lgtm thanks

EmilienM commented 2 months ago

Just an update on this, the current patch doesn't work yet, I'm reworking it here: https://github.com/openshift/sriov-network-operator/pull/1004 so I can get CI feedback fairly quickly. I'll update this PR as soon as I have satisfying results and ask for reviews here.

EmilienM commented 2 months ago

I got a successful CI run:

2024-09-12T22:31:21.02913626Z   INFO    daemon/writer.go:65 CreateOpenstackDevicesInfo()
2024-09-12T22:31:21.029146361Z  INFO    openstack/openstack.go:118  reading OpenStack meta_data from config-drive
2024-09-12T22:31:21.057448323Z  INFO    openstack/openstack.go:225  found config drive device   {"device": "/dev/sr0"}
2024-09-12T22:31:21.065428364Z  INFO    openstack/openstack.go:229  mounted config drive %s into %s {"/dev/sr0": "/tmp/sriov-configdrive2821721804"}
2024-09-12T22:31:21.066344839Z  INFO    openstack/openstack.go:118  reading OpenStack network_data from config-drive
2024-09-12T22:31:21.079312593Z  INFO    openstack/openstack.go:234  umounted config drive   {"path": "/tmp/sriov-configdrive2821721804"}

https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_sriov-network-operator/1004/pull-ci-openshift-sriov-network-operator-master-e2e-openstack-nfv-config-drive/1834316002138001408/artifacts/e2e-openstack-nfv-config-drive/gather-extra/artifacts/pods/openshift-sriov-network-operator_sriov-network-config-daemon-5mhxf_sriov-network-config-daemon.log

EmilienM commented 2 months ago

@SchSeba @zeeke please review :)

SchSeba commented 2 months ago

Hi @EmilienM can you check the unit tests please

EmilienM commented 1 month ago

@SchSeba done, and sorry for the typo.

EmilienM commented 1 month ago

/hold cancel