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

Wait for expected number of drivers starting API #233

Merged
merged 1 commit into from
Jan 5, 2021
Merged
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
10 changes: 10 additions & 0 deletions runironic-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ export IRONIC_DEPLOYMENT="API"

. /bin/configure-ironic.sh

# Wait for ironic to load all expected drivers
# the DB query returns the number of unique hardware_type in the conductor_hardware_interfaces table
CONF_DRIVERS=$(crudini --get /etc/ironic/ironic.conf DEFAULT enabled_hardware_types | tr ',' '\n' | wc -l)
Copy link
Member

Choose a reason for hiding this comment

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

I don't know enough about how the plugins work in Ironic, but looking solely at the count makes me a little nervous.

Are there any default or builtin drivers that are always loaded, even if they are not listed in the config?

Would it make sense to compare the list of names, instead of just the count?

We've put some logic in the baremetal-operator to do a similar check, but it just waits for a non-zero count. Should that be made more sophisticated, too? That won't help the OpenShift installer, which the approach here does take care of.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know enough about how the plugins work in Ironic, but looking solely at the count makes me a little nervous.

Are there any default or builtin drivers that are always loaded, even if they are not listed in the config?

I don't think so, there is a default value for enabled_hardware_types if not mentioned in the config

Would it make sense to compare the list of names, instead of just the count?

I guess it would be more definite, although I'm not sure it would be worth the extra complexity

We've put some logic in the baremetal-operator to do a similar check, but it just waits for a non-zero count. Should that be made more sophisticated, too? That won't help the OpenShift installer, which the approach here does take care of.

Checking for a non-zero count is not reliable as the drivers are loaded individually, resulting in
https://bugzilla.redhat.com/show_bug.cgi?id=1902653

Copy link
Member Author

Choose a reason for hiding this comment

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

Should that be made more sophisticated, too?

To do this the BMO would need to know what the full list of drivers is

Copy link
Member

Choose a reason for hiding this comment

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

In the BMO we could look for the driver we're going to need for the host we're reconciling, so we don't need the full list. @andfasano did that work, I think, so maybe he has ideas about how to extend it to handle this case.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if there's a better place, but we could extract the driver name from the BareMetalHost.Spec.BMC.Address of the provisioned host and then check for it in the dependencies check here https://github.com/metal3-io/baremetal-operator/blob/d6eaf6774de775d83bdd47e04ea3d171ba7d4346/pkg/provisioner/ironic/dependencies.go#L66

while true ; do
DB_DRIVERS=$(mysql -p$MARIADB_PASSWORD -u ironic -h 127.0.0.1 ironic -e 'select count( DISTINCT hardware_type) from conductor_hardware_interfaces' -B -s --ssl || echo 0)
[ "$DB_DRIVERS" -ge "$CONF_DRIVERS" ] && break
echo "Waiting for $CONF_DRIVERS expected drivers"
sleep 5
done

exec /usr/bin/ironic-api --config-file /usr/share/ironic/ironic-dist.conf ${IRONIC_CONFIG_OPTIONS}