Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prioritize hypervisor.uri configuration #8254

Merged
merged 1 commit into from Dec 6, 2023

Conversation

hsato03
Copy link
Collaborator

@hsato03 hsato03 commented Nov 20, 2023

Description

The KVM Agent has the hypervisor.uri configuration to define the connection with Libvirt; however, this property is ignored and a hardcoded value is used in many parts of the code.

This PR intends to prioritize the hypervisor.uri property in Libvirt connections and use the hypervisor default URI only when this configuration is not defined.

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

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?

I followed the same steps from How did you try to break this feature... and verified that the host was only using the URI defined in the hypervisor.uri property.

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

  1. Add the hypervisor.uri property to a host's agent.properties, hypervisor.uri=qemu:///session for example;
  2. Check the agent logs;
  3. Although the hypervisor.uri property is defined, the agent is still using the hypervisor default URI in many connections;

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache 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.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (c7100c3) 21.64% compared to head (2f7193c) 29.14%.
Report is 15 commits behind head on main.

Files Patch % Lines
...oud/hypervisor/kvm/resource/LibvirtConnection.java 0.00% 4 Missing ⚠️
...ervisor/kvm/resource/LibvirtComputingResource.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8254      +/-   ##
============================================
+ Coverage     21.64%   29.14%   +7.50%     
- Complexity    21530    31049    +9519     
============================================
  Files          5052     5193     +141     
  Lines        343910   366293   +22383     
  Branches      49538    53556    +4018     
============================================
+ Hits          74431   106773   +32342     
+ Misses       258607   244881   -13726     
- Partials      10872    14639    +3767     
Flag Coverage Δ
simulator-marvin-tests 25.10% <0.00%> (+1.95%) ⬆️
uitests 4.49% <ø> (-0.01%) ⬇️
unit-tests 14.81% <0.00%> (?)

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.

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@DaanHoogland DaanHoogland added this to the 4.19.0.0 milestone Nov 23, 2023
Copy link
Contributor

@GutoVeronezi GutoVeronezi left a comment

Choose a reason for hiding this comment

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

CLGTM

@GutoVeronezi
Copy link
Contributor

@DaanHoogland @weizhouapache do we need third-party testing for this one?

@DaanHoogland
Copy link
Contributor

@DaanHoogland @weizhouapache do we need third-party testing for this one?

in principle I'd say we always do, but I'm sensitive to arguments why we wouldn't. I think we can only decide on this based on the code and available automatic tests though, never relying on the author. I would appreciate it if you didn't trust my PRs in that respect either.

@weizhouapache
Copy link
Member

@DaanHoogland @weizhouapache do we need third-party testing for this one?

Yes @GutoVeronezi
Would you like to test it?

@GutoVeronezi
Copy link
Contributor

@DaanHoogland @weizhouapache do we need third-party testing for this one?

Yes @GutoVeronezi Would you like to test it?

I can put it on my tasks for the next week.

@weizhouapache
Copy link
Member

@DaanHoogland @weizhouapache do we need third-party testing for this one?

Yes @GutoVeronezi Would you like to test it?

I can put it on my tasks for the next week.

cool, thanks @GutoVeronezi
assigned to you then

@GutoVeronezi
Copy link
Contributor

Hello guys

I did some basic tests with the feature:

  • without the configuration, the Agent took the default URI; with that, I successfully created a VM, migrated it, and scaled it;

    [...]
    2023-12-06 19:32:19,539 DEBUG [agent.properties.AgentPropertiesFileHandler] (agentRequest-Handler-2:null) (logid:7626c82c) Property [hypervisor.uri] has empty or null value. Using default value [null].
    2023-12-06 19:32:19,539 DEBUG [kvm.resource.LibvirtConnection] (agentRequest-Handler-2:null) (logid:7626c82c) Looking for libvirtd connection at: qemu:///system
    [...]
    2023-12-06 19:32:19,566 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (agentRequest-Handler-2:null) (logid:7626c82c) starting i-2-9-VM: <domain type='kvm'>
    [...]
    2023-12-06 19:32:20,961 DEBUG [cloud.agent.Agent] (agentRequest-Handler-2:null) (logid:7626c82c) Seq 4-6525434385083138169:  { Ans: , MgmtId: 262659038986676, via: 4, Ver: v1, Flags: 10, [{"com.cloud.agent.api.StartAnswer":{"vm":{"id":"9","name":"i-2-9-VM","state":"Starting","type":"User","cpus":"2","minSpeed":"1560","maxSpeed":"1560","minRam":"(1.00 GB) 1073741824","maxRam":"(4.00 GB) 4294967296","arch":"x86_64","os":"Other (64-bit)","platformEmulator":"Other","bootArgs":"","enableHA":"false","limitCpuUse":"false","enableDynamicallyScaleVm":"
    [...]
    
  • with the configuration, the Agent took the URI I set; with that, I successfully created a VM, migrated it, and scaled it;

    [...]
    2023-12-06 19:37:23,206 DEBUG [agent.properties.AgentPropertiesFileHandler] (agentRequest-Handler-5:null) (logid:951c7230) Property [hypervisor.uri] was altered. Now using the value [qemu+tcp://192.168.123.173/system].
    2023-12-06 19:37:23,206 DEBUG [kvm.resource.LibvirtConnection] (agentRequest-Handler-5:null) (logid:951c7230) Looking for libvirtd connection at: qemu+tcp://192.168.123.173/system
    [...]
    2023-12-06 19:37:23,248 DEBUG [resource.wrapper.LibvirtStartCommandWrapper] (agentRequest-Handler-5:null) (logid:951c7230) starting i-2-9-VM: <domain type='kvm'>
    [...]
    2023-12-06 19:37:24,280 DEBUG [cloud.agent.Agent] (agentRequest-Handler-5:null) (logid:951c7230) Seq 4-5190117095567785998:  { Ans: , MgmtId: 262659038986676, via: 4, Ver: v1, Flags: 10, [{"com.cloud.agent.api.StartAnswer":{"vm":{"id":"9","name":"i-2-9-VM","state":"Starting","type":"User","cpus":"2","minSpeed":"1560","maxSpeed":"1560","minRam":"(1.00 GB) 1073741824","maxRam":"(4.00 GB) 4294967296","arch":"x86_64","os":"Other (64-bit)","platformEmulator":"Other","bootArgs":"","enableHA":"false","limitCpuUse":"false","enableDynamicallyScaleVm":"
    

@GutoVeronezi
Copy link
Contributor

Merging this one based on the approvals and tests results.

@GutoVeronezi GutoVeronezi merged commit fdfbb4f into apache:main Dec 6, 2023
24 of 25 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Dec 11, 2023
Co-authored-by: Henrique Sato <henrique.sato@scclouds.com.br>
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.

None yet

5 participants