Skip to content

Conversation

@anuragaw
Copy link
Contributor

@anuragaw anuragaw commented Jul 23, 2019

Currently, CloudStack does not allow additional configuration metadata to guest VMs during deployment. This feature aims to provide operators the functionality to pass arbitrary additional configuration metadata that will be included everytime the guest VM is started.

FS document: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Enable+additional+configuration+metadata+to+virtual+machines

Description

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)

Screenshots (if appropriate):

How Has This Been Tested?

@anuragaw anuragaw changed the title Allow additional config to vms [WIP DO NOT MERGE] Allow additional config to vms Jul 23, 2019
@anuragaw
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-174

@borisstoyanov
Copy link
Contributor

@blueorangutan test matrix

@blueorangutan
Copy link

@borisstoyanov a Trillian-Jenkins matrix job (centos6 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-206)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 34298 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3510-t206-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_extra_config_data.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Smoke tests completed. 77 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_02_deploy_vm__with_extraconfig_kvm Error 0.27 test_deploy_vm_extra_config_data.py

@blueorangutan
Copy link

Trillian test result (tid-207)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 52206 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3510-t207-vmware-65u2.zip
Intermittent failure detected: /marvin/tests/smoke/test_network.py
Intermittent failure detected: /marvin/tests/smoke/test_snapshots.py
Intermittent failure detected: /marvin/tests/smoke/test_usage.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 74 look OK, 4 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_reboot_router Error 356.40 test_network.py
test_02_list_snapshots_with_removed_data_store Error 1.19 test_snapshots.py
test_01_volume_usage Error 10.45 test_usage.py
test_05_rvpc_multi_tiers Failure 587.76 test_vpc_redundant.py
test_05_rvpc_multi_tiers Error 630.44 test_vpc_redundant.py

@rohityadavcloud rohityadavcloud added this to the 4.14.0.0 milestone Jul 24, 2019
Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

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

Did not test it, lgtm.

@wido
Copy link
Contributor

wido commented Jul 24, 2019

This seems to be Xen specific, right?

What can this do in addition to user-data through cloud-init?

@borisstoyanov
Copy link
Contributor

This is not just Xen specific but for vmware and kvm as well @wido, it only adds extra configuration to a VM it has nothing to do with user data and cloud-init.

@wido
Copy link
Contributor

wido commented Jul 24, 2019

@borisstoyanov I got confused by some keys I noticed.

I see it also works for KVM, but what kind of keys would somebody want to configure with KVM?

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

@wido whatever is not managed by cloudstack :) numa, hugepages etc..
@anuragaw can you have a look on the failing tests or you want me to?

@anuragaw
Copy link
Contributor Author

anuragaw commented Jul 29, 2019

I'll take a look @borisstoyanov

@svenvogel
Copy link
Contributor

svenvogel commented Aug 10, 2019

@anuragaw Hi. Small question. how does this work in practise? do we speak about the systemvm?

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

@anuragaw can you address the merge conflicts pls

@anuragaw anuragaw force-pushed the allow-additional-config-to-vms branch from d0fcd97 to 4427f14 Compare September 11, 2019 19:19
@anuragaw
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✖centos7 ✔debian. JID-273

@anuragaw
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-275

@anuragaw
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

@anuragaw anuragaw force-pushed the allow-additional-config-to-vms branch from ddc1689 to 1d22a0a Compare December 21, 2019 15:48
@anuragaw
Copy link
Contributor Author

Needed rebasing after merge conflicts.

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-500

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-676)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 36005 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3510-t676-kvm-centos7.zip
Smoke tests completed. 78 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@anuragaw
Copy link
Contributor Author

anuragaw commented Jan 3, 2020

@DaanHoogland - can you please take a look at the last commit for code review. Thanks!!

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-521

@anuragaw
Copy link
Contributor Author

anuragaw commented Jan 3, 2020

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-682)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 27456 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3510-t682-kvm-centos7.zip
Smoke tests completed. 78 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

Copy link
Contributor

@andrijapanicsb andrijapanicsb left a comment

Choose a reason for hiding this comment

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

LGMT.

Tested "in-house" and seems to be working fine for all 3 hypervisors.

@andrijapanicsb andrijapanicsb changed the title [WIP DO NOT MERGE] Allow additional config to vms Allow additional configuration metadata to VMs Jan 8, 2020
@andrijapanicsb
Copy link
Contributor

