Expand lab seed tiers, OpenAPI PARAMS, and console DATA/Params UX.
This commit is contained in:
@@ -277,7 +277,14 @@ async def guest_customization_get(
|
||||
) -> dict[str, Any]:
|
||||
obj = await vm_ops.require_vm(database, vm)
|
||||
customization = obj.props.get("customization")
|
||||
return customization if isinstance(customization, dict) else {}
|
||||
if isinstance(customization, dict) and customization:
|
||||
return customization
|
||||
# Seed / probe may wipe the field with POST {}; keep a non-empty lab view.
|
||||
return {
|
||||
"name": obj.name,
|
||||
"status": "PENDING",
|
||||
"spec": {"hostname": obj.name, "domain": "lab.local"},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/api/vcenter/vm/{vm}/guest/networking")
|
||||
@@ -352,6 +359,8 @@ async def guest_customization(
|
||||
_: SessionInfo = Depends(require_privilege("VirtualMachine.Config.Rename")),
|
||||
) -> dict[str, str]:
|
||||
obj = await vm_ops.require_vm(database, vm)
|
||||
if not isinstance(body, dict) or not body:
|
||||
raise invalid_argument("customization spec is required")
|
||||
props = dict(obj.props)
|
||||
props["customization"] = body
|
||||
await inventory.update_props(database, vm, props)
|
||||
@@ -375,8 +384,13 @@ async def guest_local_filesystem(
|
||||
) -> dict[str, Any]:
|
||||
obj = await vm_ops.require_vm(database, vm)
|
||||
filesystems = obj.props.get("guest_filesystems")
|
||||
return filesystems if isinstance(filesystems, dict) else {}
|
||||
|
||||
if isinstance(filesystems, dict) and filesystems:
|
||||
return filesystems
|
||||
return {
|
||||
"filesystems": {
|
||||
"/": {"capacity": 42949672960, "free_space": 21474836480},
|
||||
}
|
||||
}
|
||||
|
||||
@router.get("/api/vcenter/vm/{vm}/guest/filesystem")
|
||||
async def guest_filesystem_get(
|
||||
|
||||
Reference in New Issue
Block a user