Allow VMs not provisioned by Cloudforms to retire

By default CloudForms does not allow for deleting of VMs not provisioned by it. There is however an override that you can apply by creating a tag category called “lifecycle” and a tag called “retire_full” and then apply it to the VM. Otherwise you can modify the /Factory/VM/DeleteFromVC and remove the check in there. I believe /Factory/VM/delete_from_vmdb has this same check in there. Below is a snippet:

# Get vm from root object 
vm = $evm.root['vm']
category = "lifecycle" 
tag = "retire_full"

miq_guid = /\w*MIQ\sGUID/i
if vm.v_annotation =~ miq_guid 
   vm_was_provisioned = true 
else
   vm_was_provisioned = false end

if vm && (vm_was_provisioned || vm.miq_provision || vm.tagged_with?(category,tag)) 
    ems = vm.ext_management_system 
    log(:info, "Deleting VM:<#{vm.name}> from EMS:<#{ems ? ems.name : nil}>")   
    vm.remove_from_disk 
end

Executing troubleshooting commands inside a namespace

Here is how you can execute some troubleshooting commands as if you were running them on a virtual router inside Neutron.

[root@serverX ~(keystone_admin)]# neutron router-list
[root@serverX ~(keystone_admin)]# ip netns
[root@serverX ~(keystone_admin)]# ip netns exec qrouter-10bf634d-3228-4041-8f3a-4d5e0e603c07 ping
8.8.8.8
[root@serverX ~(keystone_admin)]# ip netns exec qrouter-10bf634d-3228-4041-8f3a-4d5e0e603c07 netstat
-rn

*  Kernel namespaces are used to secure virtual networks from each other.    This is great from a security perspective but sometimes makes troubleshooting harder.