From e215e6cba9922e98cb358891a3f9be2e809d770f Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 5 Jan 2015 16:38:10 +0200 Subject: HyperV: Nova serial console access support Hyper-V provides a solid interface for accessing serial ports via named pipes, already employed in the Nova serial console log implementation. This patch makes use of this interface by implementing a simple TCP socket proxy, providing access to instance serial console ports. DocImpact Implements: blueprint hyperv-serial-ports Change-Id: I58c328391a80ee8b81f66b2e09a1bfa4b26e584c --- nova/virt/hyperv/pathutils.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'nova/virt/hyperv/pathutils.py') diff --git a/nova/virt/hyperv/pathutils.py b/nova/virt/hyperv/pathutils.py index d97a8b7ca6..48a2038b20 100644 --- a/nova/virt/hyperv/pathutils.py +++ b/nova/virt/hyperv/pathutils.py @@ -127,8 +127,19 @@ class PathUtils(pathutils.PathUtils): return self._get_instances_sub_dir(dir_name, create_dir=True, remove_dir=True) - def get_vm_console_log_paths(self, vm_name, remote_server=None): - instance_dir = self.get_instance_dir(vm_name, + def get_vm_console_log_paths(self, instance_name, remote_server=None): + instance_dir = self.get_instance_dir(instance_name, remote_server) console_log_path = os.path.join(instance_dir, 'console.log') return console_log_path, console_log_path + '.1' + + def copy_vm_console_logs(self, instance_name, dest_host): + local_log_paths = self.get_vm_console_log_paths( + instance_name) + remote_log_paths = self.get_vm_console_log_paths( + instance_name, remote_server=dest_host) + + for local_log_path, remote_log_path in zip(local_log_paths, + remote_log_paths): + if self.exists(local_log_path): + self.copy(local_log_path, remote_log_path) -- cgit v1.2.1