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

    Possible to use "xo-cli vm.set blockedOperarations=<object>"?

    Scheduled Pinned Locked Moved Solved Management
    4 Posts 3 Posters 199 Views 3 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.
    • C Offline
      CodeMercenary
      last edited by

      I'm looking for a way to turn off blocking VM suspend without blocking VM stop. I see from xo-cli --list-commands that there is a vm.set described as:

      vm.set id=<string> [blockedOperations=<object>]
      

      I have, so far, been unable to figure out what to pass to blockedOperations to have it change a value. Not sure what it means by <object>.

      Passing a json string to it doesn't seem to work. I get an error that it must be an object.

      I believe I was able to blow away all blocked operations by passing nothing as that arg but I don't want to remove all of it, just the suspend. I realize that when wanting to block stop it makes sense to also block suspend because they, in essence, have the same result. I was hoping to extract an existing object from the vm properties, turn off suspend, then pass that object back to vm.set. Is my quest hopeless?

      julien-fJ 1 Reply Last reply Reply Quote 0
      • julien-fJ Offline
        julien-f Vates 🪐 Co-Founder XO Team @CodeMercenary
        last edited by

        @CodeMercenary Non-string values must be passed as JSON with xo-cli:

        xo-cli vm.set id=$id blockedOperations=json:'{ "clean_shutdown": "blocked by Julien" }'
        

        Also, entries passed to blockedOperations are merged with existing ones, if want to remove some entries, passed null as their values.

        C 1 Reply Last reply Reply Quote 1
        • olivierlambertO Offline
          olivierlambert Vates 🪐 Co-Founder CEO
          last edited by

          Pinging @julien-f

          1 Reply Last reply Reply Quote 0
          • julien-fJ Offline
            julien-f Vates 🪐 Co-Founder XO Team @CodeMercenary
            last edited by

            @CodeMercenary Non-string values must be passed as JSON with xo-cli:

            xo-cli vm.set id=$id blockedOperations=json:'{ "clean_shutdown": "blocked by Julien" }'
            

            Also, entries passed to blockedOperations are merged with existing ones, if want to remove some entries, passed null as their values.

            C 1 Reply Last reply Reply Quote 1
            • C Offline
              CodeMercenary @julien-f
              last edited by

              @julien-f Thank you, that's super helpful and even easier than I thought it would be.

              1 Reply Last reply Reply Quote 1
              • olivierlambertO olivierlambert marked this topic as a question on
              • olivierlambertO olivierlambert has marked this topic as solved on
              • First post
                Last post