Skip to content

Conversation

@vishesh92
Copy link
Member

Description

This PR removes the usage of uptime command which fails on certain OS like open SUSE with the below error.

uptime -s
uptime: invalid option -- 's'
Try 'uptime --help' for more information.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@vishesh92 vishesh92 requested a review from Copilot September 18, 2025 08:17
@vishesh92 vishesh92 changed the base branch from main to 4.20 September 18, 2025 08:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes compatibility issues with the uptime command on certain Linux distributions (specifically openSUSE) by replacing the uptime -s command with a more portable alternative that reads from /proc/stat to get the system boot time.

  • Replaces uptime -s command with /proc/stat parsing approach for better OS compatibility
  • Improves error logging by including the exception details

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vishesh92 vishesh92 force-pushed the remove-uptime-command branch from 5ec8ade to 4be35a7 Compare September 18, 2025 08:23
@vishesh92 vishesh92 requested a review from Copilot September 18, 2025 08:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vishesh92 vishesh92 added this to the 4.20.2 milestone Sep 18, 2025
@vishesh92
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.17%. Comparing base (0cbebbd) to head (4be35a7).
⚠️ Report is 1 commits behind head on 4.20.

Files with missing lines Patch % Lines
...src/main/java/com/cloud/server/StatsCollector.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #11670   +/-   ##
=========================================
  Coverage     16.17%   16.17%           
- Complexity    13297    13298    +1     
=========================================
  Files          5656     5656           
  Lines        498151   498151           
  Branches      60441    60441           
=========================================
+ Hits          80588    80589    +1     
+ Misses       408591   408589    -2     
- Partials       8972     8973    +1     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.03% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15077

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

tested on ubuntu 24 and rocky8, got same results as uptime -s

String bootTime = Script.runSimpleBashScript("uptime -s");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.ENGLISH);
String bootTime = Script.runSimpleBashScript("date -d @$(grep btime /proc/stat | awk '{print $2}') '+%Y-%m-%d %H:%M:%S'");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
Copy link
Member

Choose a reason for hiding this comment

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

yyyy-MM-dd HH:mm:ss is correct I think.

yyyy-MM-dd hh:mm:ss seems wrong, did it work in the past ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tested locally and the old one seems to work fine as well. But as per java docs, it should be HH instead of hh.

@vishesh92
Copy link
Member Author

@blueorangutan test

@vishesh92 vishesh92 marked this pull request as ready for review September 19, 2025 06:19
@blueorangutan
Copy link

@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Copy link
Contributor

@vladimirpetrov vladimirpetrov left a comment

Choose a reason for hiding this comment

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

LGTM based on manual testing.

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

code lgtm, checked command on local

@weizhouapache
Copy link
Member

Merging based on approvals and manual testing

thanks @vishesh92 @vladimirpetrov @sureshanaparti @shwstppr

@weizhouapache weizhouapache merged commit 9167cd3 into apache:4.20 Sep 19, 2025
25 of 26 checks passed
@DaanHoogland DaanHoogland deleted the remove-uptime-command branch September 19, 2025 12:53
@blueorangutan
Copy link

[SF] Trillian test result (tid-14383)
Environment: kvm-suse15 (x2), zone: Advanced Networking with Mgmt server s15
Total time taken: 54005 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11670-t14383-kvm-suse15.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@blueorangutan
Copy link

[SF] Trillian test result (tid-14382)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55924 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11670-t14382-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@weizhouapache weizhouapache linked an issue Sep 20, 2025 that may be closed by this pull request
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opensuse and SLES support

7 participants