Tuesday, June 11, 2013

Forcing a restart of VM on XenCenter

Background:

  • So one of our vms where running at 100% and with no available memory, as OOM kicked in... 


On XenCenter you have two options, either restart the machine gracefully or hard. I first tried to do it gracefully, but ran into a issue, as it was taking nearly 20mins for the restart command to start. Then I decided to right-click force shutdown, but this did nothing. It seems that when XenCenter wants to gracefully restart it connects to the machine to initiate the shutdown/restart command. If the vm is hung then obviously this process will sit at wait.

Once option would be to forcefully kill the tasks associated with this. This can be done via the command option on the XenCenter server,


 
# xe task-list
uuid ( RO)                : d4c42a68-7a97-f774-6fe6-ec8b1b1d03b9
          name-label ( RO): Connection to VM console
    name-description ( RO): 
              status ( RO): pending
            progress ( RO): 0.000
# xe task-cancel force=true uuid=d4c42a68-7a97-f774-6fe6-ec8b1b1d03b9
#


If this doesn't work, then you can always restart the xe-toolstack with the following command

 
# xe-toolstack-restart
Stopping xapi: ..                                          [  OK  ]
Stopping the v6 licensing daemon:                          [  OK  ]
Stopping the memory ballooning daemon:                     [  OK  ]
Stopping perfmon:                                          [  OK  ]
Stopping the xenopsd daemon:                               [  OK  ]
Stopping the XCP RRDD daemon:                              [  OK  ]
Stopping the XCP networking daemon:                        [  OK  ]
Stopping the fork/exec daemon:                             [  OK  ]
Starting the fork/exec daemon:                             [  OK  ]
Starting the XCP networking daemon: .                      [  OK  ]
Starting the XCP RRDD daemon:                              [  OK  ]
Starting the xenopsd daemon:                               [  OK  ]
Starting perfmon:                                          [  OK  ]
Starting the memory ballooning daemon:                     [  OK  ]
Starting the v6 licensing daemon:                          [  OK  ]
Starting xapi: OK                                          [  OK  ]
done.
#


After I ran this, the status in the GUI changed to still running. Then I proceeded to forcefully shutdown the host which did work. Doing it this way you might end of loosing data, but at least you get the vm back :)

Cheers,
D

No comments:

Post a Comment