Test Name Steps Expected Result Status
Add configuration when not enabled Make sure that enable.additional.vm.configuration is false and add extra configuration following the KVM example bellow. VM Details are not being updated (localcloud) SBCM5> > update virtualmachine id=26f88815-5e08-4ab1-ba0b-15658110ab40  extraconfig='%3CmemoryBacking%3E%0A%20%20%3Chugepages%2F%3E%0A%3C%2FmemoryBacking%3E' filter=details, {} Passed
Enable configuration Set enable.additional.vm.configuration to True and add extra configuration following the KVM example bellow. User is able to set configuration (localcloud) SBCM5> > update virtualmachine id=26f88815-5e08-4ab1-ba0b-15658110ab40  extraconfig='%3CmemoryBacking%3E%0A%20%20%3Chugepages%2F%3E%0A%3C%2FmemoryBacking%3E' filter=details, {   “details": {         "extraconfig-1": "\n  \n"       }, Passed
KVM extra config Deploy a VM and set extra config with the following api call: deploy virtualmachine … extraconfig='%3CmemoryBacking%3E%0A%20%20%3Chugepages%2F%3E%0A%3C%2FmemoryBacking%3E' Dump xml the domain on the kvm host and verify that the extra settings are there   virsh dumpxml 2 …   524288   524288         … Passed
VMware extra config Deploy a VM Stop the VM Update the VM with the following api command and start it update virtualmachine id=[vm-id] extraconfig=' hypervisor.cpuid.v0%3DFALSE' Cat the vmx file on the primary storage and observe that the specific setting is there cat "$(esxcli vm process list | grep i-2-8-VM | tail -1 | awk '{print $3}')" | grep -w 'hypervisor.cpuid.v0 = "FALSE"' hypervisor.cpuid.v0 = "FALSE" Passed
XenServer extra config Deploy a VM Stop the VM Update the VM with the following api command and start it update virtualmachine id=[vm-id] extraconfig=' HVM-boot-policy%3D%0APV-bootloader%3Dpygrub%0APV-args%3Dhvc0' On the Xen host us the ‘xe vm-param-get param-name’ command to get the specific parameter and observe it’s been set   xe vm-param-get param-name=PV-bootloader uuid=f5b6ea53-b9dd-d118-a404-582675cc4345  pygrub   xe vm-param-get param-name=PV-args uuid=f5b6ea53-b9dd-d118-a404-582675cc4345 hvc0 Passed
KVM key list restriction Remove all items from allow.additional.vm.configuration.list.kvm Deploy a VM and set extra config with the following api call: deploy virtualmachine … extraconfig='%3CmemoryBacking%3E%0A%20%20%3Chugepages%2F%3E%0A%3C%2FmemoryBacking%3E' Exception appears that the item is not allowed. Any of the child records of that xml node were not added as well   CloudstackAPIException: Execute cmd: deployvirtualmachine failed, due to: errorCode: 530, errorText:Extra config  is not on the list of allowed keys for KVM hypervisor hosts Passed
VMware key list restriction Remove all items from allow.additional.vm.configuration.list.vmware global setting Deploy a VM Stop the VM Update the VM with the following api command and start it update virtualmachine id=[vm-id] extraconfig='hypervisor.cpuid.v0%3DFALSE' Exception appears that the item is not allowed. CloudstackAPIException: Execute cmd: deployvirtualmachine failed, due to: errorCode: 530, errorText:Extra config hypervisor.cpuid.v0=FALSE is not on the list of allowed keys for VMware hypervisor hosts. Passed
XenServer key list restriction Remove all items from allow.additional.vm.configuration.list.xenserver global setting Deploy a VM Stop the VM Update the VM with the following api command and start it update virtualmachine id=[vm-id] extraconfig='HVM-boot-policy%3D%0APV-bootloader%3Dpygrub%0APV-args%3Dhvc0' Exception appears that the item is not allowed. CloudstackAPIException: Execute cmd: deployvirtualmachine failed, due to: errorCode: 530, errorText:Extra config HVM-boot-policy= is not on the list of allowed keys for XenServer hypervisor hosts. Passed
XenServer key mapping negative Pass an argument that is not valid as per the given pattern:   Test value: HVM-boot-policy= PV-bootloader=pygrub=failure PV-args=hvc0 Cloudstack throws an exception when validating the map:   (localcloud) SBCM5> > update virtualmachine id=afeb87cf-5a0a-4807-9c69-8644544ccdf9 extraconfig=HVM-boot-policy%3D%0APV-bootloader%3Dpygrub%3Dfailure%0APV-args%3Dhvc0 🙈 Error: (HTTP 530, error code 4250) The passed extra config string 'HVM-boot-policy= PV-bootloader=pygrub=failure PV-args=hvc0' contains an invalid key/value pair pattern Passed
Clean extra config data Stop the VM Execute update VM with ‘cleanupdetails=true’ argument Any additional config has been removed   (localcloud) SBCM5> > list virtualmachines id=9207b8b4-6d94-4a93-ba44-20ad5cd39f76 filter=details, {   "virtualmachine": [       "details": {         "deployvm": "true",         "extraconfig-1": "\n  \n" } (localcloud) SBCM5> > update virtualmachine id=9207b8b4-6d94-4a93-ba44-20ad5cd39f76 cleanupdetails=true {   "virtualmachine": {...} (localcloud) SBCM5> > list virtualmachines id=9207b8b4-6d94-4a93-ba44-20ad5cd39f76 filter=details, {   "virtualmachine": [           "details": {} } Passed
KVM – Nested keys not allowed Create an xml that is containing a not allowed key inside an allowed key and try submitting it. (localcloud) SBCM5> > update virtualmachine id=9d5b6561-ee7b-4711-94c7-c79f268cfa24  extraconfig='%3CmemoryBacking%3E%0A%20%20%3Chugepages%2F%3E%0A%3C%2FmemoryBacking%3E' 🙈 Error: (HTTP 530, error code 4250) Extra config hugepages is not on the list of allowed keys for KVM hypervisor hosts (localcloud) SBCM5> > list configurations name=allow.additional.vm.configuration.list.kvm {       "name": "allow.additional.vm.configuration.list.kvm",       "value": "memoryBacking" } Passed
Apply configuration when it’s disabled Set enable.additional.vm.configuration to false Apply any configurations to a VM. (localcloud) SBCM5> > update virtualmachine id=9d5b6561-ee7b-4711-94c7-c79f268cfa24  extraconfig='%3CmemoryBacking%3E%0A%3C%2FmemoryBacking%3E' 🙈 Error: (HTTP 431, error code 4350) attempted setting extraconfig but enable.additional.vm.configuration is disabled Passed
Update some of the enabled configurations Have a list of enabled keys, but pass just one of them (localcloud) SBCM5> > update virtualmachine id=9d5b6561-ee7b-4711-94c7-c79f268cfa24  extraconfig='%3CmemoryBacking%3E%0A%3C%2FmemoryBacking%3E' {   "virtualmachine": { …     "details": {       "Message.ReservedCapacityFreed.Flag": "true",       "extraconfig-1": "\n"     } … (localcloud) SBCM5> > list configurations name=allow.additional.vm.configuration.list.kvm {       "name": "allow.additional.vm.configuration.list.kvm",       "value": "memoryBacking, hugepages" } Passed

@andrijapanicsb andrijapanicsb merged commit 70fcf75 into apache:master Jan 8, 2020
@nvazquez nvazquez mentioned this pull request Feb 13, 2020
5 tasks
ustcweizhou pushed a commit to ustcweizhou/cloudstack that referenced this pull request Feb 28, 2020
* Suqash commits to a single commit and rebase against master

Update marvin tests to use white list

* * Fix marvin test failure
* Add new marvin negative tests cases
* Remove hard-coded hypervisor types in marvin tests

* Fix build error after rebase and add hugepagesless

* Fix readability of python code

* Fix failing test

* Adding cleanup of vms for negative tests

* Bug fixes - change config checks properly and block extraconfig in details

* Trim to compare the keys

* CR comments

* Don't skip extraconfig without exception

Co-authored-by: Boris Stoyanov - a.k.a Bobby <bss.stoyanov@gmail.com>
@harikrishna-patnala
Copy link
Contributor

harikrishna-patnala commented Dec 2, 2020

@pavanaravapalli please open a github issue when you see anything not working with appropriate information and steps. Thanks

@pavanaravapalli
Copy link

@harikrishna-patnala ok i will do necessary if required.

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.

10 participants