You have got to love informative error messages. This one right here is one of the most obscure ones I have seen so far:
Exit Maintenance Mode Failed
(“‘NoneType’ object has no attribute ‘xenapi'”,) in XenServer
This error message came up in XenServer after a reboot any time I would try to make my XenServer host exit maintenance mode. Also, I only noticed that the host was in maintenance mode because I could not launch any VM. Trying to launch a VM would result in an error message telling me to exit maintenance mode first.
Luckily, even if the error message itself is absolutely useless, the solution was extremely simple: free up some disk space.
I am not talking about SR space, that has nothing to do with this, I am talking about disk space on your boot device. In my case, since I am booting XenServer from a 16 GB USB drive, I had run out of available disk space.
The quickest way to free up some disk space is to remove the logs in /var/logs. I had several MBs worth of log files in there, and as soon as I removed them and rebooted the host, I could exit maintenance mode and launch my VMs as usual.
Note: you need to reboot the server after clearing the logs. For some reason, you will not be able to exit maintenance mode if you don’t reboot first, even if the disk space is available again.