Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created October 8, 2017 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/55a9086278ee93fcde84487c6dd5b5d7 to your computer and use it in GitHub Desktop.
Save gowatana/55a9086278ee93fcde84487c6dd5b5d7 to your computer and use it in GitHub Desktop.
import xml.etree.ElementTree as ET
cvm_xml_file_in = "./cvm.xml"
cvm_xml_file_out = "./cvm-10GB.xml"
cvm_memory_gb = 10
cvm_memory_kb = cvm_memory_gb * 1024 * 1024
tree = ET.parse(cvm_xml_file_in)
root = tree.getroot()
cvm_memory_pre = root.find("memory").text
root.find("memory").text = str(cvm_memory_kb)
cvm_memory_post = root.find("memory").text
root.find("currentMemory").text = str(cvm_memory_kb)
tree.write(cvm_xml_file_out)
print "CVM Memory Size: " + cvm_memory_pre + " -> " + cvm_memory_post
print "Output File: " + cvm_xml_file_out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment