You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as @BryanMLima mentioned in #7095 (comment) I have some environments that were recently updated to the 4.18 from the 4.16 and there are 43 duplicate Guest OS types, specifically, those changed in this PR (#7095).
@DaanHoogland@weizhouapache, to solve this issue, we used the query below to identify the Guest OS entries that were duplicate and were not used by any VM or template.
SELECTg_os.idFROMcloud.guest_os g_os
WHEREg_os.removed IS NULLAND id NOT IN (
SELECTMIN(sub_g_os.id)
FROMcloud.guest_os sub_g_os
GROUP BYsub_g_os.display_name, sub_g_os.category_id
)
AND (
SELECTcount(*)
FROMcloud.vm_template vt
WHEREvt.state<>'Inactive'ANDvt.guest_os_id=g_os.id
) + (
SELECTcount(*)
FROMcloud.vm_instance vi
WHEREvi.removed IS NULLANDvi.guest_os_id=g_os.id
) =0;
To remove the duplicate Guest OS types and hypervisors mappings, the following queries were executed:
Normalize duplicate Guest OS:
UPDATEcloud.guest_osSET removed ="2000-01-01 00:00:00"WHERE id IN (<list of IDs>);
Normalize duplicate Guest OS hypervisors mappings:
UPDATEcloud.guest_os_hypervisorSET removed ="2000-01-01 00:00:00"WHERE guest_os_id IN (<list of IDs>);
It was used the date 2000-01-01 to easily identify that the entry was not removed by an API call. However, it is possible that in some environments, templates, and VMs were created using the duplicate entries introduced in PR#7095. Thus, it is required manual intervention to normalize these isolated cases. The following query can be executed to identify them:
SELECT*FROMcloud.guest_os g_os
WHEREg_os.removed IS NULLAND id NOT IN (
SELECTMIN(sub_g_os.id)
FROMcloud.guest_os sub_g_os
GROUP BYsub_g_os.display_name, sub_g_os.category_id
);
As @DaanHoogland mentioned in #7783 (comment), we need to find a way to automate the normalization of these isolated cases, and to validate if a Guest OS and hypervisors mappings already exists when using the method addGuestOsAndHypervisorMappings. The second is trivial, the problem lies in the automation of the normalization.
@BryanMLima , I think your scripts are a good step into solving "issue 1". I think we should not update the removed field on guest_os_hypervisor but instead the guest_os_id field. Next we must also update guest_os_id in vm_instance. After that I think we can set the abundant guest_os to removed.
I like your use of the date 2000-01-01 to make clear these where accidents and to enable further trouble shooting if we were not complete in our actions.
an extra check in addGuestOsAndHypervisorMappings to make sure such situations don't arise again
Agree with this approach, I had a quick discussion with @weizhouapache on this in similar terms.
On the second part "an extra check in addGuestOsAndHypervisorMappings to make sure such situations don't arise again", for guest OS entry check, do we need to mark "is_user_defined" as false? which I dont think it is not required to change, since it is already added.
an extra check in addGuestOsAndHypervisorMappings to make sure such situations don't arise again
Agree with this approach, I had a quick discussion with @weizhouapache on this in similar terms.
On the second part "an extra check in addGuestOsAndHypervisorMappings to make sure such situations don't arise again", for guest OS entry check, do we need to mark "is_user_defined" as false? which I dont think it is not required to change, since it is already added.
yes @harikrishna-patnala
based on what we have discussed, I pushed a commit to shapeblue repository. see #7799
Activity
[-]Duplicated guest oses in ACS 4.18.0.0[/-][+]Duplicated guest OSes in ACS 4.18.0.0[/+]DaanHoogland commentedon Jul 27, 2023
@weizhouapache there are no double mappings, do we need to solve this?
weizhouapache commentedon Jul 27, 2023
@DaanHoogland
there are no double mappings - that's the problem. It means one of the guest OS is not good (guest os mappings are missing).
weizhouapache commentedon Jul 28, 2023
as @BryanMLima mentioned in #7095 (comment)
I have some environments that were recently updated to the 4.18 from the 4.16 and there are 43 duplicate Guest OS types, specifically, those changed in this PR (#7095).DaanHoogland commentedon Jul 28, 2023
copying from #7095 (comment) :
@weizhouapache @BryanMLima , seems like we need;
BryanMLima commentedon Jul 31, 2023
@DaanHoogland @weizhouapache, to solve this issue, we used the query below to identify the Guest OS entries that were duplicate and were not used by any VM or template.
To remove the duplicate Guest OS types and hypervisors mappings, the following queries were executed:
It was used the date
2000-01-01to easily identify that the entry was not removed by an API call. However, it is possible that in some environments, templates, and VMs were created using the duplicate entries introduced in PR#7095. Thus, it is required manual intervention to normalize these isolated cases. The following query can be executed to identify them:As @DaanHoogland mentioned in #7783 (comment), we need to find a way to automate the normalization of these isolated cases, and to validate if a Guest OS and hypervisors mappings already exists when using the method
addGuestOsAndHypervisorMappings. The second is trivial, the problem lies in the automation of the normalization.weizhouapache commentedon Jul 31, 2023
@DaanHoogland @BryanMLima
great, thanks for your replies.
would like you to pick this up ?
DaanHoogland commentedon Aug 1, 2023
@BryanMLima , I think your scripts are a good step into solving "issue 1". I think we should not update the
removedfield onguest_os_hypervisorbut instead theguest_os_idfield. Next we must also updateguest_os_idinvm_instance. After that I think we can set the abundantguest_ostoremoved.I like your use of the date
2000-01-01to make clear these where accidents and to enable further trouble shooting if we were not complete in our actions.Am I missing something? (cc @weizhouapache )
harikrishna-patnala commentedon Aug 1, 2023
Agree with this approach, I had a quick discussion with @weizhouapache on this in similar terms.
On the second part "an extra check in addGuestOsAndHypervisorMappings to make sure such situations don't arise again", for guest OS entry check, do we need to mark "is_user_defined" as false? which I dont think it is not required to change, since it is already added.
weizhouapache commentedon Aug 2, 2023
yes @harikrishna-patnala
based on what we have discussed, I pushed a commit to shapeblue repository. see #7799
we can work together to fix it. @DaanHoogland @harikrishna-patnala
DaanHoogland commentedon Aug 2, 2023
@weizhouapache, I added some pseudo code for the deduplication, will refine that later today.
BryanMLima commentedon Aug 2, 2023
I would like to, though at the moment I am focusing on other tasks, I will help to review and test the PR and any other way I can.
DaanHoogland commentedon Aug 10, 2023
I am working on this though still privately. I'll share something later today or tomorrow.
DaanHoogland commentedon Aug 11, 2023
@BryanMLima @weizhouapache see my comment in #7781. (should we keep multiple issues open for this work?
BryanMLima commentedon Aug 15, 2023
I think it is for the best to maintain multiple issues, even though they are similar and are being addressed in the same PR.
weizhouapache commentedon Aug 23, 2023
fixed by #7799