def dump_zstack(save_to_file=None, admin_passwd=None): xml_root = etree.Element("deployerConfig") try: session_uuid = account_operations.login_as_admin(admin_passwd) get_node(xml_root, session_uuid) get_instance_offering(xml_root, session_uuid) get_disk_offering(xml_root, session_uuid) get_backup_storage(xml_root, session_uuid) get_image(xml_root, session_uuid) get_zone(xml_root, session_uuid) except Exception as e: try: account_operations.logout(session_uuid) except: print ' ' raise e account_operations.logout(session_uuid) new_xml = str(beautify_xml_element(xml_root)) # new_xml = new_xml.replace('" ', '"\n') new_xml = make_xml_editable(new_xml) print new_xml if save_to_file: open(save_to_file, 'w').write(new_xml)
def deploy_initial_database(deploy_config, admin_passwd=None): operations = [ add_backup_storage, add_zone, add_l2_network, add_primary_storage, add_cluster, add_host, add_l3_network, add_image, add_disk_offering, add_instance_offering, add_virtual_router ] for operation in operations: session_uuid = account_operations.login_as_admin(admin_passwd) try: operation(deploy_config, session_uuid) except Exception as e: deploy_logger( '[Error] zstack deployment meets exception when doing: %s . The real exception are:.' % operation.__name__) print('----------------------Exception Reason------------------------') traceback.print_exc(file=sys.stdout) print('-------------------------Reason End---------------------------\n') raise e finally: account_operations.logout(session_uuid) deploy_logger('[Done] zstack initial database was created successfully.')
def dump_zstack(save_to_file = None, admin_passwd = None): xml_root = etree.Element("deployerConfig") try: session_uuid = account_operations.login_as_admin(admin_passwd) get_node(xml_root, session_uuid) get_instance_offering(xml_root, session_uuid) get_disk_offering(xml_root, session_uuid) get_backup_storage(xml_root, session_uuid) get_image(xml_root, session_uuid) get_zone(xml_root, session_uuid) except Exception as e: try: account_operations.logout(session_uuid) except: print ' ' raise e account_operations.logout(session_uuid) new_xml = str(beautify_xml_element(xml_root)) # new_xml = new_xml.replace('" ', '"\n') new_xml = make_xml_editable(new_xml) print new_xml if save_to_file: open(save_to_file, 'w').write(new_xml)