The virtual machine won't shutdown/ start up and the error shows:
Running: xm destroy akoylwny4mjlcn Error: Domain 'akoylwny4mjlcn' does not exist.
This indicates that the machine is not running on the set hypervisor for the VM. To check the status of the VM on the hypervisor you will need to find out the domain name of the VM which is what the xen hypervisor uses to identify VM's. To find this you will need to log into the CP server and then log into the mysql command prompt to get the VM details. You will need to know the virtual_machine id which can be found in the url when looking at the virtual_machine overview page or you will see the id in the transaction log in the target column (VirtualMachine#18).
From the MySQL command prompt run the following commands
mysql> use onapp; mysql> select * from virtual_machines where id = 18;
From the query output you will see the machine details, you will want to look at both the hypervisor id and the booted status also you will want to make a note of the identifier for the machine. There are 2 potential problems that will likely cause this error.
The first being that the booted status in the database was not updated during a previous shutdown and the other would be that the hypervisor id is not set correctly so the vm could be running on a different hypervisor. To confirm which one is causing the problem you will need to make an SSH connection to each hypervisor and run the following command to view the machines running on the hypervisor
[ root@localhost ~]# xm list Name ID Mem VCPUs State Time(s) 7cjjsti5gxo0sq 43 1024 1 -b---- 23.3 Domain-0 0 400 8 r----- 279544.4
If the VM is running on the hypervisor the identifier listed in the database for the VM will be listed in the name column of the xm command. After checking all of the hypervisors to see if the VM is running on any of them you will then know what you need to do to correct the problem. If you do find that the VM is running on a hypervisor that is different from the one assigned in the database you will need to SSH to the CP server and then update the hypervisor_id for the VM in the database table. An example of that command would be (this would be if we found the VM running on HV1)
mysql> use onapp; mysql> update virtual_machines set hypervisor_id = 1 where id = 18;
After updating the hypervisor id for the VM you should then be able to go to the CP UI and turn off the VM. If the VM was not running on any of the hypervisors then you need to change the booted status in the database table to 0 using the following command
mysql> use onapp; mysql> update virtual_machines set booted = 0 where id = 18;