Author: arkurth
Date: Fri Apr 28 16:58:08 2017
New Revision: 1793117
URL: http://svn.apache.org/viewvc?rev=1793117&view=rev
Log:
VCL-974
Added a is_nested_virtualization_supported subroutine to VIM_SSH.pm and
vSphere_SDK.pm.
Added call to is_nested_virtualization_supported to VMware.pm::prepare_vmx. The
.vmx parameters required for nested VMs now only get added if it can be
verified that the host supports it.
Modified:
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm?rev=1793117&r1=1793116&r2=1793117&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm Fri
Apr 28 16:58:08 2017
@@ -3012,6 +3012,138 @@ sub _print_compatible_guest_os_hardware_
#/////////////////////////////////////////////////////////////////////////////
+=head2 get_host_capability_info
+
+ Parameters : none
+ Returns : hash reference
+ Description : Retrieves information about the capabilities of the VMware host.
+ A hash reference is returned similar to:
+ {
+ "bootOptionsSupported" => "true",
+ "bootRetryOptionsSupported" => "true",
+ "canConnectUSBDevices" => "<unset>",
+ "changeTrackingSupported" => "false",
+ "consolePreferencesSupported" => "true",
+ "cpuFeatureMaskSupported" => "true",
+ "disableSnapshotsSupported" => "false",
+ "diskSharesSupported" => "true",
+ "featureRequirementSupported" => "true",
+ "guestAutoLockSupported" => "true",
+ "hostBasedReplicationSupported" => "true",
+ "lockSnapshotsSupported" => "false",
+ "memoryReservationLockSupported" => "true",
+ "memorySnapshotsSupported" => "true",
+ "messageBusSupported" => "true",
+ "multipleCoresPerSocketSupported" => "true",
+ "multipleSnapshotsSupported" => "true",
+ "nestedHVSupported" => "true",
+ "npivWwnOnNonRdmVmSupported" => "true",
+ "perVmEvcSupported" => "<unset>",
+ "poweredOffSnapshotsSupported" => "true",
+ "poweredOnMonitorTypeChangeSupported" => "true",
+ "quiescedSnapshotsSupported" => "true",
+ "recordReplaySupported" => "true",
+ "revertToSnapshotSupported" => "true",
+ "s1AcpiManagementSupported" => "true",
+ "seSparseDiskSupported" => "true",
+ "secureBootSupported" => "<unset>",
+ "settingDisplayTopologyModesSupported" => "true",
+ "settingDisplayTopologySupported" => "false",
+ "settingScreenResolutionSupported" => "true",
+ "settingVideoRamSizeSupported" => "true",
+ "snapshotConfigSupported" => "true",
+ "snapshotOperationsSupported" => "true",
+ "swapPlacementSupported" => "true",
+ "toolsAutoUpdateSupported" => "false",
+ "toolsRebootPredictSupported" => "<unset>",
+ "toolsSyncTimeSupported" => "true",
+ "vPMCSupported" => "true",
+ "virtualMmuUsageSupported" => "true",
+ "vmNpivWwnDisableSupported" => "true",
+ "vmNpivWwnSupported" => "true",
+ "vmNpivWwnUpdateSupported" => "true",
+ "vmfsNativeSnapshotSupported" => "false"
+ }
+
+=cut
+
+sub get_host_capability_info {
+ my $self = shift;
+ if (ref($self) !~ /VCL::Module/i) {
+ notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a
function, it must be called as a class method");
+ return;
+ }
+
+ if (defined($self->{host_capability_info})) {
+ return $self->{host_capability_info};
+ }
+
+ my $vmhost_computer_name = $self->data->get_vmhost_short_name();
+
+ my $version_key = $self->get_highest_vm_hardware_version_key();
+ if (!$version_key) {
+ notify($ERRORS{'WARNING'}, 0, "unable to retrieve host
capability info from $vmhost_computer_name, failed to retrieve highest
supported virtual machine hardware");
+ return;
+ }
+
+ my $config_option_info = $self->get_config_option_info($version_key);
+ if (!$config_option_info) {
+ notify($ERRORS{'WARNING'}, 0, "unable to retrieve host
capability info from $vmhost_computer_name, failed to retrieve host config
option info");
+ return;
+ }
+
+ if ($config_option_info->{capabilities}) {
+ $self->{host_capability_info} =
$config_option_info->{capabilities};
+ return $self->{host_capability_info};
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "failed to retrieve host
capability info from $vmhost_computer_name, config option info does not contain
a 'capabilities' key:\n" . format_hash_keys($config_option_info));
+ return;
+ }
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 is_nested_virtualization_supported
+
+ Parameters : none
+ Returns : boolean
+ Description : Determines whether or not the VMware host supports nested
+ hardware-assisted virtualization.
+
+=cut
+
+sub is_nested_virtualization_supported {
+ my $self = shift;
+ if (ref($self) !~ /VCL::Module/i) {
+ notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a
function, it must be called as a class method");
+ return;
+ }
+
+ my $vmhost_computer_name = $self->data->get_vmhost_short_name();
+
+ my $host_capability_info = $self->get_host_capability_info();
+ if (!$host_capability_info) {
+ notify($ERRORS{'WARNING'}, 0, "unable to determine if nested
virtualization is supported on $vmhost_computer_name, failed to retrieve host
capability info");
+ return;
+ }
+
+ if (!defined($host_capability_info->{nestedHVSupported})) {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is NOT
supported on $vmhost_computer_name, host capability info does not contain a
'nestedHVSupported' key:\n" . format_hash_keys($host_capability_info));
+ return 0;
+ }
+ elsif ($host_capability_info->{nestedHVSupported} !~ /true/i) {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is NOT
supported on $vmhost_computer_name, nestedHVSupported value:
$host_capability_info->{nestedHVSupported}");
+ return 0;
+ }
+ else {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is supported
on $vmhost_computer_name, nestedHVSupported value:
$host_capability_info->{nestedHVSupported}");
+ return 1;
+ }
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
=head2 _parse_vim_cmd_output
Parameters : $vim_cmd_output
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1793117&r1=1793116&r2=1793117&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Fri
Apr 28 16:58:08 2017
@@ -1747,17 +1747,12 @@ sub prepare_vmx {
".encoding" => "UTF-8",
#"bios.bootDelay" => "1000",
"config.version" => "8",
- "cpuid.1.ecx" => "--------------------------H-----",
"cpuid.coresPerSocket" => "$vm_cores_per_socket",
"displayName" => "$display_name",
- "featMask.vm.hv.capable" => "Min:1",
"floppy0.present" => "FALSE",
"guestOS" => "$guest_os",
"gui.exitOnCLIHLT" => "TRUE", # causes the virtual machine to
power off automatically when you choose Start > Shut Down from the Windows guest
- "hypervisor.cpuid.v0" => "FALSE",
"memsize" => "$vm_ram",
- "monitor.virtual_mmu" => "hardware",
- "monitor.virtual_exec" => "hardware",
"mem.hotadd" => "TRUE",
"msg.autoAnswer" => "TRUE", # tries to automatically answer
all questions that may occur at boot-time.
#"mks.enable3d" => "TRUE",
@@ -1781,11 +1776,21 @@ sub prepare_vmx {
"usb.present" => "TRUE",
"uuid.action" => "keep", # Keep the VM's uuid, keeps
existing MAC
"vcpu.hotadd" => "TRUE",
- "vhv.enable" => "TRUE",
"virtualHW.version" => "$vm_hardware_version",
"workingDir" => "$vmx_directory_path",
);
+ if ($self->api->is_nested_virtualization_supported()) {
+ %vmx_parameters = (%vmx_parameters, (
+ "cpuid.1.ecx" => "--------------------------H-----",
+ "featMask.vm.hv.capable" => "Min:1",
+ "hypervisor.cpuid.v0" => "FALSE",
+ "monitor.virtual_mmu" => "hardware",
+ "monitor.virtual_exec" => "hardware",
+ "vhv.enable" => "TRUE",
+ ));
+ }
+
#>>>>>>>>>>
## Experimental - Support for VMware ESXi's built in VNC server
functionality
#my $reservation_id = $self->data->get_reservation_id();
Modified:
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm?rev=1793117&r1=1793116&r2=1793117&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
Fri Apr 28 16:58:08 2017
@@ -4338,6 +4338,50 @@ sub get_vm_virtual_disk_file_paths {
#/////////////////////////////////////////////////////////////////////////////
+=head2 is_nested_virtualization_supported
+
+ Parameters : none
+ Returns : boolean
+ Description : Determines whether or not the VMware host supports nested
+ hardware-assisted virtualization.
+
+=cut
+
+sub is_nested_virtualization_supported {
+ my $self = shift;
+ if (ref($self) !~ /module/i) {
+ notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a
function, it must be called as a class method");
+ return;
+ }
+
+ my $vmhost_computer_name = $self->data->get_vmhost_short_name();
+
+ my $host_system_view = $self->_get_host_system_view() || return;
+
+ if (!$host_system_view) {
+ notify($ERRORS{'WARNING'}, 0, "unable to determine if nested
virtualization is supported on $vmhost_computer_name, failed to retrieve host
system view");
+ return;
+ }
+ elsif (!defined($host_system_view->{capability})) {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is NOT
supported on $vmhost_computer_name, host system view does NOT contain a
'capability' key:\n" . format_hash_keys($host_system_view));
+ return 0;
+ }
+ elsif (!defined($host_system_view->{capability}{nestedHVSupported})) {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is NOT
supported on $vmhost_computer_name, host system view capability info does NOT
contain a 'nestedHVSupported' key:\n" .
format_hash_keys($host_system_view->{capability}));
+ return 0;
+ }
+ elsif ($host_system_view->{capability}{nestedHVSupported} != 1) {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is NOT
supported on $vmhost_computer_name, nestedHVSupported value:
$host_system_view->{capability}{nestedHVSupported}");
+ return 0;
+ }
+ else {
+ notify($ERRORS{'DEBUG'}, 0, "nested virtualization is supported
on $vmhost_computer_name, nestedHVSupported value:
$host_system_view->{capability}{nestedHVSupported}");
+ return 1;
+ }
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
=head2 DESTROY
Parameters : none