Skip to content

Commit

Permalink
Remove obsolete SPICE console option
Browse files Browse the repository at this point in the history
This was removed by kubevirt and replaced with VNC support
  • Loading branch information
agrare committed Jan 7, 2025
1 parent 4cb507a commit e899c30
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 77 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ manually, or when a new virtual machine is added.
always performs a full refresh, there are no specific targers (like
virtual machines, or hosts) implemented yet.

* The `kubeclient` gem that the provider uses to talk to the Kubernetes API
doesn't support the sub-resource mechanism used by the KubeVirt API for SPICE
details. In addition Kubernetes itself doesn't yet support sub-resources
for custom resource definitions. As a result the provider has to extract
the SPICE proxy URL from the configuration of the `spice-proxy` service.

## Notes

### How to get the default token from Kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,4 @@ def watch_vm_instances(opts = {})
def delete_vm_instance(name, namespace)
@conn.vminstances.destroy(name, namespace)
end

#
# Calculates the URL of the SPICE proxy server.
#
# @return [String] The URL of the spice proxy server.
#
def spice_proxy_url
@conn.spice_proxy_url
end
end
62 changes: 0 additions & 62 deletions app/models/manageiq/providers/kubevirt/infra_manager/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,68 +22,6 @@ def self.calculate_power_state(raw)
POWER_STATES[raw] || super
end

#
# This method is executed in the UI worker. It adds to the queue a task to retrieve the
# `remote-viewer` configuration file for a virtual machine.
#
# @return [Integer] The identifier of the task.
#
def queue_generate_remote_viewer_file
# Create the task options:
task_options = {
:action => "Generate 'remote-viewer' configuration file for VM '#{name}'"
}

# Create the queue options:
queue_options = {
:class_name => self.class.name,
:instance_id => id,
:method_name => 'generate_remote_viewer_file',
:priority => MiqQueue::HIGH_PRIORITY,
:role => 'ems_operations',
:zone => my_zone,
:args => []
}

# Add the task to the queue and return the identifier:
MiqTask.generic_action_with_callback(task_options, queue_options)
end

#
# This method is executed in the provider worker. It contacts the KubeVirt API to get the details of the connection to
# the console, and generates the `remote-viewer` configuration file.
#
# @return [String] The content of the cofiguration file.
#
def generate_remote_viewer_file
# Retrieve the details of the the virtual machine and the URL of the SPICE proxy:
vm = nil
proxy = nil
ext_management_system.with_provider_connection do |connection|
vm = connection.vm(name)
proxy = connection.spice_proxy_url
end

# The virtual machine may have multiple graphics device, get the first one that uses the SPICE protocol:
spice = vm.status.graphics.detect { |graphics| graphics.type == 'spice' }

# Generate the content of the `remote-viewer` configuration file file:
file = \
"[virt-viewer]\n" \
"type=spice\n" \
"title=#{name} - Press SHIFT+F12 to Release Cursor\n" \
"host=#{spice.host}\n" \
"port=#{spice.port}\n" \
"proxy=#{proxy}\n" \
"delete-this-file=1\n" \
"toggle-fullscreen=shift+f11\n" \
"release-cursor=shift+f12\n" \
"secure-attention=ctrl+alt+del\n"

# Return the generated file:
file
end

#
# UI Button Validation Methods
#
Expand Down

0 comments on commit e899c30

Please sign in to comment.