summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2013-01-05 21:05:41 +1100
committerMichael Still <mikal@stillhq.com>2013-01-05 21:05:41 +1100
commit83ae3670a0e387d746582c5d50d4933fdd1f5b85 (patch)
treeb2e13a7ade76c30b2363bf333ed05c376a740aa4
parentef0ff2f51ad769b3c9f60a4fc7d3e7eb7b0ae305 (diff)
downloadnova-83ae3670a0e387d746582c5d50d4933fdd1f5b85.tar.gz
nova-83ae3670a0e387d746582c5d50d4933fdd1f5b85.tar.xz
nova-83ae3670a0e387d746582c5d50d4933fdd1f5b85.zip
livbirt: have a single source of console log file naming.
We were generating the path to the console log for libvirt in multiple places. This was just confusing. Let's have a single source of how these files are named. Change-Id: Iac3654c7f4fd68347b0fcc78f303b76f2bd1586c
-rw-r--r--nova/virt/libvirt/driver.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index c569a4ef9..365e49a8e 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1209,8 +1209,7 @@ class LibvirtDriver(driver.ComputeDriver):
@staticmethod
def _get_console_log_path(instance_name):
- return os.path.join(CONF.instances_path, instance_name,
- 'console.log')
+ return os.path.join(CONF.instances_path, instance_name, 'console.log')
def _chown_console_log_for_instance(self, instance_name):
console_log = self._get_console_log_path(instance_name)
@@ -1246,7 +1245,8 @@ class LibvirtDriver(driver.ComputeDriver):
self._chown_console_log_for_instance(instance['name'])
# NOTE(vish): No need add the suffix to console.log
- libvirt_utils.write_to_file(basepath('console.log', ''), '', 007)
+ libvirt_utils.write_to_file(
+ self._get_console_log_path(instance['name']), '', 007)
if not disk_images:
disk_images = {'image_id': instance['image_ref'],
@@ -1787,9 +1787,8 @@ class LibvirtDriver(driver.ComputeDriver):
# to configure two separate consoles.
consolelog = vconfig.LibvirtConfigGuestSerial()
consolelog.type = "file"
- consolelog.source_path = os.path.join(CONF.instances_path,
- instance['name'],
- "console.log")
+ consolelog.source_path = self._get_console_log_path(
+ instance['name'])
guest.add_device(consolelog)
consolepty = vconfig.LibvirtConfigGuestSerial()
@@ -2615,7 +2614,7 @@ class LibvirtDriver(driver.ComputeDriver):
os.mkdir(instance_dir)
# Touch the console.log file, required by libvirt.
- console_file = os.path.join(instance_dir, 'console.log')
+ console_file = self._get_console_log_path(instance_ref['name'])
libvirt_utils.file_open(console_file, 'a').close()
# if image has kernel and ramdisk, just download