Skip to content

feat: implement KVM enable and disable flow using ServiceEnabled#964

Merged
amarnath-ac merged 1 commit into
redfishfrom
kvm_enable_disable
May 19, 2026
Merged

feat: implement KVM enable and disable flow using ServiceEnabled#964
amarnath-ac merged 1 commit into
redfishfrom
kvm_enable_disable

Conversation

@amarnath-ac
Copy link
Copy Markdown
Contributor

Map ServiceEnabled updates to KVM enable/disable operations with corresponding controller and repository changes

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 68.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.49%. Comparing base (921de61) to head (b601c1c).

Files with missing lines Patch % Lines
redfish/internal/mocks/mock_repo.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           redfish     #964      +/-   ##
===========================================
+ Coverage    41.22%   41.49%   +0.26%     
===========================================
  Files          152      152              
  Lines        14345    14370      +25     
===========================================
+ Hits          5914     5963      +49     
+ Misses        7858     7834      -24     
  Partials       573      573              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amarnath-ac amarnath-ac force-pushed the kvm_capabilities branch 5 times, most recently from e712ba7 to d1b1704 Compare May 14, 2026 11:41
@amarnath-ac amarnath-ac force-pushed the kvm_enable_disable branch from 9c1e9b3 to cf7dd29 Compare May 15, 2026 07:39
@amarnath-ac amarnath-ac marked this pull request as ready for review May 15, 2026 08:35
@amarnath-ac amarnath-ac force-pushed the kvm_enable_disable branch from cf7dd29 to fc4b1a3 Compare May 15, 2026 08:42
Base automatically changed from kvm_capabilities to redfish May 16, 2026 09:15
Comment thread redfish/internal/usecase/wsman_repo.go
Copy link
Copy Markdown
Contributor

@sudhir-intc sudhir-intc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the KVM service status provided across ISM and AMT devices ?
I tested using following API's on AMT and ISM systems:

# Set environment variables
export CONSOLE_HOST=""
export CONSOLE_USER="admin"
export CONSOLE_PASS=""
export SYSTEM_ID=""

# Enable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": true}}'

# Disable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": false}}'

# Verify current state
curl -sk \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" | jq .GraphicalConsole

Here's my observations:

  1. On AMT Systems
  • Initially ServiceEnabled is set to True and KVMStatus is set to Enabled.
  • PATCH request of ServiceEnabled to true updates KVMStatus to Enabled and ServiceEnabled to true
  • PATCH request of ServiceEnabled to false updates KVMStatus to Disabled and ServiceEnabled to false
  1. On ISM Systems
  • Initially ServiceEnabled is set to False and KVMStatus is set to Disabled.
  • PATCH request for ServiceEnabled succeeds - Should it not fail ?
  • Post PATCH request when queried, ServiceEnabled is set to false and KVMStatus as Disabled.

@amarnath-ac
Copy link
Copy Markdown
Contributor Author

How is the KVM service status provided across ISM and AMT devices ? I tested using following API's on AMT and ISM systems:

# Set environment variables
export CONSOLE_HOST=""
export CONSOLE_USER="admin"
export CONSOLE_PASS=""
export SYSTEM_ID=""

# Enable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": true}}'

# Disable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": false}}'

# Verify current state
curl -sk \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" | jq .GraphicalConsole

Here's my observations:

  1. On AMT Systems
  • Initially ServiceEnabled is set to True and KVMStatus is set to Enabled.
  • PATCH request of ServiceEnabled to true updates KVMStatus to Enabled and ServiceEnabled to true
  • PATCH request of ServiceEnabled to false updates KVMStatus to Disabled and ServiceEnabled to false
  1. On ISM Systems
  • Initially ServiceEnabled is set to False and KVMStatus is set to Disabled.
  • PATCH request for ServiceEnabled succeeds - Should it not fail ?
  • Post PATCH request when queried, ServiceEnabled is set to false and KVMStatus as Disabled.

