Skip to main content

Useful commands in the XCP-ng Command Line Interface (CLI)

XCP-NG Useful Commands

Here are some useful commands in the XCP-ng Command Line Interface (CLI) that can help you manage and interact with your virtualization environment:

 

 

1. Listing VMs and Hosts:

    List all VMs:
    xe vm-list
    

    List all hosts:

    xe host-list

     

     

    2. VM Operations:

      Start a VM:
      xe vm-start vm=<VM UUID>

       

        Shut down a VM:
        xe vm-shutdown vm=<VM UUID>
        

         

          Reboot a VM:
          xe vm-reboot vm=<VM UUID>

           

            Suspend a VM:
            xe vm-suspend vm=<VM UUID>

             

              Reset VM Powerstate
              xe vm-reset-powerstate uuid=******* --force

               

               

              3. Host Operations:

                Reboot the host:
                xe host-reboot host=<Host UUID>

                 

                  Shutdown the host:
                  xe host-shutdown host=<Host UUID>
                  

                   

                    Put the host into maintenance mode:
                    xe host-disable host=<Host UUID>

                     

                     

                    4. Snapshot Management:

                      Take a snapshot of a VM:
                      xe vm-snapshot vm=<VM UUID> new-name-label=<Snapshot Name>


                       

                        Revert a VM to a snapshot:
                        xe vm-revert-to-snapshot snapshot=<Snapshot UUID>


                         

                          List snapshots of a VM:
                          xe snapshot-list vm=<VM UUID>

                           


                           

                          5. Storage Operations:

                            List SRs (Storage Repositories):
                            xe sr-list

                             

                              Scan for new SRs:
                              xe sr-scan

                               

                               

                              6. Networking:

                                List network interfaces on a host:
                                xe pif-list host=<Host UUID>


                                 

                                  List VM's VIFs (Virtual Network Interfaces):
                                  xe vif-list vm=<VM UUID>


                                   


                                   

                                  7. Resource Pool Operations:

                                  List resource pools:

                                  xe pool-list

                                   

                                    Create a new resource pool:
                                    xe pool-create name-label=<Pool Name>

                                     

                                     

                                    8. Performance Monitoring:

                                      Display VM performance statistics:
                                      xe vm-param-list uuid=<VM UUID> | grep guest-metrics

                                       

                                       

                                      9. Logs and Diagnostics:

                                        Display host logs:
                                        less /var/log/xensource.log


                                         

                                          Display VM logs:
                                           
                                          less /var/log/xensource/vm-logs/<VM UUID>.log
                                          

                                           

                                           

                                          These are just a few examples of the commands you can use to manage your XCP-ng environment. Be sure to refer to the official XCP-ng documentation for more details and command options specific to your version and setup. Always exercise caution when using CLI commands, especially in production environments.