Add support for deleting ondemand requests by request-id

This change enables floaty delete to accept request-ids (UUID format)
in addition to hostnames. When a request-id is detected, floaty will:

1. Cancel pending ondemand requests by marking status as 'deleted'
2. Move any already-provisioned VMs to the termination queue

Implementation:
- Modified Pooler.delete to detect UUID format and use ondemandvm endpoint
- Updated command syntax and examples to document request-id support
- Added comprehensive tests for request-id deletion
- Fixed Ruby 3.1+ compatibility by adding abbrev and base64 gems

Fixes issue where users had no way to cancel ondemand requests or
bulk-delete VMs from a completed request.
This commit is contained in:
Mahima Singh 2025-12-19 17:04:08 +05:30
parent 6b6d6f73cd
commit 4686213f49
6 changed files with 299 additions and 4 deletions

View file

@ -219,10 +219,12 @@ class Vmfloaty
command :delete do |c|
c.syntax = 'floaty delete hostname,hostname2 [options]'
c.syntax += "\n floaty delete job1,job2 [options] (only supported with ABS)"
c.syntax += "\n floaty delete request-id [options] (for ondemand requests)"
c.summary = 'Schedules the deletion of a host or hosts'
c.description = 'Given a comma separated list of hostnames, or --all for all vms, vmfloaty makes a request to the pooler service to schedule the deletion of those vms. If you are using the ABS service, you can also pass in JobIDs here. Note that passing in a Job ID will delete *all* of the hosts in the job.' # rubocop:disable Layout/LineLength
c.description = 'Given a comma separated list of hostnames, or --all for all vms, vmfloaty makes a request to the pooler service to schedule the deletion of those vms. If you are using the ABS service, you can also pass in JobIDs here. Note that passing in a Job ID will delete *all* of the hosts in the job. For vmpooler, you can also pass in a request-id (UUID format) to cancel an ondemand request and move any already-provisioned VMs to the deletion queue.' # rubocop:disable Layout/LineLength
c.example 'Schedules the deletion of a host or hosts', 'floaty delete myhost1,myhost2 --url http://vmpooler.example.com'
c.example 'Schedules the deletion of a JobID or JobIDs', 'floaty delete 1579300120799,1579300120800 --url http://abs.example.com'
c.example 'Cancels an ondemand request and deletes provisioned VMs', 'floaty delete e3ff6271-d201-4f31-a315-d17f4e15863a --url http://vmpooler.example.com'
c.option '--verbose', 'Enables verbose output'
c.option '--service STRING', String, 'Configured pooler service name'
c.option '--all', 'Deletes all vms acquired by a token'