1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 ep_file = '/etc/ceilometer/event_pipeline.yaml'
13 ep_file_bak = '/etc/ceilometer/event_pipeline.yaml.bak'
16 def restore_ep_config():
18 if not os.path.isfile(ep_file_bak):
19 print('Bak_file:%s does not exist.' % ep_file_bak)
22 shutil.copyfile(ep_file_bak, ep_file)
23 os.remove(ep_file_bak)
27 def restore_ed_config():
29 ed_file = '/etc/ceilometer/event_definitions.yaml'
30 ed_file_bak = '/etc/ceilometer/event_definitions.bak'
32 if not os.path.isfile(ed_file_bak):
33 print("Bak_file doesn't exist: %s." % ed_file_bak)
35 print('restore: %s' % ed_file)
36 shutil.copyfile(ed_file_bak, ed_file)
37 os.remove(ed_file_bak)
41 def restore_cpu_allocation_ratio():
42 nova_file = '/etc/nova/nova.conf'
43 nova_file_bak = '/etc/nova/nova.bak'
45 if not os.path.isfile(nova_file_bak):
46 print('Bak_file:%s does not exist.' % nova_file_bak)
48 print('restore: %s' % nova_file)
49 shutil.copyfile(nova_file_bak, nova_file)
50 os.remove(nova_file_bak)
55 restore_cpu_allocation_ratio()