On Mon, Oct 2, 2023 at 11:26 AM <nicolas@devels.es> wrote:
Hi Arik,

El 2023-10-01 07:41, Arik Hadas escribió:
> On Fri, Sep 29, 2023 at 1:36 PM <nicolas@devels.es> wrote:
>
>> Hi,
>>
>> We're running oVirt 4.5. We have a template which we'd like to get
>> rid
>> of, there are no VMs based on it. However, trying to remove it oVirt
>>
>> states that:
>>
>> Cannot remove Template. The following Disk(s) are based on it:
>> (b54ee1cb-ed64-4db4-bd3d-eac8b22ea095) .
>>
>> When opening the 'Disks' subtab in the template, it appears a disk
>> (screenshot attached).
>>
>> However, when opening the oVirt Storage->Disks option, I cannot find
>> the
>> disk by the ID, not even ordering the ID column and trying to find
>> it
>> visually.
>
>> Can anyone point to the problem and a possible solution/workaround?
>
> Can you share the output of the following DB queries:
> 1. select * from base_disks where
> disk_id='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';
>

engine=# select * from base_disks where
disk_id='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';
  disk_id | wipe_after_delete | propagate_errors | disk_alias |
disk_description | shareable | sgio | disk_storage_type |
cinder_volume_type | disk_content_type | backup | backup_mode
---------+-------------------+------------------+------------+------------------+-----------+------+-------------------+--------------------+-------------------+--------+-------------
(0 filas)

> 2. select * from images where
> image_group_id='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';

engine=# select * from images where
image_group_id='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';
               image_guid              |       creation_date        |   
size     |               it_guid                |               parentid
               | imagestatus |        lastmodified        |
     vm_snapshot_id            | volume_type | volume_format |           
image_group_id            |         _create_date          | _update_date
| active | volume_classification | qcow_compat | sequence_number
--------------------------------------+----------------------------+-------------+--------------------------------------+--------------------------------------+-------------+----------------------------+--------
------------------------------+-------------+---------------+--------------------------------------+-------------------------------+--------------+--------+-----------------------+-------------+-----------------
  987fcd68-d48e-4314-bb4e-363671d222be | 2023-01-16 03:24:35.827+00 |
26843545600 | bc5c67f5-503e-4482-9628-48fcf70aa055 |
bc5c67f5-503e-4482-9628-48fcf70aa055 |           1 | 2023-01-16
03:24:35.827+00 | 67beb3b
2-3e84-4fe8-8334-9c93e8c0fff9 |           2 |             4 |
b54ee1cb-ed64-4db4-bd3d-eac8b22ea095 | 2023-01-16 03:24:37.054541+00 |   
            | t      |                     0 |           0 |             
  0
(1 fila)


> 3. select * from disk_vm_element where disk_id
> ='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';
>

engine=# select * from disk_vm_element where disk_id
='b54ee1cb-ed64-4db4-bd3d-eac8b22ea095';
  disk_id | vm_id | is_boot | disk_interface | is_using_scsi_reservation
| pass_discard
---------+-------+---------+----------------+---------------------------+--------------
(0 filas)

I don't think I ever saw this situation of having an image that is not correlated with a base_disk
I'd suggest to run another query:
select * from images where parentid='987fcd68-d48e-4314-bb4e-363671d222be';

If it doesn't return any result, take a backup of the database (just in case) and then remove the image from the database:
delete from images where image_guid='987fcd68-d48e-4314-bb4e-363671d222be';

This should make it possible to remove the template.
 

>> Thanks._______________________________________________
>> Users mailing list -- users@ovirt.org
>> To unsubscribe send an email to users-leave@ovirt.org
>> Privacy Statement: https://www.ovirt.org/privacy-policy.html
>> oVirt Code of Conduct:
>> https://www.ovirt.org/community/about/community-guidelines/
>> List Archives:
>>
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/X5DNN4IMTA77RWPLP4KHL62IXYZC23MS/