From 06e6eb38ae09e41d5ed7a375961777cbc4108562 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 7 Jul 2014 15:47:08 -0700 Subject: [PATCH] fix bug 4186 [FVT on Power 8 DFM]chvm can't delete a assigned adapter for physical partition --- perl-xCAT/xCAT/FSPvm.pm | 19 +++++++++++++++---- perl-xCAT/xCAT/Usage.pm | 1 + xCAT-client/pods/man1/chvm.1.pod | 9 +++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index d76415c75..fea333ebc 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -53,6 +53,7 @@ my %param_list_map = ( 'vmcpus' => 'part_get_lpar_processing', 'vmmemory' => 'part_get_lpar_memory', 'vmphyslots' => 'part_get_all_io_bus_info', + 'del_physlots' => 'part_get_all_io_bus_info', 'vmnics' => 'part_get_all_vio_info', 'vmstorage' => 'part_get_all_vio_info', 'del_vadapter' => 'part_get_all_vio_info' @@ -62,7 +63,7 @@ sub chvm_parse_extra_options { my $args = shift; my $opt = shift; # Partition used attributes # - my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter); + my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter del_physlots); if (ref($args) ne 'ARRAY') { return "$args"; } @@ -94,7 +95,13 @@ sub chvm_parse_extra_options { if ($value !~ /^\d+$/) { return "Invalid param '$value', only one slot id can be specified"; } - + } elsif ($cmd eq "del_physlots") { + my @tmp_array = split ",",$value; + foreach (@tmp_array) { + unless (/(0x\w{8})/) { + return "'$_' is invalid"; + } + } } elsif ($cmd eq "vmothersetting") { if ($value =~ /hugepage:\s*(\d+)/i) { $opt->{huge_page} = $1; @@ -797,7 +804,7 @@ sub do_op_extra_cmds { $action = "set_huge_page"; } elsif ($op eq "vmcpus") { $action = "part_set_lpar_pending_proc"; - } elsif ($op eq "vmphyslots") { + } elsif ($op eq "vmphyslots" or $op eq "del_physlots") { $action = "set_io_slot_owner_uber"; } elsif ($op eq "del_vadapter") { $action = "part_clear_vslot_config"; @@ -885,7 +892,11 @@ sub do_op_extra_cmds { } my $tmp_value = ($param eq '*') ? $name : $param; xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value."); - my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value); + my @tmpd = @$d; + if ($op eq "del_physlots") { + @tmpd[0] = "-1"; + } + my $value = xCAT::FSPUtils::fsp_api_action($request, $name, \@tmpd, $action, 0, $tmp_value); if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) { return ([[$name, @$value[1], '1']]) ; } else { diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 7033510a3..265d71f73 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -243,6 +243,7 @@ my %usage = ( chvm [vmcpus=min/req/max] [vmmemory=min/req/max] [vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N] [vmnics=vlan1,vlan2] [vmstorage=] [--vios] + chvm [del_physlots=drc_index1,drc_index2...] chvm [del_vadapter=slotid] VMware specific: chvm [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory] diff --git a/xCAT-client/pods/man1/chvm.1.pod b/xCAT-client/pods/man1/chvm.1.pod index d73aaa0dc..ae732e21b 100644 --- a/xCAT-client/pods/man1/chvm.1.pod +++ b/xCAT-client/pods/man1/chvm.1.pod @@ -25,6 +25,7 @@ B I [B={B<*>|B}] B I [B] [B] [B] [B] [B [B>] [B<--vios>] + [B] [B] =head2 VMware/KVM specific: @@ -205,9 +206,13 @@ To specify the parameters that will be modified. To create new virtual adapter for the specified node. -=item B +=item B -To specify the slot id of the virtual adapter will be deleted. +To delete physical slots which are specified by the I. + +=item B + +To delete a virtual adapter specified by the I. =back