Add PostgreSQL checkpoint functionality and update related database operations
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-16 09:21:00 +11:00
parent ff1ec3f4aa
commit 6da2da3e82
8 changed files with 412 additions and 34 deletions

View File

@@ -390,7 +390,7 @@ const docTemplate = `{
},
"/api/import/vm": {
"post": {
"description": "Imports existing VM inventory data in bulk.",
"description": "Deprecated: Imports existing VM inventory data in bulk.",
"consumes": [
"application/json"
],
@@ -400,7 +400,8 @@ const docTemplate = `{
"tags": [
"inventory"
],
"summary": "Import VMs",
"summary": "Import VMs (deprecated)",
"deprecated": true,
"parameters": [
{
"description": "Bulk import payload",
@@ -430,14 +431,15 @@ const docTemplate = `{
},
"/api/inventory/vm/delete": {
"delete": {
"description": "Removes a VM inventory entry by VM ID and datacenter name.",
"description": "Deprecated: Removes a VM inventory entry by VM ID and datacenter name.",
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Cleanup VM inventory entry",
"summary": "Cleanup VM inventory entry (deprecated)",
"deprecated": true,
"parameters": [
{
"type": "string",
@@ -472,14 +474,15 @@ const docTemplate = `{
},
"/api/inventory/vm/update": {
"post": {
"description": "Queries vCenter and updates inventory records with missing details.",
"description": "Deprecated: Queries vCenter and updates inventory records with missing details.",
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Refresh VM details",
"summary": "Refresh VM details (deprecated)",
"deprecated": true,
"responses": {
"200": {
"description": "Update completed",
@@ -779,6 +782,52 @@ const docTemplate = `{
}
}
},
"/api/vcenters/cache/rebuild": {
"post": {
"description": "Rebuilds cached folder/resource-pool/host(cluster+datacenter) references from vCenter and rewrites the database cache tables.",
"produces": [
"application/json"
],
"tags": [
"vcenters"
],
"summary": "Rebuild vCenter object cache",
"parameters": [
{
"type": "string",
"description": "Optional single vCenter URL to rebuild; defaults to all configured vCenters",
"name": "vcenter",
"in": "query"
}
],
"responses": {
"200": {
"description": "Cache rebuild summary",
"schema": {
"$ref": "#/definitions/models.VcenterCacheRebuildResponse"
}
},
"400": {
"description": "Invalid request",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"405": {
"description": "Method not allowed",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "All rebuild attempts failed",
"schema": {
"$ref": "#/definitions/models.VcenterCacheRebuildResponse"
}
}
}
}
},
"/metrics": {
"get": {
"description": "Exposes Prometheus metrics for vctp.",
@@ -1517,6 +1566,52 @@ const docTemplate = `{
"type": "string"
}
}
},
"models.VcenterCacheRebuildResponse": {
"type": "object",
"properties": {
"failed": {
"type": "integer"
},
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/models.VcenterCacheRebuildResult"
}
},
"status": {
"type": "string"
},
"succeeded": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"models.VcenterCacheRebuildResult": {
"type": "object",
"properties": {
"duration_seconds": {
"type": "number"
},
"error": {
"type": "string"
},
"folder_entries": {
"type": "integer"
},
"host_entries": {
"type": "integer"
},
"resource_pool_entries": {
"type": "integer"
},
"vcenter": {
"type": "string"
}
}
}
}
}`

View File

@@ -379,7 +379,7 @@
},
"/api/import/vm": {
"post": {
"description": "Imports existing VM inventory data in bulk.",
"description": "Deprecated: Imports existing VM inventory data in bulk.",
"consumes": [
"application/json"
],
@@ -389,7 +389,8 @@
"tags": [
"inventory"
],
"summary": "Import VMs",
"summary": "Import VMs (deprecated)",
"deprecated": true,
"parameters": [
{
"description": "Bulk import payload",
@@ -419,14 +420,15 @@
},
"/api/inventory/vm/delete": {
"delete": {
"description": "Removes a VM inventory entry by VM ID and datacenter name.",
"description": "Deprecated: Removes a VM inventory entry by VM ID and datacenter name.",
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Cleanup VM inventory entry",
"summary": "Cleanup VM inventory entry (deprecated)",
"deprecated": true,
"parameters": [
{
"type": "string",
@@ -461,14 +463,15 @@
},
"/api/inventory/vm/update": {
"post": {
"description": "Queries vCenter and updates inventory records with missing details.",
"description": "Deprecated: Queries vCenter and updates inventory records with missing details.",
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Refresh VM details",
"summary": "Refresh VM details (deprecated)",
"deprecated": true,
"responses": {
"200": {
"description": "Update completed",
@@ -768,6 +771,52 @@
}
}
},
"/api/vcenters/cache/rebuild": {
"post": {
"description": "Rebuilds cached folder/resource-pool/host(cluster+datacenter) references from vCenter and rewrites the database cache tables.",
"produces": [
"application/json"
],
"tags": [
"vcenters"
],
"summary": "Rebuild vCenter object cache",
"parameters": [
{
"type": "string",
"description": "Optional single vCenter URL to rebuild; defaults to all configured vCenters",
"name": "vcenter",
"in": "query"
}
],
"responses": {
"200": {
"description": "Cache rebuild summary",
"schema": {
"$ref": "#/definitions/models.VcenterCacheRebuildResponse"
}
},
"400": {
"description": "Invalid request",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"405": {
"description": "Method not allowed",
"schema": {
"$ref": "#/definitions/models.ErrorResponse"
}
},
"500": {
"description": "All rebuild attempts failed",
"schema": {
"$ref": "#/definitions/models.VcenterCacheRebuildResponse"
}
}
}
}
},
"/metrics": {
"get": {
"description": "Exposes Prometheus metrics for vctp.",
@@ -1506,6 +1555,52 @@
"type": "string"
}
}
},
"models.VcenterCacheRebuildResponse": {
"type": "object",
"properties": {
"failed": {
"type": "integer"
},
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/models.VcenterCacheRebuildResult"
}
},
"status": {
"type": "string"
},
"succeeded": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"models.VcenterCacheRebuildResult": {
"type": "object",
"properties": {
"duration_seconds": {
"type": "number"
},
"error": {
"type": "string"
},
"folder_entries": {
"type": "integer"
},
"host_entries": {
"type": "integer"
},
"resource_pool_entries": {
"type": "integer"
},
"vcenter": {
"type": "string"
}
}
}
}
}

View File

@@ -288,6 +288,36 @@ definitions:
status:
type: string
type: object
models.VcenterCacheRebuildResponse:
properties:
failed:
type: integer
results:
items:
$ref: '#/definitions/models.VcenterCacheRebuildResult'
type: array
status:
type: string
succeeded:
type: integer
total:
type: integer
type: object
models.VcenterCacheRebuildResult:
properties:
duration_seconds:
type: number
error:
type: string
folder_entries:
type: integer
host_entries:
type: integer
resource_pool_entries:
type: integer
vcenter:
type: string
type: object
info:
contact: {}
paths:
@@ -548,7 +578,8 @@ paths:
post:
consumes:
- application/json
description: Imports existing VM inventory data in bulk.
deprecated: true
description: 'Deprecated: Imports existing VM inventory data in bulk.'
parameters:
- description: Bulk import payload
in: body
@@ -567,12 +598,14 @@ paths:
description: Server error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Import VMs
summary: Import VMs (deprecated)
tags:
- inventory
/api/inventory/vm/delete:
delete:
description: Removes a VM inventory entry by VM ID and datacenter name.
deprecated: true
description: 'Deprecated: Removes a VM inventory entry by VM ID and datacenter
name.'
parameters:
- description: VM ID
in: query
@@ -595,12 +628,14 @@ paths:
description: Invalid request
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Cleanup VM inventory entry
summary: Cleanup VM inventory entry (deprecated)
tags:
- inventory
/api/inventory/vm/update:
post:
description: Queries vCenter and updates inventory records with missing details.
deprecated: true
description: 'Deprecated: Queries vCenter and updates inventory records with
missing details.'
produces:
- application/json
responses:
@@ -612,7 +647,7 @@ paths:
description: Server error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Refresh VM details
summary: Refresh VM details (deprecated)
tags:
- inventory
/api/report/inventory:
@@ -807,6 +842,38 @@ paths:
summary: Run full snapshot repair suite
tags:
- snapshots
/api/vcenters/cache/rebuild:
post:
description: Rebuilds cached folder/resource-pool/host(cluster+datacenter) references
from vCenter and rewrites the database cache tables.
parameters:
- description: Optional single vCenter URL to rebuild; defaults to all configured
vCenters
in: query
name: vcenter
type: string
produces:
- application/json
responses:
"200":
description: Cache rebuild summary
schema:
$ref: '#/definitions/models.VcenterCacheRebuildResponse'
"400":
description: Invalid request
schema:
$ref: '#/definitions/models.ErrorResponse'
"405":
description: Method not allowed
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: All rebuild attempts failed
schema:
$ref: '#/definitions/models.VcenterCacheRebuildResponse'
summary: Rebuild vCenter object cache
tags:
- vcenters
/metrics:
get:
description: Exposes Prometheus metrics for vctp.