Cannot Delete a VM Template through CLI or XE
-
Cannot Delete a VM Template
Here's the backstory, I created a few vm's (Home Assistant) by importing vmdk's, eventually these became templates these didn't work out so I decided to scrap everything, and reimport and deleting everything. In the process of deleting 2 templates remain and cannot be deleted. Both of my servers have the storage located on an NFS server.
When I try through XE I get the following results:
vm.delete { "id": "39bf95ba-1f92-4a54-1c14-d9d800ceca30" } { "code": 5, "data": { "operation": "destroy is blocked: protected from accidental deletion" }, "message": "forbidden operation: destroy is blocked: protected from accidental deletion", "name": "XoError", "stack": "XoError: forbidden operation: destroy is blocked: protected from accidental deletion at factory (/opt/xo/xo-builds/xen-orchestra-202209030304/packages/xo-common/api-errors.js:26:11) at Xapi.destroy (/opt/xo/xo-builds/xen-orchestra-202209030304/@xen-orchestra/xapi/vm.js:347:13) at Api.#callApiMethod (file:///opt/xo/xo-builds/xen-orchestra-202209030304/packages/xo-server/src/xo-mixins/api.mjs:394:20)"
and
vm.delete { "id": "f8c5d55c-560b-97c1-db39-6803fb3bc981" } { "code": 5, "data": { "operation": "destroy is blocked: protected from accidental deletion" }, "message": "forbidden operation: destroy is blocked: protected from accidental deletion", "name": "XoError", "stack": "XoError: forbidden operation: destroy is blocked: protected from accidental deletion at factory (/opt/xo/xo-builds/xen-orchestra-202209030304/packages/xo-common/api-errors.js:26:11) at Xapi.destroy (/opt/xo/xo-builds/xen-orchestra-202209030304/@xen-orchestra/xapi/vm.js:347:13) at runMicrotasks (<anonymous>) at runNextTicks (node:internal/process/task_queues:61:5) at processImmediate (node:internal/timers:437:9) at process.callbackTrampoline (node:internal/async_hooks:130:17) at Api.#callApiMethod (file:///opt/xo/xo-builds/xen-orchestra-202209030304/packages/xo-server/src/xo-mixins/api.mjs:394:20)"
By searching the forums, I tried the following commands and here are the results:
00:56 xcp-ng-server2 ~]# xe template-param-clear uuid=39bf95ba-1f92-4a54-1c14-d9d800ceca30 param-name=blocked-operations The value given is invalid field: blocked_operation value: (unknown operation) [00:58 xcp-ng-server2 ~]# xe template-param-clear uuid=39bf95ba-1f92-4a54-1c14-d9d800ceca30 param-name=is-a-template Error: Cannot clear this parameter
[01:03 xcp-ng-server2 ~]# xe template-param-clear uuid=f8c5d55c-560b-97c1-db39-6803fb3bc981 param-name=blocked-operations The value given is invalid field: blocked_operation value: (unknown operation)
Here's the details about the VM's:
[01:00 xcp-ng-server2 ~]# xe template-param-list uuid=39bf95ba-1f92-4a54-1c14-d9d800ceca30 uuid ( RO) : 39bf95ba-1f92-4a54-1c14-d9d800ceca30 name-label ( RW): Home Assistant OLD name-description ( RW): Home Assistant user-version ( RW): 1 is-a-template ( RW): true is-default-template ( RW): false is-a-snapshot ( RO): false snapshot-of ( RO): <not in database> snapshots ( RO): 86a8931f-8951-0e64-edb0-c7b28b6cb548 snapshot-time ( RO): 19700101T00:00:00Z snapshot-info ( RO): parent ( RO): 86a8931f-8951-0e64-edb0-c7b28b6cb548 children ( RO): is-control-domain ( RO): false power-state ( RO): halted memory-actual ( RO): 0 memory-target ( RO): 0 memory-overhead ( RO): 20971520 memory-static-max ( RW): 2147483648 memory-dynamic-max ( RW): 2147483648 memory-dynamic-min ( RW): 2147483648 memory-static-min ( RW): 134217728 suspend-VDI-uuid ( RW): <not in database> suspend-SR-uuid ( RW): <not in database> VCPUs-params (MRW): VCPUs-max ( RW): 2 VCPUs-at-startup ( RW): 2 actions-after-shutdown ( RW): Destroy actions-after-reboot ( RW): Restart actions-after-crash ( RW): Restart console-uuids (SRO): hvm ( RO): false platform (MRW): timeoffset: 0; secureboot: false; device-model: qemu-upstream-uefi; hpet: true; nx: true; pae: true; apic: true; viridian: true; acpi: 1 allowed-operations (SRO): changing_NVRAM; changing_dynamic_range; changing_shadow_memory; changing_static_range; migrate_send; provision; export; clone; copy current-operations (SRO): blocked-operations (MRW): (unknown operation): true; clean_shutdown: true; hard_shutdown: true; clean_reboot: true; hard_reboot: true; destroy: true; suspend: true; pause: true allowed-VBD-devices (SRO): 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100; 101; 102; 103; 104; 105; 106; 107; 108; 109; 110; 111; 112; 113; 114; 115; 116; 117; 118; 119; 120; 121; 122; 123; 124; 125; 126; 127; 128; 129; 130; 131; 132; 133; 134; 135; 136; 137; 138; 139; 140; 141; 142; 143; 144; 145; 146; 147; 148; 149; 150; 151; 152; 153; 154; 155; 156; 157; 158; 159; 160; 161; 162; 163; 164; 165; 166; 167; 168; 169; 170; 171; 172; 173; 174; 175; 176; 177; 178; 179; 180; 181; 182; 183; 184; 185; 186; 187; 188; 189; 190; 191; 192; 193; 194; 195; 196; 197; 198; 199; 200; 201; 202; 203; 204; 205; 206; 207; 208; 209; 210; 211; 212; 213; 214; 215; 216; 217; 218; 219; 220; 221; 222; 223; 224; 225; 226; 227; 228; 229; 230; 231; 232; 233; 234; 235; 236; 237; 238; 239; 240; 241; 242; 243; 244; 245; 246; 247; 248; 249; 250; 251; 252; 253; 254 allowed-VIF-devices (SRO): 1; 2; 3; 4; 5; 6 possible-hosts ( RO): f59660eb-69d0-47bb-9515-0ba77c8c7bac; 3339d77b-8888-4553-85cc-6e9c8e412de3 domain-type ( RW): hvm current-domain-type ( RO): unspecified HVM-boot-policy ( RW): BIOS order HVM-boot-params (MRW): order: c; firmware: uefi HVM-shadow-multiplier ( RW): 1.000 PV-kernel ( RW): PV-ramdisk ( RW): PV-args ( RW): PV-legacy-args ( RW): PV-bootloader ( RW): PV-bootloader-args ( RW): last-boot-CPU-flags ( RO): vendor: GenuineIntel; features: 1fcbfbff-80982221-28100800-00000001-00000000-00000000-00000000-00000000-00001000-9c000000-00000000-00000000-00000000-00000000-00000000-00000000-00000000-00000000 last-boot-record ( RO): '' resident-on ( RO): <not in database> affinity ( RW): <not in database> other-config (MRW): auto_poweron: true; base_template_name: Other install media; import_task: OpaqueRef:aeb33d97-265a-4fb9-8317-507d1447c6b1; mac_seed: 9daf299c-39ed-0831-091c-68b31d5e8395; install-methods: cdrom dom-id ( RO): -1 recommendations ( RO): <restrictions><restriction field="memory-static-max" max="137438953472"/><restriction field="vcpus-max" max="32"/><restriction field="has-vendor-device" value="false"/><restriction field="supports-bios" value="yes"/><restriction field="supports-uefi" value="yes"/><restriction field="supports-secure-boot" value="yes"/><restriction max="255" property="number-of-vbds"/><restriction max="7" property="number-of-vifs"/></restrictions> xenstore-data (MRW): vm-data/mmio-hole-size: 268435456; vm-data: ha-always-run ( RW) [DEPRECATED]: false ha-restart-priority ( RW): blobs ( RO): start-time ( RO): 19700101T00:00:00Z install-time ( RO): 19700101T00:00:00Z VCPUs-number ( RO): 0 VCPUs-utilisation (MRO): os-version (MRO): name: Home Assistant OS 8.5; uname: 5.15.60; distro: haos; major: 8; minor: 5 PV-drivers-version (MRO): major: @PRODUCT_MAJOR_VERSION@; minor: @PRODUCT_MINOR_VERSION@; micro: @PRODUCT_MICRO_VERSION@; build: @NUMERIC_BUILD_NUMBER@ PV-drivers-up-to-date ( RO) [DEPRECATED]: false memory (MRO): disks (MRO): VBDs (SRO): networks (MRO): PV-drivers-detected ( RO): false other (MRO): shutdown: ; feature-balloon: 1; feature-vcpu-hotplug: 1; feature-reboot: 1; feature-poweroff: 1; feature-suspend: 1; has-vendor-device: 0; platform-feature-xs_reset_watches: 1; platform-feature-multiprocessor-suspend: 1 live ( RO): true guest-metrics-last-updated ( RO): 20220905T12:54:01Z can-use-hotplug-vbd ( RO): unspecified can-use-hotplug-vif ( RO): unspecified cooperative ( RO) [DEPRECATED]: true tags (SRW): appliance ( RW): <not in database> snapshot-schedule ( RW): <not in database> is-vmss-snapshot ( RO): false start-delay ( RW): 0 shutdown-delay ( RW): 0 order ( RW): 0 version ( RO): 0 generation-id ( RO): hardware-platform-version ( RO): 0 has-vendor-device ( RW): false requires-reboot ( RO): false reference-label ( RO): other-install-media bios-strings (MRO): bios-vendor: Xen; bios-version: ; system-manufacturer: Xen; system-product-name: HVM domU; system-version: ; system-serial-number: ; baseboard-manufacturer: ; baseboard-product-name: ; baseboard-version: ; baseboard-serial-number: ; baseboard-asset-tag: ; baseboard-location-in-chassis: ; enclosure-asset-tag: ; hp-rombios: ; oem-1: Xen; oem-2: MS_VM_CERT/SHA1/bdbeb6e0a816d43fa6d3fe8aaef04c2bad9d3e3d
[01:35 xcp-ng-server2 ~]# xe template-param-list uuid=f8c5d55c-560b-97c1-db39-6803fb3bc981 uuid ( RO) : f8c5d55c-560b-97c1-db39-6803fb3bc981 name-label ( RW): Home Assistant Template name-description ( RW): Home Assistant user-version ( RW): 1 is-a-template ( RW): true is-default-template ( RW): false is-a-snapshot ( RO): false snapshot-of ( RO): <not in database> snapshots ( RO): snapshot-time ( RO): 19700101T00:00:00Z snapshot-info ( RO): parent ( RO): <not in database> children ( RO): is-control-domain ( RO): false power-state ( RO): halted memory-actual ( RO): 0 memory-target ( RO): 0 memory-overhead ( RO): 20971520 memory-static-max ( RW): 2147483648 memory-dynamic-max ( RW): 2147483648 memory-dynamic-min ( RW): 2147483648 memory-static-min ( RW): 134217728 suspend-VDI-uuid ( RW): <not in database> suspend-SR-uuid ( RW): <not in database> VCPUs-params (MRW): VCPUs-max ( RW): 2 VCPUs-at-startup ( RW): 2 actions-after-shutdown ( RW): Destroy actions-after-reboot ( RW): Restart actions-after-crash ( RW): Restart console-uuids (SRO): hvm ( RO): false platform (MRW): secureboot: false; device-model: qemu-upstream-uefi; timeoffset: 0; hpet: true; nx: true; pae: true; apic: true; viridian: true; acpi: 1 allowed-operations (SRO): changing_NVRAM; changing_dynamic_range; changing_shadow_memory; changing_static_range; migrate_send; provision; export; clone; copy current-operations (SRO): blocked-operations (MRW): (unknown operation): true; suspend: true; hard_shutdown: true; clean_reboot: true; clean_shutdown: true; destroy: true allowed-VBD-devices (SRO): 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100; 101; 102; 103; 104; 105; 106; 107; 108; 109; 110; 111; 112; 113; 114; 115; 116; 117; 118; 119; 120; 121; 122; 123; 124; 125; 126; 127; 128; 129; 130; 131; 132; 133; 134; 135; 136; 137; 138; 139; 140; 141; 142; 143; 144; 145; 146; 147; 148; 149; 150; 151; 152; 153; 154; 155; 156; 157; 158; 159; 160; 161; 162; 163; 164; 165; 166; 167; 168; 169; 170; 171; 172; 173; 174; 175; 176; 177; 178; 179; 180; 181; 182; 183; 184; 185; 186; 187; 188; 189; 190; 191; 192; 193; 194; 195; 196; 197; 198; 199; 200; 201; 202; 203; 204; 205; 206; 207; 208; 209; 210; 211; 212; 213; 214; 215; 216; 217; 218; 219; 220; 221; 222; 223; 224; 225; 226; 227; 228; 229; 230; 231; 232; 233; 234; 235; 236; 237; 238; 239; 240; 241; 242; 243; 244; 245; 246; 247; 248; 249; 250; 251; 252; 253; 254 allowed-VIF-devices (SRO): 1; 2; 3; 4; 5; 6 possible-hosts ( RO): f59660eb-69d0-47bb-9515-0ba77c8c7bac; 3339d77b-8888-4553-85cc-6e9c8e412de3 domain-type ( RW): hvm current-domain-type ( RO): unspecified HVM-boot-policy ( RW): BIOS order HVM-boot-params (MRW): order: c; firmware: uefi HVM-shadow-multiplier ( RW): 1.000 PV-kernel ( RW): PV-ramdisk ( RW): PV-args ( RW): PV-legacy-args ( RW): PV-bootloader ( RW): PV-bootloader-args ( RW): last-boot-CPU-flags ( RO): vendor: GenuineIntel; features: 1fcbfbff-80982221-28100800-00000001-00000000-00000000-00000000-00000000-00001000-9c000000-00000000-00000000-00000000-00000000-00000000-00000000-00000000-00000000 last-boot-record ( RO): '' resident-on ( RO): <not in database> affinity ( RW): <not in database> other-config (MRW): auto_poweron: true; base_template_name: Other install media; import_task: OpaqueRef:aeb33d97-265a-4fb9-8317-507d1447c6b1; mac_seed: cdd01320-7ef3-b290-f3de-649026af0a9c; install-methods: cdrom dom-id ( RO): -1 recommendations ( RO): <restrictions><restriction field="memory-static-max" max="137438953472"/><restriction field="vcpus-max" max="32"/><restriction field="has-vendor-device" value="false"/><restriction field="supports-bios" value="yes"/><restriction field="supports-uefi" value="yes"/><restriction field="supports-secure-boot" value="yes"/><restriction max="255" property="number-of-vbds"/><restriction max="7" property="number-of-vifs"/></restrictions> xenstore-data (MRW): vm-data/mmio-hole-size: 268435456; vm-data: ha-always-run ( RW) [DEPRECATED]: false ha-restart-priority ( RW): blobs ( RO): start-time ( RO): 19700101T00:00:00Z install-time ( RO): 19700101T00:00:00Z VCPUs-number ( RO): 0 VCPUs-utilisation (MRO): os-version (MRO): name: Home Assistant OS 8.5; uname: 5.15.60; distro: haos; major: 8; minor: 5 PV-drivers-version (MRO): major: @PRODUCT_MAJOR_VERSION@; minor: @PRODUCT_MINOR_VERSION@; micro: @PRODUCT_MICRO_VERSION@; build: @NUMERIC_BUILD_NUMBER@ PV-drivers-up-to-date ( RO) [DEPRECATED]: false memory (MRO): disks (MRO): VBDs (SRO): networks (MRO): PV-drivers-detected ( RO): false other (MRO): shutdown: ; feature-balloon: 1; feature-vcpu-hotplug: 1; feature-reboot: 1; feature-poweroff: 1; feature-suspend: 1; has-vendor-device: 0; platform-feature-xs_reset_watches: 1; platform-feature-multiprocessor-suspend: 1 live ( RO): true guest-metrics-last-updated ( RO): 20220905T12:54:01Z can-use-hotplug-vbd ( RO): unspecified can-use-hotplug-vif ( RO): unspecified cooperative ( RO) [DEPRECATED]: true tags (SRW): appliance ( RW): <not in database> snapshot-schedule ( RW): <not in database> is-vmss-snapshot ( RO): false start-delay ( RW): 0 shutdown-delay ( RW): 0 order ( RW): 0 version ( RO): 0 generation-id ( RO): hardware-platform-version ( RO): 0 has-vendor-device ( RW): false requires-reboot ( RO): false reference-label ( RO): other-install-media bios-strings (MRO): bios-vendor: Xen; bios-version: ; system-manufacturer: Xen; system-product-name: HVM domU; system-version: ; system-serial-number: ; baseboard-manufacturer: ; baseboard-product-name: ; baseboard-version: ; baseboard-serial-number: ; baseboard-asset-tag: ; baseboard-location-in-chassis: ; enclosure-asset-tag: ; hp-rombios: ; oem-1: Xen; oem-2: MS_VM_CERT/SHA1/bdbeb6e0a816d43fa6d3fe8aaef04c2bad9d3e3d
Looking for any help I can get, I don't think I included any sensitive information but if I missed something let me know!!
Thanks -
@DCT said in Cannot Delete a VM Template through CLI or XE:
xe template-param-clear uuid=39bf95ba-1f92-4a54-1c14-d9d800ceca30 param-name=is-a-template
Try this instead --
xe template-param-set is-a-template=false uuid=39bf95ba-1f92-4a54-1c14-d9d800ceca30
Then try to access the VM in XO and disable the
Protect from accidental deletion
option. Hopefully you will be able to delete it once that's done. -
This result worked!!!
Thank you very much!! -