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

    CLI/SSH delete VMs that were set as "Protect from accidental deletion" in XO

    Scheduled Pinned Locked Moved Solved Xen Orchestra
    16 Posts 7 Posters 5.4k 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.
    • B Offline
      bobafetthotmail @olivierlambert
      last edited by

      @olivierlambert what is a "weird key" here?
      that entry was populated (or cleaned) by clicking on the "Protect from accidental deletion" and "Protect from accidental shutdown" switches in XO on a source build (in a Debian VM) with latest XCP-ng 8.2

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

        @bobafetthotmail (unknown operation): true;

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          bobafetthotmail @olivierlambert
          last edited by bobafetthotmail

          @olivierlambert That key is added (or removed) as part of this block of keys

          blocked-operations (MRW): (unknown operation): true; hard_reboot: true; pause: true; suspend: true; hard_shutdown: true; clean_reboot: true; clean_shutdown: true
          

          when I click on the "Protect from accidental shutdown" switch in the Advanced settings of the VM in Xen Orchestra.

          From the version page in XO I see
          xo-server 5.71.1
          xo-web 5.75.0

          And I have XCP-ng at 8.2 and updated packages with yum upgrade.

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

            Weird. Ping @julien-f

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

              @pdonias I believe this is due to https://github.com/vatesfr/xen-orchestra/blob/4a6724f664014630b41a38f820af49335f7cf3a1/packages/xo-web/src/xo-app/vm/tab-advanced.js#L71

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

                Indeed, shutdown alone isn't a valid operation in the XAPI enum.

                pdoniasP 1 Reply Last reply Reply Quote 0
                • pdoniasP Offline
                  pdonias Vates 🪐 XO Team @olivierlambert
                  last edited by

                  @olivierlambert That's weird because it can be set and read with XAPI calls but not with xe and if I remove it from the blocked operations (and leave all the other operations), I'm able to stop the VM with a VM.shutdown call, which is what we're trying to avoid when the option is enabled.

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

                    @pdonias so maybe a bug in xe itself? It seems xe doesn't have the full enum in XAPI, that is indeed containing shutdown (cf https://xapi-project.github.io/xen-api/classes/vm.html😞

                    vm_operations
                    Values: 	snapshot 	refers to the operation "snapshot"
                    	clone 	refers to the operation "clone"
                    	copy 	refers to the operation "copy"
                    	create_template 	refers to the operation "create_template"
                    	revert 	refers to the operation "revert"
                    	checkpoint 	refers to the operation "checkpoint"
                    	snapshot_with_quiesce 	refers to the operation "snapshot_with_quiesce"
                    	provision 	refers to the operation "provision"
                    	start 	refers to the operation "start"
                    	start_on 	refers to the operation "start_on"
                    	pause 	refers to the operation "pause"
                    	unpause 	refers to the operation "unpause"
                    	clean_shutdown 	refers to the operation "clean_shutdown"
                    	clean_reboot 	refers to the operation "clean_reboot"
                    	hard_shutdown 	refers to the operation "hard_shutdown"
                    	power_state_reset 	refers to the operation "power_state_reset"
                    	hard_reboot 	refers to the operation "hard_reboot"
                    	suspend 	refers to the operation "suspend"
                    	csvm 	refers to the operation "csvm"
                    	resume 	refers to the operation "resume"
                    	resume_on 	refers to the operation "resume_on"
                    	pool_migrate 	refers to the operation "pool_migrate"
                    	migrate_send 	refers to the operation "migrate_send"
                    	get_boot_record 	refers to the operation "get_boot_record"
                    	send_sysrq 	refers to the operation "send_sysrq"
                    	send_trigger 	refers to the operation "send_trigger"
                    	query_services 	refers to the operation "query_services"
                    	shutdown 	refers to the operation "shutdown"
                    	call_plugin 	refers to the operation "call_plugin"
                    	changing_memory_live 	Changing the memory settings
                    	awaiting_memory_live 	Waiting for the memory settings to change
                    	changing_dynamic_range 	Changing the memory dynamic range
                    	changing_static_range 	Changing the memory static range
                    	changing_memory_limits 	Changing the memory limits
                    	changing_shadow_memory 	Changing the shadow memory for a halted VM.
                    	changing_shadow_memory_live 	Changing the shadow memory for a running VM.
                    	changing_VCPUs 	Changing VCPU settings for a halted VM.
                    	changing_VCPUs_live 	Changing VCPU settings for a running VM.
                    	changing_NVRAM 	Changing NVRAM for a halted VM.
                    	assert_operation_valid 	
                    	data_source_op 	Add, remove, query or list data sources
                    	update_allowed_operations 	
                    	make_into_template 	Turning this VM into a template
                    	import 	importing a VM from a network stream
                    	export 	exporting a VM to a network stream
                    	metadata_export 	exporting VM metadata to a network stream
                    	reverting 	Reverting the VM to a previous snapshotted state
                    	destroy 	refers to the act of uninstalling the VM
                    
                    1 Reply Last reply Reply Quote 0
                    • pdoniasP Offline
                      pdonias Vates 🪐 XO Team
                      last edited by pdonias

                      @olivierlambert It would look like it. I also tried to remove everything from blocked-operations except shutdown and I was able to xe vm-shutdown the VM. But as soon as I add clean_shutdown, xe doesn't allow the shutdown anymore.

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

                        @pdonias Yeah I think shutdown is a kind of an alias for clean_shutdown. Probably for historical reasons. It explains why xe is confused.

                        1 Reply Last reply Reply Quote 0
                        • Z Zevgeny referenced this topic on
                        • Z Offline
                          Zevgeny
                          last edited by

                          I came across this post in a google search.

                          "xe vm-param-cleaner" mentioned earlier doesnt seem to exist anymore. However the following command worked for me:

                          xe vm-param-clear uuid=<vm_uuid> param-name=blocked-operations
                          
                          1 Reply Last reply Reply Quote 0
                          • L Offline
                            luca steinke @bobafetthotmail
                            last edited by

                            I had to do the following to remove the reboot block:

                            xe vm-param-remove param-name=blocked-operations param-key=hard_reboot uuid=$UUID
                            

                            And then:

                            xe vm-reboot force=true vm=$UUID
                            
                            1 Reply Last reply Reply Quote 1
                            • DanpD Danp referenced this topic on
                            • First post
                              Last post