XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Shutting down "Protect from accidental shutdown" VMs from command line

    Scheduled Pinned Locked Moved Xen Orchestra
    2 Posts 2 Posters 2.5k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      Zevgeny
      last edited by

      Hi, yesterday I got myself into a silly predicament when the VM I was using to run Xen Orchestra got stuck during its shutdown. It had been set to block accidental shutdowns, so I was unable to force shutdown using XCP-NG Centre, or the regular shutdown command on CLI. As far as I can tell, XCP-NG Centre is unable to toggle the "protect from accidental shutdown" setting, so I was pretty much stuck.

      Google search turned up this thread:
      https://xcp-ng.org/forum/topic/3885/cli-ssh-delete-vms-that-were-set-as-protect-from-accidental-deletion-in-xo

      There's a post in there that mentioned "xe vm-param-cleaner", but that command doesnt exist.

      As a guess, I tried this command instead, and it was able to clear the setting so I could do a force shutdown from command line:

      xe vm-param-clear uuid=<vm_uuid> param-name=blocked-operations
      

      Just posting this as a reference for future generations.

      Maybe there should be a CLI command for "really force shutdown like I really really mean it", that ignores the "Protect" setting? With a confirmation prompt or something?

      B 1 Reply Last reply Reply Quote 0
      • B Offline
        bern @Zevgeny
        last edited by

        @Zevgeny Did you succeed to remove the protection with "xe vm-param-clear"?

        It didn't worked perfectly for me.

        Before I use xe vm-param-clear, I have the following:

        [18:28 xcpng02 ~]# xe vm-param-list uuid=37b7a201-eb45-b7de-5ce4-da25b1c7b547 | grep block
                            blocked-operations (MRW): pause: true; hard_shutdown: true; (unknown operation): true; hard_reboot: true; clean_shutdown: true; suspend: true; clean_reboot: true
        [18:28 xcpng02 ~]# 
        

        Now I try to clean:

        [18:28 xcpng02 ~]# xe vm-param-clear uuid=37b7a201-eb45-b7de-5ce4-da25b1c7b547 param-name=blocked-operations
        The value given is invalid
        field: blocked_operation
        value: (unknown operation)
        [18:28 xcpng02 ~]#
        

        After, "blocked-operations" looks like this:

        [18:28 xcpng02 ~]# xe vm-param-list uuid=37b7a201-eb45-b7de-5ce4-da25b1c7b547 | grep block
                            blocked-operations (MRW): (unknown operation): true; hard_reboot: true; clean_shutdown: true; suspend: true; clean_reboot: true
        [18:30 xcpng02 ~]# 
        

        In the GUI of XOA, the "Protect from accidental shutdown" is removed but not on the command line.

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post