Skip to content

deleteNetwork returns "Failed to delete network" with no reason when instances still use the network #14968

Backlog

Description

@jmsperu

ISSUE TYPE

Improvement Request

COMPONENT NAME

Management server (NetworkServiceImpl / NetworkOrchestrator), API error text

CLOUDSTACK VERSION

4.22.1.1

CONFIGURATION

KVM, advanced zone, isolated network with one running user instance.

OS / ENVIRONMENT

Ubuntu 24.04 LTS management server and KVM hosts (agent 4.22.1.1).

SUMMARY

Calling deleteNetwork on a network that still has a user instance fails with:

errorcode 530
Failed to delete network

The reason is logged only as a WARN:

Can't delete the Network, not all User Instances are expunged. Instance VM instance {...}

The user has no way to know from the API or the UI that the fix is to remove the instance first. 530 also reads as a server fault, not as a request the user can correct.

STEPS TO REPRODUCE

1. Create an isolated network and deploy one instance on it.
2. deleteNetwork id=<network>.

EXPECTED RESULTS

A 431 (or the existing code, if changing it is a concern) with text like "Network cannot be deleted because it still has instance(s), for example . Remove them first." No internal ids.

ACTUAL RESULTS

530 "Failed to delete network". The reason is only in the log.

NOTES

The check that logs the WARN already knows the blocking instance. Passing that reason up instead of returning false would be a small change. Could also be done through the #12336 message framework.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions