Repository navigation
Refactor/libvirt resource - #233
Conversation
- Adding LibvirtStopCommandWrapper - LibvirtRequestWrapper - 1 unit tests Refactored the RequestWrapper to make it better. - Changes also applied to the CitrixRequestWrapper
- Adding LibvirtGetVmStatsCommandWrapper - 3 unit tests Refactored the LibvirtConnectiobn by surrounding it with an wrapper. - Make it easier to cover the static/native calls - Added better coverage to StopCommand tests
- Adding LibvirtGetVmDiskStatsCommandWrapper - 1 unit test Added getConnection() to LibvirtConnectionWrapper
- Adding LibvirtRebootCommandWrapper and LibVirtRebootRouterCommandWrapper - 2 unit tests added - KVM hypervisor with 10.5% coverage
- Adding LibvirtGetHosStatsCommandWrapper - 1 unit test added - KVM hypervisor with 10.5% coverage Tests are a bit limited on this one becuause of the current implementation. Would clean it up later in a separate branch
…ingResource
- It's not used and if so would cause an infinite loop.
- Adding LibvirtCheckHealthCommandWrapper and LibvirtPrepareForMigrationCommandWrapper - 2 unit tests added - KVM hypervisor plugin with 10.8% coverage
- Adding LibvirtMigrateCommandWrapper - 1 unit tests added - KVM hypervisor plugin with 10.9% coverage
- Adding LibvirtPingTestCommandWrapper - 3 unit tests added - KVM hypervisor plugin with 11.2% coverage
- Adding LibvirtAttachIsoCommandWrapper, LibvirtAttachIsoCommandWrapper and LibvirtAttachIsoCommandWrapper - 7 unit tests added - KVM hypervisor plugin with 11.5% coverage
- Adding LibvirtAttachVolumeCommandWrapper - 3 unit tests added - KVM hypervisor plugin with 11.7% coverage
- Adding LibvirtCheckConsoleProxyLoadCommandWrapper, LibvirtConsoleProxyLoadCommandWrapper, LibvirtWatchConsoleProxyLoadCommandWrapperand CitrixConsoleProxyLoadCommandWrapper - 2 unit tests added - KVM hypervisor plugin with 12% coverage Refactored the CommandWrapper interface in order to remove the esecuteProxyLoadScan, which is now implemented bu subclasses.
- Adding LibvirtGetVncPortCommandWrapper - 2 unit tests added - KVM hypervisor plugin with 12.1% coverage
- Adding LibvirtModifySshKeysCommandWrapper - 1 unit test added - KVM hypervisor plugin with 12.3% coverage
- Adding LibvirtCreateCommandWrapper and LibvirtMaintainCommandWrapper - 4 unit tests added - KVM hypervisor plugin with 12.7% coverage
- Adding LibvirtDestroyCommandWrapper - 2 unit tests added - KVM hypervisor plugin with 12.9% coverage
- Adding LibvirtPrimaryStorageDownloadCommandWrapper - 4 unit tests added - KVM hypervisor plugin with 13.3% coverage
- Adding LibvirtDeleteStoragePoolCommandWrapper, LibvirtGetStorageStatsCommandWrapper and LibvirtUpgradeSnapshotCommandWrapper - 7 unit tests added - KVM hypervisor plugin with 13.6% coverage
- Adding LibvirtOvsDestroyBridgeCommandWrapper, LibvirtOvsSetupBridgeCommandWrapper - 4 unit tests added - KVM hypervisor plugin with 13.9% coverage More tests added to cover LibvirtPrepareForMigrationCommandWrapper - Coverage of this wrapper broght from 37% to 90.6% - 4 new tests added
- Adding 7 new command wrappers - 10 unit tests added - KVM hypervisor plugin with 14.8% coverage
- Adding 4 new command wrappers - 12 unit tests added - KVM hypervisor plugin with 15.5% coverage
- Adding LibvirtCheckOnHostCommandWrapper and LibvirtOvsCreateTunnelCommandWrapper - 4 unit tests added - KVM hypervisor plugin with 16.2% coverage
- Adding LibvirtCreateVolumeFromSnapshotCommandWrapper, LibvirtFenceCommandWrapper and LibvirtSecurityGroupRulesCommandWrapper - 6 unit tests added - KVM hypervisor plugin with 17.2% coverage
- Adding LibvirtNetworkUsageCommandWrapper, LibvirtPlugNicCommandWrapper and LibvirtUnPlugNicCommandWrapper - 9 unit tests added - KVM hypervisor plugin with 18.3% coverage
- Adding LibvirtBackupSnapshotCommandWrapper, LibvirtCreatePrivateTemplateFromVolumeCommandWrapper and LibvirtManageSnapshotCommandWrapper - 3 unit tests added - KVM hypervisor plugin with 18.3% coverage Less tests added to those classes because the code is quite complex and way too long. The tests added are just covering the new flow, to make sure it works fine. I will come back to those classes later.
- Adding LibvirtCreatePrivateTemplateFromSnapshotCommandWrapper - 5 unit tests added - KVM hypervisor plugin with 19.5% coverage
- Gave it a better, more suggestive, name since I now added other methods to the class. - It makes easier to mock objects and get a better coverage of the classes
- Adding LibvirtCopyVolumeCommandWrapper Refactoring the LibvirtUtilitiesHelper - Changing method name Did not add any test to this commit due to the refactor mentioned abot. Will proceed and add the tests i# Please enter the commit message for your changes. Lines starting
- 5 unit tests added - KVM hypervisor plugin with 20.1% coverage
|
Please, do not merge it before I test it with a KVM hypervisor. Cheers, |
|
cloudstack-pull-requests #117 FAILURE |
|
Yeah, I think this is a big enough change that we should give all KVM "stakeholders" an opportunity to review and test before merge. At least the committers, but anyone who wants to participate, of course. Mike T, Wido, myself, Lucian, Andrija, just to try to get an array of use cases and storage types represented. Hopefully at least someone who uses OVS and vxlan. |
|
Daan Hoogland on mike.tutkowski@solidfire.com replies: Op do 7 mei 2015 om 00:57 schreef mlsorensen git@git.apache.org: |
|
Nux! on daan.hoogland@gmail.com replies: |
|
Thanks, guys. Would be really nice to test it ASAP so we avoid another rebase. Most of the changes are purely structural, I tried my best to keep the behaviour as it is. If you look at the wrappers, they have the same content that the methods had when inside the LibvirtComputingResource. Are there changes in the behaviour? Yes, a few. For example, in few methods we had try/catch blocks with e.printStackTrace() and after that still returning true (as a successful operation). There were also methods returning always true and that return was being ignored. Those kind of things I changed. Right now I'm busy getting my KVM environment test up and running. I will test the changes with OVS and VLAN and send a report to the list. My plan is to do it today/tomorrow After the code reaches master, I will change the flyweight implementation in order to use the Annotations (suggested by @mlsorensen) and also increase UT coverage. If you would have time to test it this week it would be very appreciated. Cheers, |
|
looks nice 👍 |
|
Looks good, I guess Travis is sort of green (with on failing test due to timeout). I will help test it tonight or tomorrow. |
…lass - The test was okay, but when running in an environment where a /root/.ssh/id_rsa existed, it would return true then fail - We now mock the calls to methods that return the key paths, instead of relying in the static variables
|
cloudstack-pull-requests #124 UNSTABLE |
|
Did you guys have time to test this PR? My KVM environment is up and running and I just started testing. I will send a report soon. Cheers, |
|
Marcus on dev@cloudstack.apache.org replies: Process /usr/sbin/cloudstack-management could not be executed with no /usr/sbin/cloudstack-management to be found Unrelated issues, I know, but I'll work through them. |
|
Okay.... but thanks a lot for start looking into it, @mlsorensen. My env was a bit bumpy today and I did no manage to do all I had planned for, but I'm moving on with the tests just to identify performance improvements for our current test environment. It's taking about 10min to start a VM... so, running a test list test_accounts.py takes a very long time. I will keep you up to date. Cheers, |
|
Yeah, I got past tomcat and other systemd switchover issues on > 4.5 code, but then ran into other issues. The mgmt server configs got all messed up by the new RPMs. I got the server xml worked out but it couldn't connect to the db, 'access denied for cloud@localhost'. It doesn't seem to even be reading my db.properties. Mainly master teething issues around upgrade, I presume, but I've spent too much time on it today. I'll try a fresh install later. One thing in particular I'd like to see tested is live migration. If I don't manage to test this please do at least this one. |
|
@mlsorensen I've seen this before as well when testing 4.5 upgrades. I'd check permissions on files cloudstack touches, for me it was permission related and it was not reading db.properties file like you mentioned. |
|
@wilderrodrigues any update on this PR, if it's well tested, let's merge it? |
|
I'm testing since yesterday. My KVM environment is a bit slow, but all the tests are going okay. Please check the partial report below (last just wait a couple of hours then merge it): Hi all, I took some time to run integration/smoke tests on the LibVirt refactor I finished last week. All the test went well, as detailed in the report below. More information about my environment and what was covered. Environment: Centos7 + KVM + Qemu Test Create Account and user for that account ... === TestName: test_01_create_account | Status : SUCCESS === Ran 14 tests in 7517.316s OK Test advanced zone virtual router ... === TestName: test_advZoneVirtualRouter | Status : SUCCESS === Ran 10 tests in 2936.289s OK (SKIP=1) ====Trying SSH Connection: Host:192.168.22.21 User:root Port:22 RetryCnt:60=== Test router internal advanced zone ... === TestName: test_02_router_internal_adv | Status : SUCCESS === Ran 7 tests in 1995.909s OK |
|
I just sent the test report to your emails. I'm fully confident with the changes and would like to suggest a merge of the PR. Thanks in advance. Cheers, |
|
Hi @bhaisaab , Is that okay if I merge the PR? It's been here for 7 days and has been tested. Cheers, |
|
@wilderrodrigues thanks for sharing the test reports, while I've not personally tested. Looks good, please go ahead. |
|
@wilderrodrigues build-master-jdk18 is failing in jenkins. http://jenkins.buildacloud.org/job/build-master-jdk18/38/ |
Test set: com.cloud.hypervisor.kvm.resource.LibvirtComputingResourceTestTests run: 143, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.744 sec <<< FAILURE! - in com.cloud.hypervisor.kvm.resource.LibvirtComputingResourceTest |
|
@wilderrodrigues Sorry, I could not test the PR earlier. I see the following issues while trying to bring up my KVM setup:
2015-05-14 00:00:05,362 DEBUG kvm.resource.LibvirtComputingResource Execption while executing command com.cloud.agent.api.StartCommand
|
|
Hi @kishankavala, I will have a look at that, although that's pretty weird since I have tested on a KVM environment as well. Don't see why the bean would have been injected for me and not for you. Have you done a full clean/install of the latest source? Cheers, |
|
Hi @karuturi, I had a look and it has more to do with the hard coded paths in the code (which were already present) and the setup of the machine where the Java8 builds run. Good it failed, because that code has never been tested before. I will make the test better and push a fix asap. Thanks for the heads up. Cheers, |
This PR contains the refactor of the LibvirtComputingResource. The motivation behind this effort is to increase maintainability and testability of the code.
The LibvirtComputingResource went from 5.5k to 3.3k lines of code. The unit tests went from 300 to 5050 lines of code, covering 23.3% of the whole KVM plugin (instead of the previous 4%).
All the code extracted from the LibvirtComputingResource has 64.8% coverage.
This has already been rebased and built. I'm creating the PR now but will test it against a KVM hypervisor before it gets pushed towards the Master branch.
Cheers,
Wilder