cloudstack
cloudstack copied to clipboard
CloudStack metadata in kvm domain xml
ISSUE TYPE
- Feature Idea
COMPONENT NAME
API
CONFIGURATION
Enable/Disable via Global Settings to (not) include metadata
OS / ENVIRONMENT
KVM
SUMMARY
Metadata to be recorded in the libvirt domain XML configuration to provide information about the CloudStack instance.
Provide information that can be useful to administrators troubleshooting hosts and optionally exported via libvirt exporter.
The host administrator will be able to ask libvirt to provide the XML config for the running instance and from there find out various useful pieces of metadata about the instance.
STEPS TO REPRODUCE
Add the following metadata XML blob to libvirt domain XML
<metadata>
<cloudstack:instance>
<cloudstack:name>${instance_Name}</cloudstack:name>
<cloudstack:internalName>${instance_InternalName}</cloudstack:internalName>
<cloudstack:displayName>${instance_DisplayName}</cloudstack:displayName>
<cloudstack:uuid>${instance_uuid}</cloudstack:name>
<cloudstack:ComputeOffering>
<cloudstack:cpu>${number_of_cpu_cores}</cloudstack:cpu>
<cloudstack:memory>${amount_of_memory_im_m(i)b}<c/loudstack:memory>
<cloudstack:ha>${ha_enabled_or_not_0_1}</cloudstack:ha>
</cloudstack:ComputeOffering>
<cloudstack:creationTime>${creationTime}</cloudstack:creationTime>
<cloudstack:owner>
<cloudstack:domain uuid="${domain_uuid}">${domain_name}</cloudstack:domain>
<cloudstack:account uuid="${account_uuid}">${account_name}</cloudstack:account>
<cloudstack:project uuid="${project_uuid}">${project_name}</cloudstack:project>
</cloudstack:instance>
</metadata>
EXPECTED RESULTS
Metadata to be available in libvirt, so this can be used with libvirt exporter.
Thanks for opening your first issue here! Be sure to follow the issue template!
Hi my name is Aarushi Soni . I want to contribute to this issue and enhance my knowledge Please guide me through this process.
I want to contribute to solve this issue, please let me contribute as it would help in my acedamics and your problem will be solved.
@Jehan-h20220012 please go through https://github.com/shapeblue/hackerbook and when comfortable submit a PR referencing the issue you mean to solve
Thank You! I request you to officially assign this issue to me on GITHUB as I need to show this to my Instructor before working on the issue. I hope you will do the needful.
Hello @DaanHoogland I want to get in touch with someone regarding this issue, can you please share any contact if possible?
@Jehan-h20220012 You can contact me or @kriegsmanj
Please connect on linkedin @soreana
@Jehan-h20220012 I couldn't find you on LinkedIn. Can you please send me a request to connect? https://www.linkedin.com/in/sina-kashipazha/
@soreana Sure!
@soreana I have sent you message since two days, please reply me! Looking forward for your responce.
@kriegsmanj I have sent you request to connect on linkedin.
@DaanHoogland @soreana @kriegsmanj I have few doubts about on by what way should I make the Enable/Disable toggle so that I can make the pull request.
@Jehan-h20220012 you are looking to add a global setting. These are added to a service by adding a ConfigKey<>
. In this case the place to add it would probably be the KVMGuru
. Look in VmwareGuru
for examples. Don´t forget to implement getConfigComponentName()
and getConfigKeys()
.
@DaanHoogland Thank you so much for your response, I will definately look into it and revert you back.
public static final ConfigKey<Boolean> KvmEnableMetadata = new ConfigKey<Boolean>(Boolean.class, "kvm.enable.metadata", "Advanced", "false", "When set to true this will enable libvirt exporter and include metadata", true, ConfigKey.Scope.Global, null);
@Override public String getConfigComponentName() { return KVMGuru.class.getSimpleName(); }
@Override public ConfigKey<?>[] getConfigKeys() { return new ConfigKey<?>[] {KvmEnableMetadata}; }
I have added the following code in KVMguru.java and now I have to add the provided metadata. Please tell me where to add it and then integrate it with our ConfigKey.
Also please provide me with the slack link so that I can discuss my issues there and get in touch easier.
@Jehan-h20220012 apachecloudstack.slack.com You have to request access, but several people can give it. You want to adjust a libvirt command to add the meta data on condition of that config key.
Thank You @DaanHoogland Yes I want to adjust libvirt command. Also where to place that metadata.
Also where to place that metadata.
I don´t know @Jehan-h20220012 . Actually I don´t know what you mean. You will have to compile the metadata, package it in the command to the hypervisor data and, in the command handler, add it to the VM definition. I'm not sure if this is what you are asking, but you'll have to do some digging to where to adjust the code.
Okay I will look into it. I will ask these things on slack once I get connected over there. It right now shows some apache.org domain required so I am looking into it how to request for the slack. Please share a link if possible so that I can directly request through it.
@DaanHoogland please provide a slack link, I am not getting access with the earlier one you sent
@Jehan-h20220012 please add the email address to your profile or here, so I can send you an invite.
The template UUID could be useful too. If the template isn't deleted we can use it when importing unmanaged VMs in CS.
<cloudstack:template>${template_uuid}</cloudstack>
@Jehan-h20220012 is this still in progress?
Hi @DaanHoogland No, I have stopped working on it! It seems that @slavkap has taken over this Enhancement.
It seemsshe has stopped working on it as well, did you @slavkap? ;)