mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
fix(nico-sim): retry virsh define (#1363)
On the arm64 CI runners a define fails for a while with "Unable to find 'efi' firmware", and the instance stays in Error. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
This commit is contained in:
@@ -33,8 +33,10 @@ type virsh struct {
|
||||
}
|
||||
|
||||
const (
|
||||
startAttempts = 3
|
||||
startRetryDelay = 2 * time.Second
|
||||
startAttempts = 3
|
||||
startRetryDelay = 2 * time.Second
|
||||
defineAttempts = 6
|
||||
defineRetryDelay = 30 * time.Second
|
||||
)
|
||||
|
||||
func (r *virsh) EnsureBridge(ctx context.Context, bridgeName, bridgeCIDR string) error {
|
||||
@@ -93,7 +95,11 @@ func (r *virsh) CreateAndStart(ctx context.Context, spec vm.InstanceSpec) (strin
|
||||
return "", fmt.Errorf("failed to write domain xml: %w", err)
|
||||
}
|
||||
|
||||
if _, err := r.runVirsh(ctx, "define", xmlPath); err != nil {
|
||||
// On the arm64 CI runners a define can fail for a while with "Unable to find 'efi' firmware"; a later one works.
|
||||
if err := retry(ctx, defineAttempts, defineRetryDelay, func() error {
|
||||
_, defineErr := r.runVirsh(ctx, "define", xmlPath)
|
||||
return defineErr
|
||||
}); err != nil {
|
||||
return "", fmt.Errorf("virsh define failed: %w", err)
|
||||
}
|
||||
if _, err := r.runVirsh(ctx, "autostart", spec.DomainName); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user