This is an automated email from the ASF dual-hosted git repository.

jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9912242  VCL-1084 - set cache mode for libvirt VMs
9912242 is described below

commit 9912242b77e3128bdc66af3a7763533c4d29d6ae
Author: Josh Thompson <jftho...@ncsu.edu>
AuthorDate: Tue May 28 14:29:47 2019 -0400

    VCL-1084 - set cache mode for libvirt VMs
    
    libvirt.pm: modified generate_domain_xml: added check for vmpath being on 
local disk and if so, set flag to set disk cache to none; after creation of 
$xml_hashref, if flag set for disk cache, add disk cache none to xml_hashref
---
 managementnode/lib/VCL/Module/Provisioning/libvirt.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm 
b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
index b38ffff..e45e2bc 100644
--- a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
@@ -1736,6 +1736,13 @@ sub generate_domain_xml {
        
        my $copy_on_write_file_path = $self->get_copy_on_write_file_path();
        my $image_type = $self->data->get_vmhost_datastore_imagetype_name();
+       my $vmhost_vmpath = $self->data->get_vmhost_profile_vmpath();
+       my $add_disk_cache = 0;
+       if ($self->os->nathost_os->is_file_on_local_disk($vmhost_vmpath)) {
+               # set disk cache to none if vmpath on local disk so live 
migration will work
+               $add_disk_cache = 1;
+       }
+
        my $disk_driver_name = $self->driver->get_disk_driver_name();
        my $disk_bus_type = $self->get_master_xml_disk_bus_type();
        
@@ -1912,6 +1919,11 @@ EOF
                        }
                ]
        };
+
+       if ($add_disk_cache) {
+               notify($ERRORS{'DEBUG'}, 0, "vmpath ($vmhost_vmpath) is on 
local disk; setting disk cache to none");
+               $xml_hashref->{'devices'}[0]{'disk'}[0]{'driver'}{'cache'} = 
'none';
+       }
        
        notify($ERRORS{'DEBUG'}, 0, "generated domain XML:\n" . 
format_data($xml_hashref));
        return hash_to_xml_string($xml_hashref, 'domain');

Reply via email to