Created
October 8, 2017 15:25
-
-
Save gowatana/55a9086278ee93fcde84487c6dd5b5d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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