We use usecase.SetFeatures to enable/disable KVM. In ISM case, In REST apis, current behavior is that a KVM enable request does not return an explicit unsupported error. If the backend returns DestinationUnreachable, we currently handle it internally and return a normal success response, with KVM state reflected as disabled in the response fields.
We can change this behavior to return a clear unsupported response from the core DMT API. I will create a ticket for this to make change in code DMT.

@amarnath-ac amarnath-ac force-pushed the kvm_enable_disable branch from fc4b1a3 to 71b3ea8 Compare May 18, 2026 05:10
@amarnath-ac
Copy link
Copy Markdown
Contributor Author

How is the KVM service status provided across ISM and AMT devices ? I tested using following API's on AMT and ISM systems:

# Set environment variables
export CONSOLE_HOST=""
export CONSOLE_USER="admin"
export CONSOLE_PASS=""
export SYSTEM_ID=""

# Enable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": true}}'

# Disable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": false}}'

# Verify current state
curl -sk \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" | jq .GraphicalConsole

Here's my observations:

  1. On AMT Systems
  • Initially ServiceEnabled is set to True and KVMStatus is set to Enabled.
  • PATCH request of ServiceEnabled to true updates KVMStatus to Enabled and ServiceEnabled to true
  • PATCH request of ServiceEnabled to false updates KVMStatus to Disabled and ServiceEnabled to false
  1. On ISM Systems
  • Initially ServiceEnabled is set to False and KVMStatus is set to Disabled.
  • PATCH request for ServiceEnabled succeeds - Should it not fail ?
  • Post PATCH request when queried, ServiceEnabled is set to false and KVMStatus as Disabled.

We use usecase.SetFeatures to enable/disable KVM. In ISM case, In REST apis, current behavior is that a KVM enable request does not return an explicit unsupported error. If the backend returns DestinationUnreachable, we currently handle it internally and return a normal success response, with KVM state reflected as disabled in the response fields. We can change this behavior to return a clear unsupported response from the core DMT API. I will create a ticket for this to make change in code DMT.

I have tested above behavior with ISM device using REST apis, the mentioned statement is true. I dont see any error logs or failure on console and the enable KVM api return success but in response KVM status will be false.
Also, in web console enable KVM option(button/check box) is disabled, if cursor is placed on enable KVM, "KVM not supported" message is displayed.
We can go ahead with 2 options:

  1. Current PR implementation follows the existing REST apis behavior, we can go ahead with this PR implementation.
  2. Else, for KVM enable request, we can change the set feature API in core DMT to error out in ISM case.

@sudhir-intc, My preference is Option 1, Suggest here.

@sudhir-intc
Copy link
Copy Markdown
Contributor

How is the KVM service status provided across ISM and AMT devices ? I tested using following API's on AMT and ISM systems:

# Set environment variables
export CONSOLE_HOST=""
export CONSOLE_USER="admin"
export CONSOLE_PASS=""
export SYSTEM_ID=""

# Enable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": true}}'

# Disable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": false}}'

# Verify current state
curl -sk \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" | jq .GraphicalConsole

Here's my observations:

  1. On AMT Systems
  • Initially ServiceEnabled is set to True and KVMStatus is set to Enabled.
  • PATCH request of ServiceEnabled to true updates KVMStatus to Enabled and ServiceEnabled to true
  • PATCH request of ServiceEnabled to false updates KVMStatus to Disabled and ServiceEnabled to false
  1. On ISM Systems
  • Initially ServiceEnabled is set to False and KVMStatus is set to Disabled.
  • PATCH request for ServiceEnabled succeeds - Should it not fail ?
  • Post PATCH request when queried, ServiceEnabled is set to false and KVMStatus as Disabled.

We use usecase.SetFeatures to enable/disable KVM. In ISM case, In REST apis, current behavior is that a KVM enable request does not return an explicit unsupported error. If the backend returns DestinationUnreachable, we currently handle it internally and return a normal success response, with KVM state reflected as disabled in the response fields. We can change this behavior to return a clear unsupported response from the core DMT API. I will create a ticket for this to make change in code DMT.

I have tested above behavior with ISM device using REST apis, the mentioned statement is true. I dont see any error logs or failure on console and the enable KVM api return success but in response KVM status will be false. Also, in web console enable KVM option(button/check box) is disabled, if cursor is placed on enable KVM, "KVM not supported" message is displayed. We can go ahead with 2 options:

  1. Current PR implementation follows the existing REST apis behavior, we can go ahead with this PR implementation.
  2. Else, for KVM enable request, we can change the set feature API in core DMT to error out in ISM case.

@sudhir-intc, My preference is Option 1, Suggest here.

@amarnath-ac : Could you please create an issue for the Option-2 on DMT so that it can be fixed in the main DMT code. Please past the issue here. Once the issue is capture we could proceed with the merge of this PR

@amarnath-ac
Copy link
Copy Markdown
Contributor Author

How is the KVM service status provided across ISM and AMT devices ? I tested using following API's on AMT and ISM systems:

# Set environment variables
export CONSOLE_HOST=""
export CONSOLE_USER="admin"
export CONSOLE_PASS=""
export SYSTEM_ID=""

# Enable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": true}}'

# Disable KVM
curl -sk -X PATCH \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" \
  -H 'Content-Type: application/json' \
  -d '{"GraphicalConsole": {"ServiceEnabled": false}}'

# Verify current state
curl -sk \
  "${CONSOLE_HOST}/redfish/v1/Systems/${SYSTEM_ID}" \
  -u "${CONSOLE_USER}:${CONSOLE_PASS}" | jq .GraphicalConsole

Here's my observations:

  1. On AMT Systems
  • Initially ServiceEnabled is set to True and KVMStatus is set to Enabled.
  • PATCH request of ServiceEnabled to true updates KVMStatus to Enabled and ServiceEnabled to true
  • PATCH request of ServiceEnabled to false updates KVMStatus to Disabled and ServiceEnabled to false
  1. On ISM Systems
  • Initially ServiceEnabled is set to False and KVMStatus is set to Disabled.
  • PATCH request for ServiceEnabled succeeds - Should it not fail ?
  • Post PATCH request when queried, ServiceEnabled is set to false and KVMStatus as Disabled.

We use usecase.SetFeatures to enable/disable KVM. In ISM case, In REST apis, current behavior is that a KVM enable request does not return an explicit unsupported error. If the backend returns DestinationUnreachable, we currently handle it internally and return a normal success response, with KVM state reflected as disabled in the response fields. We can change this behavior to return a clear unsupported response from the core DMT API. I will create a ticket for this to make change in code DMT.

I have tested above behavior with ISM device using REST apis, the mentioned statement is true. I dont see any error logs or failure on console and the enable KVM api return success but in response KVM status will be false. Also, in web console enable KVM option(button/check box) is disabled, if cursor is placed on enable KVM, "KVM not supported" message is displayed. We can go ahead with 2 options:

  1. Current PR implementation follows the existing REST apis behavior, we can go ahead with this PR implementation.
  2. Else, for KVM enable request, we can change the set feature API in core DMT to error out in ISM case.

@sudhir-intc, My preference is Option 1, Suggest here.

@amarnath-ac : Could you please create an issue for the Option-2 on DMT so that it can be fixed in the main DMT code. Please past the issue here. Once the issue is capture we could proceed with the merge of this PR

Github issue created: #988.
If no other comments, please approve will go ahead to merge after rebasing.

Copy link
Copy Markdown
Contributor

@sudhir-intc sudhir-intc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Proceed with the merge after resolving the conflicts

Map ServiceEnabled updates to KVM enable/disable operations with
corresponding controller and repository changes

Signed-off-by: C, Amarnath <amarnath.c@intel.com>
@amarnath-ac amarnath-ac force-pushed the kvm_enable_disable branch from 71b3ea8 to b601c1c Compare May 19, 2026 06:46
@amarnath-ac amarnath-ac merged commit 5717a6d into redfish May 19, 2026
21 checks passed
@amarnath-ac amarnath-ac deleted the kvm_enable_disable branch May 19, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants