Dump Virtualization Types of KVM Virtualization Hosts
0 Votes |
Description
This task creates a file named "Virt_Domains.lst" containing the types of virtualization available on a KVM virtualization host (using virsh)
A corresponding analysis returns the retrieved values reading them from the file (lines of file "Virt_Domains.lst") |
Property Details
26635 | |
Beta - Preliminary testing ready for more | |
Dump Virtualization Types of KVM Virtualization Hosts | |
VM Managers | |
Andrea_Capasso@it.ibm.com with partial copy of BigFix Inventory task | |
High | |
7/16/2019 12:00:00 AM | |
KVM Virtualization | |
True | |
kapax on 7/17/2019 6:03:13 AM | |
kapax on 7/17/2019 6:12:48 AM | |
2908 Views / 2 Downloads | |
![]() ![]() ![]() ![]() ![]() |
Relevance
Used in 2 fixlets | * Results in a true/false |

(if (name of it as lowercase starts with "win") then (true) else ((name of it as lowercase starts with "linux") OR (name of it as lowercase starts with "aix") OR (name of it as lowercase starts with "mac") OR (name of it as lowercase starts with "hp-ux" AND ((architecture of it as lowercase contains "ia64") OR (family name of main processor as lowercase contains "pa-risc") OR (exists match (regex "^PA8[0-9]{3}(\s+)?$") of (family name of main processor)))) OR (exists match (regex "sunos 5\.(8|9|10|11)") of (name of it as lowercase)) of operating system)) of operating system AND (if exists property "in proxy agent context" then ( not in proxy agent context ) else true)
Used in 1 fixlet | * Results in a true/false |

not exists settings whose (name of it equals "CIT_Deny" AND value of it = "1") of client
Used in 1 fixlet | * Results in a true/false |

( ( name of it as lowercase starts with "linux" AND ( ( exists match ( regex "^i[0-9]86$" ) of it ) of ( architecture of it as lowercase ) OR architecture of it as lowercase = "x86_64" OR architecture of it as lowercase starts with "ppc" ) ) of operating system ) of operating system
Used in 1 fixlet | * Results in a true/false |

exists file "/usr/bin/virsh" OR exists file "/usr/local/sbin/virsh" OR exists file "/usr/local/bin/virsh" OR exists file "/sbin/virsh" OR exists file "/bin/virsh" OR exists file "/usr/sbin/virsh" OR exists file "/usr/bin/xl" OR exists file "/usr/local/sbin/xl" OR exists file "/usr/local/bin/xl" OR exists file "/sbin/xl" OR exists file "/bin/xl" OR exists file "/usr/sbin/xl" OR exists file "/opt/xensource/bin/xl"
Used in 1 fixlet | * Results in a true/false |

exists file "/usr/bin/xmllint" OR exists file "/usr/local/sbin/xmllint" OR exists file "/usr/local/bin/xmllint" OR exists file "/sbin/xmllint" OR exists file "/bin/xmllint" OR exists file "/usr/sbin/xmllint"
Used in 1 fixlet | * Results in a true/false |

not exist files "Virt_Domains.lst" of folders "vtech" of folder "LMT" of parent folder of data folder of client
Actions
Action 1 (default)
Action Link Click
here to deploy this action.
Script Type
BigFix Action Script
parameter "sourceReleaseDate" = "2019-01-08"
if {not (exists parameter "collectHostnames")}
parameter "collectHostnames" = "false"
endif
parameter "checkDomainfilebase" = "vmman_checkDomain"
parameter "homefolder" = "{(if (version of client >= "9" as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of parent folder of client folder of site "actionsite")) & "/LMT"}"
parameter "outdir_vtech" = "{(parameter "homefolder" as string) & "/vtech"}"
parameter "outdir" = "{(parameter "homefolder" as string) & "/VMMAN/upload"}"
parameter "run_checkDomain_script" = "{parameter "outdir_vtech" as string}/run_vtech_check.sh"
parameter "logfilepath" = "{parameter "outdir_vtech" as string}/run_vtech_checkDomain.log"
parameter "logfilepath_template" = "{parameter "outdir_vtech" as string}/run_vtech_checkDomain"
parameter "hostidfilepath" = "{parameter "outdir_vtech" as string}/vmman_host_id"
wait mkdir -p "{parameter "outdir_vtech"}"
continue if {exit code of action = 0}
wait mkdir -p "{parameter "outdir"}"
continue if {exit code of action = 0}
parameter "checkDomainfilepath_previous" = "{(parameter "outdir_vtech" as string) & "/" & (parameter "checkDomainfilebase" as string) & "_previous.xml" }"
parameter "checkDomainfilepath_current" = "{(parameter "outdir_vtech" as string) & "/" & (parameter "checkDomainfilebase" as string) & "_current.xml" }"
// run scanner
delete "{parameter "run_checkDomain_script" as string}"
createfile until eofdelim
#!/bin/bash
/etc/init.d/libvirtd start
# Set English locale
LANG=C
# allow overwrite a file's content by redirecting some output to it (>)
set +o noclobber
currData=`date -u +"%Y-%m-%d %H:%M:%S UTC"`
vtechDir="{parameter "outdir_vtech" as string}"
echo $currData > "$vtechDir/last_checkDomain_attempt.info"
echo 0 > "$vtechDir/checkDomain_status.info"
#errors of piped commands are ANDed
set -o pipefail
logMsg()
{{
TS=`date +%Y-%m-%d:%H:%M:%S`
echo "$TS $1" >> "{parameter "logfilepath" as string}"
}
exitMsg()
{{
logMsg "Exiting."
echo 2:$1 > "$vtechDir/checkDomain_status.info"
exit $1
}
exitWithError()
{{
logMsg "Command: '$1', failed with error: $2."
exitMsg $2
}
exitWrongResult()
{{
logMsg "Command: '$1', returned wrong result: $2."
exitMsg $3
}
exitIfNotNumber()
{{
if ! [[ "$2" =~ ^[[:digit:]]+$ ]]; then
logMsg "A number expected for parameter: $1, while got: $2."
exitMsg 40
fi
}
logError()
{{
logMsg "Command: '$1', failed with error: $2. Continuing."
}
if [ -f "{parameter "logfilepath" as string}" ] ; then
# 1MB size
MAXSIZE=1000000
SIZE=$(wc -c "{parameter "logfilepath" as string}" | cut -f 1 -d ' ')
if [ $SIZE -ge $MAXSIZE ]; then
mv -f "{parameter "logfilepath" as string}" "{parameter "logfilepath_template" as string}_2.log"
touch "{parameter "logfilepath" as string}"
fi
else
touch "{parameter "logfilepath" as string}"
fi
logMsg "Starting."
# find available virtualization types:
VIRT_TYPES="Unknown"
CMD_EXE="virsh --readonly capabilities 2>/dev/null | cat | grep \"domain type\" | sort -u | cut -f2 -d\' "
VIRT_TYPES=`eval "$CMD_EXE"`;
echo $VIRT_TYPES > "$vtechDir/Virt_Domains.lst"
exit 0
eofdelim
//*********************************** CREATE FILE "run_checkDomain_script" END *********************************** //
move __createfile "{parameter "run_checkDomain_script" as string}"
wait bash -C "{parameter "run_checkDomain_script" as string}"
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Sharing
Social Media: |