mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
lsvm to display VM details
This commit is contained in:
parent
cf872bf57b
commit
aa3c152ae2
@ -56,15 +56,15 @@ DESCRIPTION
|
||||
***********
|
||||
|
||||
|
||||
The lsvm command lists all partition profiles defined for the partitions specified in noderange. If noderange is a CEC, all the partitions associated with that CEC are displayed.
|
||||
The \ **lsvm**\ command lists all partition profiles defined for the partitions specified in \ *noderange*\ . If \ *noderange*\ is a CEC, all the partitions associated with that CEC are displayed.
|
||||
|
||||
For PPC (using Direct FSP Management):
|
||||
======================================
|
||||
|
||||
|
||||
For Power 775(use option \ *--p775*\ to specify), lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information.
|
||||
For Power 775 (use option \ **-**\ **-p775**\ to specify), \ **lsvm**\ lists all partition I/O slots information for the partitions specified in \ *noderange*\ . If \ *noderange*\ is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information.
|
||||
|
||||
For DFM-managed (short for Direct FSP Management mode) normal power machine, lsvm lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC.
|
||||
For DFM-managed (short for Direct FSP Management mode) normal power machine, \ **lsvm**\ lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC.
|
||||
|
||||
The pump mode value has the valid options:
|
||||
1 - Node Pump Mode
|
||||
@ -83,9 +83,9 @@ For KVM and VMware
|
||||
==================
|
||||
|
||||
|
||||
The virtual machines that defined in the hypervisor \ *noderange*\ will be displayed. \ *noderange*\ can only be hypervisor.
|
||||
If \ *noderange*\ is a hypervisor, virtual machines defined on that hypervisor will be displayed. If \ *noderange*\ is a VM, details for that VM will be displayed.
|
||||
|
||||
Note: Only the virtual machine which is in power on state can be listed by lsvm command.
|
||||
Note: Only the virtual machine which is in power on state can be listed by \ **lsvm**\ command.
|
||||
|
||||
|
||||
For zVM:
|
||||
@ -107,7 +107,7 @@ Display usage message.
|
||||
|
||||
\ **-v**\
|
||||
|
||||
Command Version.
|
||||
Command version.
|
||||
|
||||
\ **-V**\
|
||||
|
||||
@ -157,7 +157,7 @@ Output is similar to:
|
||||
lpar3: name=lpar3,lpar_name=lpar3,lpar_id=4,lpar_env=aixlinux,all_resources=0,min_mem=512, desired_mem=2048, max_mem=3072,min_num_huge_pages=0,desired_num_huge_pages=0,max_num_huge_pages=0,proc_mode=shared, min_proc_units=0.5,desired_proc_units=0.5,max_proc_units=0.5,min_procs=1,desired_procs=1,max_procs=1, sharing_mode=uncap,uncap_weight=128,shared_proc_pool_id=0,shared_proc_pool_name=DefaultPool,io_slots=none, lpar_io_pool_ids=none,max_virtual_slots=10, "virtual_serial_adapters=1/server/1/any//any/1,0/server/1/any//any/1", virtual_scsi_adapters=2/client/1/p6vios/4/1,virtual_eth_adapters=3/0/1//0/1,hca_adapters=none,boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none,work_group_id=none,redundant_err_path_reporting=0, bsr_arrays=0,lhea_logical_ports=none,lhea_capabilities=none,lpar_proc_compat_mode=default,electronic_err_reporting=null
|
||||
|
||||
|
||||
2.To list all IVM-managed partitions associated with CEC cec01, enter:
|
||||
2. To list all IVM-managed partitions associated with CEC cec01, enter:
|
||||
|
||||
|
||||
.. code-block:: perl
|
||||
@ -252,7 +252,7 @@ Output is similar to:
|
||||
OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;
|
||||
|
||||
|
||||
6.To list the lparname of lpars, enter:
|
||||
6. To list the lparname of lpars, enter:
|
||||
|
||||
|
||||
.. code-block:: perl
|
||||
@ -360,9 +360,9 @@ Output is similar to:
|
||||
Available BSR array: 256
|
||||
|
||||
|
||||
Note: The lines list in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicate a physical I/O resource in normal power machine.
|
||||
Note: The lines listed in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicates a physical I/O resource in a normal power machine.
|
||||
|
||||
9.For DFM-managed partition on normal power machine, list out the detailed information:
|
||||
9. For DFM-managed partition on normal power machine, list out the detailed information:
|
||||
|
||||
|
||||
.. code-block:: perl
|
||||
|
@ -28,13 +28,13 @@ B<lsvm> I<noderange>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The lsvm command lists all partition profiles defined for the partitions specified in noderange. If noderange is a CEC, all the partitions associated with that CEC are displayed.
|
||||
The B<lsvm> command lists all partition profiles defined for the partitions specified in I<noderange>. If I<noderange> is a CEC, all the partitions associated with that CEC are displayed.
|
||||
|
||||
=head2 For PPC (using Direct FSP Management):
|
||||
|
||||
For Power 775(use option I<--p775> to specify), lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information.
|
||||
For Power 775 (use option B<--p775> to specify), B<lsvm> lists all partition I/O slots information for the partitions specified in I<noderange>. If I<noderange> is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information.
|
||||
|
||||
For DFM-managed (short for Direct FSP Management mode) normal power machine, lsvm lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC.
|
||||
For DFM-managed (short for Direct FSP Management mode) normal power machine, B<lsvm> lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC.
|
||||
|
||||
The pump mode value has the valid options:
|
||||
1 - Node Pump Mode
|
||||
@ -50,9 +50,9 @@ More information about this part, refer to the section Using the *vm commands to
|
||||
|
||||
=head2 For KVM and VMware
|
||||
|
||||
The virtual machines that defined in the hypervisor I<noderange> will be displayed. I<noderange> can only be hypervisor.
|
||||
If I<noderange> is a hypervisor, virtual machines defined on that hypervisor will be displayed. If I<noderange> is a VM, details for that VM will be displayed.
|
||||
|
||||
Note: Only the virtual machine which is in power on state can be listed by lsvm command.
|
||||
Note: Only the virtual machine which is in power on state can be listed by B<lsvm> command.
|
||||
|
||||
=head2 For zVM:
|
||||
|
||||
@ -67,7 +67,7 @@ Display usage message.
|
||||
|
||||
B<-v>
|
||||
|
||||
Command Version.
|
||||
Command version.
|
||||
|
||||
B<-V>
|
||||
|
||||
@ -101,7 +101,7 @@ Output is similar to:
|
||||
|
||||
lpar3: name=lpar3,lpar_name=lpar3,lpar_id=4,lpar_env=aixlinux,all_resources=0,min_mem=512, desired_mem=2048, max_mem=3072,min_num_huge_pages=0,desired_num_huge_pages=0,max_num_huge_pages=0,proc_mode=shared, min_proc_units=0.5,desired_proc_units=0.5,max_proc_units=0.5,min_procs=1,desired_procs=1,max_procs=1, sharing_mode=uncap,uncap_weight=128,shared_proc_pool_id=0,shared_proc_pool_name=DefaultPool,io_slots=none, lpar_io_pool_ids=none,max_virtual_slots=10, "virtual_serial_adapters=1/server/1/any//any/1,0/server/1/any//any/1", virtual_scsi_adapters=2/client/1/p6vios/4/1,virtual_eth_adapters=3/0/1//0/1,hca_adapters=none,boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none,work_group_id=none,redundant_err_path_reporting=0, bsr_arrays=0,lhea_logical_ports=none,lhea_capabilities=none,lpar_proc_compat_mode=default,electronic_err_reporting=null
|
||||
|
||||
2.To list all IVM-managed partitions associated with CEC cec01, enter:
|
||||
2. To list all IVM-managed partitions associated with CEC cec01, enter:
|
||||
|
||||
lsvm cec01
|
||||
|
||||
@ -164,7 +164,7 @@ Output is similar to:
|
||||
OctantID=6,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;
|
||||
OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;
|
||||
|
||||
6.To list the lparname of lpars, enter:
|
||||
6. To list the lparname of lpars, enter:
|
||||
|
||||
lsvm cec1 -l --p775
|
||||
|
||||
@ -248,9 +248,9 @@ Output is similar to:
|
||||
Bytes per BSR array: 4096
|
||||
Available BSR array: 256
|
||||
|
||||
Note: The lines list in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicate a physical I/O resource in normal power machine.
|
||||
Note: The lines listed in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicates a physical I/O resource in a normal power machine.
|
||||
|
||||
9.For DFM-managed partition on normal power machine, list out the detailed information:
|
||||
9. For DFM-managed partition on normal power machine, list out the detailed information:
|
||||
|
||||
lsvm lpar1
|
||||
|
||||
|
@ -81,7 +81,7 @@ sub handled_commands {
|
||||
#rvitals => 'nodehm:mgt',
|
||||
#rinv => 'nodehm:mgt',
|
||||
getrvidparms => 'nodehm:mgt',
|
||||
lsvm => 'nodehm:mgt=ipmi',
|
||||
lsvm => ['nodehm:mgt=ipmi', 'nodehm:mgt=kvm'], #allow both hypervisor and VMs as params
|
||||
rbeacon => 'nodehm:mgt',
|
||||
revacuate => 'hypervisor:type',
|
||||
vmstatenotify => 'hypervisor:type',
|
||||
@ -3512,11 +3512,73 @@ sub rscan {
|
||||
}
|
||||
|
||||
sub lsvm {
|
||||
my $node = shift;
|
||||
my $host = shift;
|
||||
my $vm = shift;
|
||||
my @doms = $hypconn->list_domains();
|
||||
my @vms;
|
||||
foreach (@doms) {
|
||||
push @vms, $_->get_name();
|
||||
|
||||
if ($host ne $vm) {
|
||||
# Processing lsvm for a VM, display details about that VM
|
||||
foreach (@doms) {
|
||||
if ($_->get_name() eq $vm) {
|
||||
push @vms, "Id:" . $_->get_id();
|
||||
push @vms, "Host:" . $host;
|
||||
push @vms, "OS:" . $_->get_os_type();
|
||||
my $domain_info = $_->get_info();
|
||||
if (exists $domain_info->{"memory"}) {
|
||||
push @vms, "Memory:" . $domain_info->{"memory"};
|
||||
}
|
||||
if (exists $domain_info->{"nrVirtCpu"}) {
|
||||
push @vms, "Virt CPU: " . $domain_info->{"nrVirtCpu"};
|
||||
}
|
||||
if (exists $domain_info->{"state"}) {
|
||||
my $state = $domain_info->{"state"};
|
||||
my $state_string = "Unknown";
|
||||
if ($state == &Sys::Virt::Domain::STATE_NOSTATE) {$state_string = "The domain is active, but is not running / blocked (eg idle)";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_RUNNING) {$state_string = "The domain is active and running";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_BLOCKED) {$state_string = "The domain is active, but execution is blocked";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_PAUSED) {$state_string = "The domain is active, but execution has been paused";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) {$state_string = "The domain is active, but in the shutdown phase";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_SHUTOFF) {$state_string = "The domain is inactive, and shut down";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_CRUSHED) {$state_string = "The domain is inactive, and crashed";}
|
||||
elsif ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) {$state_string = "The domain is active, but in power management suspend state";}
|
||||
push @vms, "State :" . $domain_info->{"state"} . " ($state_string)";
|
||||
}
|
||||
# The following block of code copied from rscan command processng for disks
|
||||
my $currxml = $_->get_xml_description();
|
||||
if ($currxml) {
|
||||
my $domain = $parser->parse_string($currxml);
|
||||
my @vmstoragediskobjs = $domain->findnodes("/domain/devices/disk");
|
||||
foreach my $vmstoragediskobj (@vmstoragediskobjs) {
|
||||
my ($vmstorage_file_obj, $vmstorage_block_obj);
|
||||
if (($vmstoragediskobj->getAttribute("device") eq "disk") and ($vmstoragediskobj->getAttribute("type") eq "file")) {
|
||||
my @vmstorageobj = $vmstoragediskobj->findnodes("./source");
|
||||
if (@vmstorageobj) {
|
||||
$vmstorage_file_obj = $vmstorageobj[0]->getAttribute("file");
|
||||
push @vms, "Disk file:" . $vmstorage_file_obj;
|
||||
}
|
||||
}
|
||||
if (($vmstoragediskobj->getAttribute("device") eq "disk") and ($vmstoragediskobj->getAttribute("type") eq "block")) {
|
||||
my @vmstorageobj = $vmstoragediskobj->findnodes("./source");
|
||||
if (@vmstorageobj) {
|
||||
$vmstorage_block_obj = $vmstorageobj[0]->getAttribute("dev");
|
||||
push @vms, "Disk object:" . $vmstorage_block_obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Processing lsvm for hypervisor, display a list of VMs on that hypervisor
|
||||
foreach (@doms) {
|
||||
push @vms, $_->get_name();
|
||||
}
|
||||
}
|
||||
# Check if we were able to get any data
|
||||
unless (@vms) {
|
||||
push @vms, "Could not get any information about specified object";
|
||||
}
|
||||
return (0, @vms);
|
||||
}
|
||||
@ -3547,7 +3609,7 @@ sub guestcmd {
|
||||
} elsif ($command eq "getcons") {
|
||||
return getcons($node, @args);
|
||||
} elsif ($command eq "lsvm") {
|
||||
return lsvm($node, @args);
|
||||
return lsvm($hyp, $node, @args);
|
||||
} elsif ($command eq "rscan") {
|
||||
return rscan($node, @args);
|
||||
}
|
||||
@ -3783,7 +3845,7 @@ sub process_request {
|
||||
if ($::XCATSITEVALS{usexhrm}) { $use_xhrm = 1; }
|
||||
$vmtab = xCAT::Table->new("vm");
|
||||
$confdata = {};
|
||||
unless ($command eq 'lsvm' or $command eq 'rscan') {
|
||||
unless ($command eq 'rscan') {
|
||||
xCAT::VMCommon::grab_table_data($noderange, $confdata, $callback);
|
||||
# Add debug info for issue 1958, the rmvm issue
|
||||
my $test_file_fd;
|
||||
@ -3824,7 +3886,8 @@ sub process_request {
|
||||
my $inputs = new IO::Select;
|
||||
my $sub_fds = new IO::Select;
|
||||
%hyphash = ();
|
||||
if ($command eq 'lsvm' or $command eq 'rscan') { #command intended for hypervisors, not guests
|
||||
|
||||
if ($command eq 'rscan') { #command intended for hypervisors, not guests
|
||||
foreach (@$noderange) { $hyphash{$_}->{nodes}->{$_} = 1; }
|
||||
} else {
|
||||
foreach (keys %{ $confdata->{vm} }) {
|
||||
@ -3868,6 +3931,12 @@ sub process_request {
|
||||
# foreach (keys %orphans) {
|
||||
# $hyphash{'!@!XCATDUMMYHYPERVISOR!@!'}->{nodes}->{$_}=1;
|
||||
# }
|
||||
} elsif ($command eq "lsvm") {
|
||||
# Special processing for lsvm command, which takes vm name or hypervisor name
|
||||
unless (%hyphash) {
|
||||
# if hyperhash has not been set already, we are processing vms, set it here
|
||||
foreach (@$noderange) { $hyphash{$_}->{nodes}->{$_} = 1; }
|
||||
}
|
||||
} else {
|
||||
$callback->({ error => "Can't find " . join(",", keys %orphans), errorcode => [1] });
|
||||
return;
|
||||
@ -4000,7 +4069,6 @@ sub dohyp {
|
||||
$offlinehyps{$hyp} = 1;
|
||||
}
|
||||
|
||||
|
||||
eval { #Contain Sys::Virt bugs that make $@ useless
|
||||
if ($hyp eq '!@!XCATDUMMYHYPERVISOR!@!') { #Fake connection for commands that have a fake hypervisor key
|
||||
$hypconn = 1;
|
||||
@ -4031,7 +4099,7 @@ sub dohyp {
|
||||
return 1, "General error establishing libvirt communication";
|
||||
}
|
||||
}
|
||||
if (($command eq 'mkvm' or $command eq 'chvm' or $command eq 'rpower') and $hypconn) {
|
||||
if (($command eq 'mkvm' or $command eq 'chvm' or $command eq 'rpower' or $command eq 'lsvm') and $hypconn) {
|
||||
my $nodeinfo = $hypconn->get_node_info();
|
||||
if (exists($nodeinfo->{model})) {
|
||||
$confdata->{$hyp}->{cpumodel} = $nodeinfo->{model};
|
||||
|
Loading…
x
Reference in New Issue
Block a user