mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-12 00:00:12 +00:00
Merge branch 'rscan_vmnics' of https://github.com/penguhyang/xcat-core into rscan_vmnics
This commit is contained in:
@ -35,7 +35,7 @@ The rscan command lists hardware information for each node managed by the hardwa
|
||||
|
||||
For the management module of blade, if the blade server is a Flex system P node, the fsp belongs to the blade server also will be scanned.
|
||||
|
||||
For the KVM host, all the KVM guests on the specified KVM host will be scanned. Note: currently rscan can only get the information of the "disk" device on the kvm guest with the underlying source as a "file" on the KVM host.
|
||||
For the KVM host, all the KVM guests on the specified KVM host will be scanned.
|
||||
|
||||
Note: The first line of the output always contains information about the hardware control point. When using the rscan command to generate output for HMC or IVM hardware control points, it provides the FSPs and BPAs as part of the output. The only exception is the rscan -u flag which provides updates made hardware control point in the xCAT database.
|
||||
|
||||
@ -55,7 +55,7 @@ OPTIONS
|
||||
|
||||
For the Flex system manager, both the blade server and fsp object of xCAT will be updated if the mpa and slot id are matched to the object which has been defined in the xCAT database.
|
||||
|
||||
For the KVM host, the information of the KVM guests which have been defined in xCAT database will be updated.
|
||||
For KVM host, the information of the KVM guests which have been defined in xCAT database will be updated.
|
||||
|
||||
Note: only the matched object will be updated.
|
||||
|
||||
@ -69,6 +69,8 @@ For KVM host, updates the information of the KVM guests which have been defined
|
||||
|
||||
\ **-z**\ Stanza formated output.
|
||||
|
||||
Note: For KVM host, -z is not a valid option for rscan.
|
||||
|
||||
|
||||
************
|
||||
RETURN VALUE
|
||||
@ -311,39 +313,12 @@ Output is similar to:
|
||||
blade [SN#YL10JH184079] Matched To =>[cmm01node03]
|
||||
|
||||
|
||||
8. To scan the KVM host "hyp01", list all the KVM guest information on the KVM host in stanza format and write the KVM guest information into xCAT database:
|
||||
8. To scan the KVM host "hyp01", write the KVM guest information into xCAT database:
|
||||
|
||||
|
||||
.. code-block:: perl
|
||||
|
||||
rscan hyp01 -z -w
|
||||
|
||||
|
||||
Output is similar to:
|
||||
|
||||
|
||||
.. code-block:: perl
|
||||
|
||||
kvm1
|
||||
arch=x86_64
|
||||
mac=
|
||||
mgt=kvm
|
||||
vmcpus=1
|
||||
vmhost=hyp01
|
||||
vmmemory=1024
|
||||
vmnicnicmodel=virtio
|
||||
vmnics=virbr0
|
||||
vmstorage=/install/vms/kvm1.hda.qcow2
|
||||
kvm2
|
||||
arch=x86_64
|
||||
mac=
|
||||
mgt=kvm
|
||||
vmcpus=2
|
||||
vmhost=hyp01
|
||||
vmmemory=1024
|
||||
vmnicnicmodel=virtio
|
||||
vmnics=virbr0
|
||||
vmstorage=/install/vms/kvm2.hda.qcow2
|
||||
rscan hyp01 -w
|
||||
|
||||
|
||||
9. To update definitions of kvm guest, which is managed by hypervisor hyp01, enter:
|
||||
|
@ -17,7 +17,7 @@ The rscan command lists hardware information for each node managed by the hardwa
|
||||
|
||||
For the management module of blade, if the blade server is a Flex system P node, the fsp belongs to the blade server also will be scanned.
|
||||
|
||||
For the KVM host, all the KVM guests on the specified KVM host will be scanned. Note: currently rscan can only get the information of the "disk" device on the kvm guest with the underlying source as a "file" on the KVM host.
|
||||
For the KVM host, all the KVM guests on the specified KVM host will be scanned.
|
||||
|
||||
Note: The first line of the output always contains information about the hardware control point. When using the rscan command to generate output for HMC or IVM hardware control points, it provides the FSPs and BPAs as part of the output. The only exception is the rscan -u flag which provides updates made hardware control point in the xCAT database.
|
||||
|
||||
@ -35,7 +35,7 @@ B<-u> Updates and then prints out node definitions in the xCAT database
|
||||
|
||||
For the Flex system manager, both the blade server and fsp object of xCAT will be updated if the mpa and slot id are matched to the object which has been defined in the xCAT database.
|
||||
|
||||
For the KVM host, the information of the KVM guests which have been defined in xCAT database will be updated.
|
||||
For KVM host, the information of the KVM guests which have been defined in xCAT database will be updated.
|
||||
|
||||
Note: only the matched object will be updated.
|
||||
|
||||
@ -49,6 +49,8 @@ B<-x> XML format.
|
||||
|
||||
B<-z> Stanza formated output.
|
||||
|
||||
Note: For KVM host, -z is not a valid option for rscan.
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
@ -230,32 +232,9 @@ Output is similar to:
|
||||
blade [SN#YL10JH184067] Matched To =>[cmm01node01]
|
||||
blade [SN#YL10JH184079] Matched To =>[cmm01node03]
|
||||
|
||||
8. To scan the KVM host "hyp01", list all the KVM guest information on the KVM host in stanza format and write the KVM guest information into xCAT database:
|
||||
8. To scan the KVM host "hyp01", write the KVM guest information into xCAT database:
|
||||
|
||||
rscan hyp01 -z -w
|
||||
|
||||
Output is similar to:
|
||||
|
||||
kvm1
|
||||
arch=x86_64
|
||||
mac=
|
||||
mgt=kvm
|
||||
vmcpus=1
|
||||
vmhost=hyp01
|
||||
vmmemory=1024
|
||||
vmnicnicmodel=virtio
|
||||
vmnics=virbr0
|
||||
vmstorage=/install/vms/kvm1.hda.qcow2
|
||||
kvm2
|
||||
arch=x86_64
|
||||
mac=
|
||||
mgt=kvm
|
||||
vmcpus=2
|
||||
vmhost=hyp01
|
||||
vmmemory=1024
|
||||
vmnicnicmodel=virtio
|
||||
vmnics=virbr0
|
||||
vmstorage=/install/vms/kvm2.hda.qcow2
|
||||
rscan hyp01 -w
|
||||
|
||||
9. To update definitions of kvm guest, which is managed by hypervisor hyp01, enter:
|
||||
|
||||
|
@ -2886,9 +2886,9 @@ sub mkvm {
|
||||
'force|f' => \$force
|
||||
);
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{othersettings}) {
|
||||
my $nodefrom = $confdata->{vm}->{$node}->[0]->{othersettings};
|
||||
if ($nodefrom =~ /^nodefromrscan/) {
|
||||
return 1, "this node was defined through rscan, it does not support to use 'mkvm' to create again.";
|
||||
my $vmothersettings = $confdata->{vm}->{$node}->[0]->{othersettings};
|
||||
if ($vmothersettings =~ /nodefromrscan/) {
|
||||
return 1, "this node was defined through rscan, 'mkvm' is not supported.";
|
||||
}
|
||||
}
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{storage}) {
|
||||
@ -3027,11 +3027,10 @@ sub power {
|
||||
sub rscan {
|
||||
my $hyper = shift;
|
||||
@ARGV=@_;
|
||||
my ($write, $update, $stanza, $create);
|
||||
my ($write, $update, $create);
|
||||
GetOptions(
|
||||
'w' => \$write,
|
||||
'u' => \$update,
|
||||
'z' => \$stanza,
|
||||
'n' => \$create,
|
||||
);
|
||||
my @doms;
|
||||
@ -3044,9 +3043,6 @@ sub rscan {
|
||||
}
|
||||
my %host2kvm;
|
||||
my @displaymsg;
|
||||
if ($stanza) {
|
||||
push @displaymsg, "# <xCAT data object stanza file>\n";
|
||||
}
|
||||
my $handle_vmtab;
|
||||
$handle_vmtab = xCAT::Table->new( "vm", -create=>1, -autocommit=>0 );
|
||||
if (!$handle_vmtab) {
|
||||
@ -3083,7 +3079,7 @@ sub rscan {
|
||||
my $domain=$parser->parse_string($currxml);
|
||||
my ($uuid, $node, $vmcpus, $vmmemory, $vmnics, $vmstorage, $arch, $mac, $vmnicnicmodel);
|
||||
my @uuidobj = $domain->findnodes("/domain/uuid");
|
||||
if (@uuidobj and defined($uuidobj[0])) {
|
||||
if (@uuidobj) {
|
||||
$uuid = $uuidobj[0]->to_literal;
|
||||
$uuid =~ s/^(..)(..)(..)(..)-(..)(..)-(..)(..)/$4$3$2$1-$6$5-$8$7/;
|
||||
}
|
||||
@ -3092,7 +3088,7 @@ sub rscan {
|
||||
$maxlength[0] = length($type);
|
||||
}
|
||||
my @nodeobj = $domain->findnodes("/domain/name");
|
||||
if (@nodeobj and defined($nodeobj[0])) {
|
||||
if (@nodeobj) {
|
||||
$node = $nodeobj[0]->to_literal;
|
||||
}
|
||||
if (length($node) > $maxlength[1]) {
|
||||
@ -3107,14 +3103,14 @@ sub rscan {
|
||||
$maxlength[3] = length($id);
|
||||
}
|
||||
my @vmcpusobj = $domain->findnodes("/domain/vcpu");
|
||||
if (@vmcpusobj and defined($vmcpusobj[0])) {
|
||||
if (@vmcpusobj) {
|
||||
$vmcpus = $vmcpusobj[0]->to_literal;
|
||||
}
|
||||
if (length($vmcpus) > $maxlength[4]) {
|
||||
$maxlength[4] = length($vmcpus);
|
||||
}
|
||||
my @vmmemoryobj = $domain->findnodes("/domain/memory");
|
||||
if (@vmmemoryobj and defined($vmmemoryobj[0])) {
|
||||
if (@vmmemoryobj) {
|
||||
my $mem = $vmmemoryobj[0]->to_literal;
|
||||
my $unit = $vmmemoryobj[0]->getAttribute("unit");
|
||||
if (($unit eq "KiB") or ($unit eq "k")) {
|
||||
@ -3145,14 +3141,14 @@ sub rscan {
|
||||
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 and defined($vmstorageobj[0])) {
|
||||
if (@vmstorageobj) {
|
||||
$vmstorage_file_obj = $vmstorageobj[0]->getAttribute("file");
|
||||
}
|
||||
$vmstorage .= "$vmstorage_file_obj,";
|
||||
}
|
||||
if (($vmstoragediskobj->getAttribute("device") eq "disk") and ($vmstoragediskobj->getAttribute("type") eq "block")) {
|
||||
my @vmstorageobj = $vmstoragediskobj->findnodes("./source");
|
||||
if (@vmstorageobj and defined($vmstorageobj[0])) {
|
||||
if (@vmstorageobj) {
|
||||
$vmstorage_block_obj = $vmstorageobj[0]->getAttribute("dev");
|
||||
}
|
||||
$vmstorage .= "$vmstorage_block_obj,";
|
||||
@ -3163,7 +3159,7 @@ sub rscan {
|
||||
$maxlength[7] = length($vmstorage);
|
||||
}
|
||||
my @archobj = $domain->findnodes("/domain/os/type");
|
||||
if (@archobj and defined($archobj[0])) {
|
||||
if (@archobj) {
|
||||
$arch = $archobj[0]->getAttribute("arch");
|
||||
}
|
||||
my @interfaceobjs = $domain->findnodes("/domain/devices/interface");
|
||||
@ -3173,13 +3169,13 @@ sub rscan {
|
||||
my @vmnicsobj = $interfaceobj->findnodes("./source");
|
||||
my @macobj = $interfaceobj->findnodes("./mac");
|
||||
my @vmnicnicmodelobj = $interfaceobj->findnodes("./model");
|
||||
if (@vmnicsobj and defined($vmnicsobj[0])) {
|
||||
if (@vmnicsobj) {
|
||||
$vmnics_obj = $vmnicsobj[0]->getAttribute("bridge");
|
||||
}
|
||||
if (@macobj and defined($macobj[0])) {
|
||||
if (@macobj) {
|
||||
$mac_obj = $macobj[0]->getAttribute("address");
|
||||
}
|
||||
if (@vmnicnicmodelobj and defined($vmnicnicmodelobj[0])) {
|
||||
if (@vmnicnicmodelobj) {
|
||||
$vmnicnicmodel_obj = $vmnicnicmodelobj[0]->getAttribute("type");
|
||||
}
|
||||
$vmnics .= "$vmnics_obj,";
|
||||
@ -3290,21 +3286,9 @@ sub rscan {
|
||||
$updatetable->{kvm_nodedata}->{$node}->{xml} = $currxml;
|
||||
}
|
||||
}
|
||||
if ($stanza) {
|
||||
push @displaymsg, "$node";
|
||||
push @displaymsg, " arch=$arch";
|
||||
push @displaymsg, " mac=$mac";
|
||||
push @displaymsg, " mgt=$type";
|
||||
push @displaymsg, " vmcpus=$vmcpus";
|
||||
push @displaymsg, " vmhost=$hypervisor";
|
||||
push @displaymsg, " vmmemory=$vmmemory";
|
||||
push @displaymsg, " vmnicnicmodel=$vmnicnicmodel";
|
||||
push @displaymsg, " vmnics=$vmnics";
|
||||
push @displaymsg, " vmstorage=$vmstorage";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$stanza) {
|
||||
if ((!$write) and (!$update) and (!$create)) {
|
||||
my $header;
|
||||
$rscan_header[0][1] = sprintf "%%-%ds",($maxlength[0]+3);
|
||||
$rscan_header[1][1] = sprintf "%%-%ds",($maxlength[1]+3);
|
||||
|
Reference in New Issue
Block a user