Skip to content

snapshot resourcecount not updated when deleting a failed VM snapshot #12927

@andrea-janna

Description

@andrea-janna

problem

If I take a VM instance instance snapshot and that shapshot fails (#12871) the snapshot resourcecount increases by one.
The problem is that the resourcecount doesn't decrease when I delete that failed snapshot.

versions

CloudStack 4.22.0
KVM hypervisor
Ceph storage
Rocky Linux 10

The steps to reproduce the bug

(localcloud) 🐱 > update resourcecount domainid=3a5204fc-7280-4318-b13a-8923357462b3 resourcetype=3
{
  "count": 1,
  "resourcecount": [
    {
      "domain": "DPSS",
      "domainid": "3a5204fc-7280-4318-b13a-8923357462b3",
      "domainpath": "ROOT/DPSS",
      "resourcecount": 28,
      "resourcetype": "3",
      "resourcetypename": "snapshot"
    }
  ]
}

Taking a snapshot the resourcecount increases from 28 to 29.

(localcloud) 🐱 > create vmsnapshot virtualmachineid=0c7d8c55-753b-401d-b719-93284b653122 quiescevm=true name=test
{
  "account": "admin",
  "accountid": "343654c8-dd39-11f0-80ce-405b7f9c291c",
  "cmd": "org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd",
  "completed": "2026-03-31T11:53:59+0200",
  "created": "2026-03-31T11:53:57+0200",
  "domainid": "50618dea-dd37-11f0-80ce-405b7f9c291c",
  "domainpath": "ROOT",
  "jobid": "cf4acfc7-d65d-47e0-9681-8b05e0e5a743",
  "jobinstancetype": "VmSnapshot",
  "jobprocstatus": 0,
  "jobresult": {
    "errorcode": 530,
    "errortext": "Failed to create vm snapshot: [VMSnapshot {\"id\":173,\"name\":\"i-4-21-VM_VS_20260331095357\",\"uuid\":\"20189ea2-92db-44fe-8954-db79ccac401a\",\"vmId\":21}] due to: can't handle quiescevm equal true for volume snapshot"
  },
  "jobresultcode": 530,
  "jobresulttype": "object",
  "jobstatus": 2,
  "userid": "34368425-dd39-11f0-80ce-405b7f9c291c"
}
🙈 Error: async API failed for job cf4acfc7-d65d-47e0-9681-8b05e0e5a743
(localcloud) 🐱 > update resourcecount domainid=3a5204fc-7280-4318-b13a-8923357462b3 resourcetype=3
{
  "count": 1,
  "resourcecount": [
    {
      "domain": "DPSS",
      "domainid": "3a5204fc-7280-4318-b13a-8923357462b3",
      "domainpath": "ROOT/DPSS",
      "resourcecount": 29,
      "resourcetype": "3",
      "resourcetypename": "snapshot"
    }
  ]
}

But even after deleting the snapshot the resource count stays at 29.

(localcloud) 🐱 > delete vmsnapshot vmsnapshotid=20189ea2-92db-44fe-8954-db79ccac401a
{
  "success": true
}
(localcloud) 🐱 > update resourcecount domainid=3a5204fc-7280-4318-b13a-8923357462b3 resourcetype=3
{
  "count": 1,
  "resourcecount": [
    {
      "domain": "DPSS",
      "domainid": "3a5204fc-7280-4318-b13a-8923357462b3",
      "domainpath": "ROOT/DPSS",
      "resourcecount": 29,
      "resourcetype": "3",
      "resourcetypename": "snapshot"
    }
  ]
}

What to do about it?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    In Progress

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions