cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

CloudStack metadata in kvm domain xml

Open kriegsmanj opened this issue 2 years ago • 5 comments

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.

kriegsmanj avatar Aug 31 '22 13:08 kriegsmanj

Thanks for opening your first issue here! Be sure to follow the issue template!

boring-cyborg[bot] avatar Aug 31 '22 13:08 boring-cyborg[bot]

Hi my name is Aarushi Soni . I want to contribute to this issue and enhance my knowledge Please guide me through this process.

aarushisoni avatar Sep 08 '22 08:09 aarushisoni

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 avatar Sep 12 '22 10:09 Jehan-h20220012

@Jehan-h20220012 please go through https://github.com/shapeblue/hackerbook and when comfortable submit a PR referencing the issue you mean to solve

DaanHoogland avatar Sep 14 '22 14:09 DaanHoogland

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.

Jehan-h20220012 avatar Sep 14 '22 15:09 Jehan-h20220012

Hello @DaanHoogland I want to get in touch with someone regarding this issue, can you please share any contact if possible?

Jehan-h20220012 avatar Oct 12 '22 12:10 Jehan-h20220012

@Jehan-h20220012 You can contact me or @kriegsmanj

soreana avatar Oct 12 '22 12:10 soreana

Please connect on linkedin @soreana

Jehan-h20220012 avatar Oct 13 '22 10:10 Jehan-h20220012

@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 avatar Oct 14 '22 07:10 soreana

@soreana Sure!

Jehan-h20220012 avatar Oct 14 '22 07:10 Jehan-h20220012

@soreana I have sent you message since two days, please reply me! Looking forward for your responce.

Jehan-h20220012 avatar Oct 16 '22 16:10 Jehan-h20220012

@kriegsmanj I have sent you request to connect on linkedin.

Jehan-h20220012 avatar Oct 17 '22 17:10 Jehan-h20220012

@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 avatar Oct 18 '22 21:10 Jehan-h20220012

@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 avatar Oct 19 '22 07:10 DaanHoogland

@DaanHoogland Thank you so much for your response, I will definately look into it and revert you back.

Jehan-h20220012 avatar Oct 19 '22 07:10 Jehan-h20220012

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 avatar Nov 08 '22 15:11 Jehan-h20220012

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

DaanHoogland avatar Nov 08 '22 15:11 DaanHoogland

Thank You @DaanHoogland Yes I want to adjust libvirt command. Also where to place that metadata.

Jehan-h20220012 avatar Nov 08 '22 16:11 Jehan-h20220012

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.

DaanHoogland avatar Nov 09 '22 13:11 DaanHoogland

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.

Jehan-h20220012 avatar Nov 09 '22 13:11 Jehan-h20220012

@DaanHoogland please provide a slack link, I am not getting access with the earlier one you sent

Jehan-h20220012 avatar Nov 14 '22 08:11 Jehan-h20220012

@Jehan-h20220012 please add the email address to your profile or here, so I can send you an invite.

DaanHoogland avatar Nov 14 '22 09:11 DaanHoogland

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>

slavkap avatar Jan 09 '24 17:01 slavkap

@Jehan-h20220012 is this still in progress?

DaanHoogland avatar Jun 05 '24 12:06 DaanHoogland

Hi @DaanHoogland No, I have stopped working on it! It seems that @slavkap has taken over this Enhancement.

Jehan-h20220012 avatar Jun 06 '24 08:06 Jehan-h20220012

It seemsshe has stopped working on it as well, did you @slavkap? ;)

DaanHoogland avatar Jun 06 '24 08:06 DaanHoogland