vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arku...@apache.org
Subject svn commit: r1778483 - in /vcl/trunk/managementnode/lib/VCL/Module/Provisioning: libvirt.pm libvirt/KVM.pm
Date Thu, 12 Jan 2017 22:38:33 GMT
Author: arkurth
Date: Thu Jan 12 22:38:33 2017
New Revision: 1778483

URL: http://svn.apache.org/viewvc?rev=1778483&view=rev
Log:
VCL-1008
Added code to KVM.pm::copy_virtual_disk to copy the .xml file if it exists.

Tweaked some domain settings in libvirt.pm::generate_domain_xml. Images were not loading on
all KVM hosts.
* Added: cpu->mode = host-model
* Added: cpu->model->fallback = allow
* Commented out: cpu->topology (not sure why this was added, was throwing off CPU count)
* Commented out: devices->disk->driver->cache = none (not sure why this was added,
without it VM gets set to hypervisor default)
* Commented out: devices->interface->target (doesn't seem to be required)
* Commented out: devices->video (doesn't seem to be required)

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm?rev=1778483&r1=1778482&r2=1778483&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm Thu Jan 12 22:38:33 2017
@@ -1740,14 +1740,20 @@ sub generate_domain_xml {
 		'memory' => [$memory_kb],
 		'vcpu'   => [$cpu_count],
 		'cpu' => [
+			
 			{
-				'topology' => [
-					{
-						'sockets' => $cpu_count,
-						'cores' => '2',
-						'threads' => '2',
-					}
-				],
+				mode => 'host-model',		# Required, some images won't boot on different hosts without
+				model => {
+					'fallback' => 'allow',
+				},
+				#'topology' => [
+				#	{
+				#		'sockets' => $cpu_count,
+				#		'cores' => '2',
+				#		'threads' => '2',
+				#	}
+				#],
+				
 			}
 		],
 		'clock' => [
@@ -1764,14 +1770,14 @@ sub generate_domain_xml {
 						'driver' => {
 							'name' => $disk_driver_name,
 							'type' => $image_type,
-							'cache' => 'none',
+							#'cache' => 'none',
 						},
 						'source' => {
 							'file' => $copy_on_write_file_path,
 						},
 						'target' => {
 							'bus' => $disk_bus_type,
-							'dev' => 'vda'
+							'dev' => 'vda',	# Required
 						},
 					}
 				],
@@ -1784,9 +1790,9 @@ sub generate_domain_xml {
 						'source' => {
 							$eth0_interface_type => $eth0_source_device,
 						},
-						'target' => {
-							'dev' => 'vnet0',
-						},
+						#'target' => {
+						#	'dev' => 'vnet0',
+						#},
 						'model' => {
 							'type' => $interface_model_type,
 						},
@@ -1799,9 +1805,9 @@ sub generate_domain_xml {
 						'source' => {
 							$eth1_interface_type => $eth1_source_device,
 						},
-						'target' => {
-							'dev' => 'vnet1',
-						},
+						#'target' => {
+						#	'dev' => 'vnet1',
+						#},
 						'model' => {
 							'type' => $interface_model_type,
 						},
@@ -1810,13 +1816,11 @@ sub generate_domain_xml {
 				'graphics' => [
 					{
 						'type' => 'vnc',
-					}
-				],
-				'video' => [
-					{
-						'model' => {
-							'type' => 'cirrus',
-						}
+						#'type' => 'spice',
+						#'autoport' => 'yes',
+						#'port' => '-1',
+						#'tlsPort' => '-1',
+						
 					}
 				],
 			}

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm?rev=1778483&r1=1778482&r2=1778483&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt/KVM.pm Thu Jan 12 22:38:33
2017
@@ -525,6 +525,14 @@ sub copy_virtual_disk {
 		return;
 	}
 	
+	# Copy the XML file if it exists (saved 'virsh dumpxml' from image capture)
+	my ($source_file_name, $source_directory_path, $source_file_extension) = fileparse($source_file_paths[0],
qr/\.[^.]*/);
+	my $source_xml_file_path = "$source_directory_path/$source_file_name.xml";
+	if ($self->vmhost_os->file_exists($source_xml_file_path)) {
+		my $destination_xml_file_path = "$destination_directory_path/$destination_file_name.xml";
+		$self->vmhost_os->copy_file($source_xml_file_path, $destination_xml_file_path)
+	}
+	
 	my $source_file_count = scalar(@source_file_paths);
 	my $source_file_paths_string;
 	my $raw_file_directory_path;



Mime
View raw message