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
I found several old VMs in the failed state that I wanted to clean up so I ran the following on the head node:
for uuid in $(sdc-vmapi "/vms?predicate=$(urlencode '{ "eq" : [ "state", "failed" ] }')" | json -Ha uuid); do
echo "Deleting VM ${uuid}"
sdc-vmapi /vms/${uuid} -X DELETE | json -H
done
(Side note: I'm surprised "/vms?state=failed" doesn't work and requires a predicate for that particular state.)
The code above successfully created and completed a destroy job for each VM but when I look at the job details in AdminUI I see the following even for VMs that do still have NICs in NAPI in the provisioning state:
napi.remove_nics
No MAC addresses to remove
So for some reason DeleteVm is not finding the NICs associated with these VMs in NAPI which means the IP addresses associated with these NICs are not free. I'm guessing it has something to do with the fact that a zone was never actually created on a CN for the VM so perhaps it can't find the MAC addresses? However, I would expect it to look up the NICs in NAPI using ?belongs_to_uuid=<vm_uuid> regardless of whether a zone was ever created or not.
Because DeleteVm didn't find any NICs to delete I had to manually find and delete any NICs associated with any of these VMs that were in the failed state with the following code:
for uuid in $(sdc-vmapi "/vms?predicate=$(urlencode '{ "eq" : [ "state", "failed" ] }')" | json -Ha uuid); do
for mac in $(sdc-napi /nics?belongs_to_uuid=${uuid} | json -Ha mac); do
echo "Deleting NIC ${mac} under failed VM ${uuid}"
sdc-napi /nics/${mac} -X DELETE
done
done
That successfully deleted all the NICs from NAPI and freed up the IPs.
Now I wonder if there are any other steps in a DeleteVm job that need manual attention as well....
The text was updated successfully, but these errors were encountered:
I found several old VMs in the
failed
state that I wanted to clean up so I ran the following on the head node:(Side note: I'm surprised "/vms?state=failed" doesn't work and requires a predicate for that particular state.)
The code above successfully created and completed a destroy job for each VM but when I look at the job details in AdminUI I see the following even for VMs that do still have NICs in NAPI in the
provisioning
state:So for some reason DeleteVm is not finding the NICs associated with these VMs in NAPI which means the IP addresses associated with these NICs are not free. I'm guessing it has something to do with the fact that a zone was never actually created on a CN for the VM so perhaps it can't find the MAC addresses? However, I would expect it to look up the NICs in NAPI using
?belongs_to_uuid=<vm_uuid>
regardless of whether a zone was ever created or not.Because DeleteVm didn't find any NICs to delete I had to manually find and delete any NICs associated with any of these VMs that were in the
failed
state with the following code:That successfully deleted all the NICs from NAPI and freed up the IPs.
Now I wonder if there are any other steps in a DeleteVm job that need manual attention as well....
The text was updated successfully, but these errors were encountered: