はじめに
知られているかは不明ですが、HMC(Hardware Management Console) から管理対象のVIOS(VIrtual I/O Server) に対してコマンドを実行することが可能です。
HMC から viosvrcmd というコマンドを使用します。
viosvrcmd は、 Virtual I/O Server (VIOS) 上で入出力サーバー・コマンド行インターフェース (ioscli) コマンドを実行します。
ioscli コマンドは、ハードウェア管理コンソール (HMC) から、RMC セッションを介して VIOS に渡されます。 RMC は、ioscli コマンドの対話式実行を許可しません
参考: HMC: Using viosvrcmd to run VIOS root shell commands
検証環境
以下の環境で確認しました。
HMC : V10R2.1040.0
VIOS : 3.1.4.10
viosvrcmd の実行
testuser@hmc :~> viosvrcmd -m "Server-9105-41B-xxxxxxx" -p "vios2" -c "ioslevel"
3.1.4.10
testuser@hmc :~> viosvrcmd -m "Server-9105-41B-xxxxxxx" -p "vios2" -c "lspv"
NAME PVID VG STATUS
hdisk0 00c5ca21923baab6 rootvg active
hdisk3 none None
hdisk1 none None
hdisk2 none None
hdisk4 none None
hdisk6 none None
hdisk7 none None
-m 管理対象筐体
-p 対象VIOSLPAR名
-c VIOS コマンド
vios2 に対して lspv コマンドの結果が返ってきています。
oem_setup_env 環境の実行方法
--admin オプションで oem_setup_env 環境を実行できるとありますが、通常ユーザー(hmcsuperadmin)に権限がついていません。
testuser@hmc :~> viosvrcmd -m "Server-9105-41B-7xxxxx1" -p "vios2" -c "whoami" --admin
HSCL350B ユーザーには適切な権限がありません。
ViosAdminOp タスクロールの追加
--admin オプションの実行は "ViosAdminOp" をタスクロールに追加することが必要です。タスクロール変更は chaccfg コマンドを実施します。
・ViosAdminOpリソースのみをtestrole という名前のロールに指定する例。
testuser@hmc :~> chaccfg -t taskrole -i "name=testrole,"resources=lpar:ViosAdminOp""
testuser@hmc :~> echo $?
0
この場合、既存の taskrole を上書きされてしまいました。
testuser@hmc :~> lssccfg -t taskrole | grep testrole
name=testrole,parent=hmcsuperadmin,resources=lpar:ViosAdminOp
今度は既存のタスクロールを指定して、ViosAdminOp を付け加えて chaccfg コマンドを実行します。
testuser@hmc :~> chaccfg -t taskrole -i "name=testrole,"resources=""frame:ChangeFramePassword+ChangeFrameProperty+CheckPSN+DeactivateFrameIO+FrameInitialize+LaunchFrameAsm+ListFrameProperty+ManageFrameServEvents+ManagePSN+RefreshFrame+RemoveFrameConnection+RemoveFrameLock,cec:ActivateSystemProfile+BackupProfileData+CECPowerOff+CECPowerOn+CaptureSystemTemplate+ChangeCECPassword+ChangeCECProperty+ChangeCoD+ChangePowerManagement+ChangeSnmpAlerts+ChangeSystemConnectionProperty+ChangeSystemProfileProperty+ChangeTrustedSystemKey+ChangeVETCode+CoDPoolManagement+CollectCECVPDInfo+ConfigProcessorRecovery+CreateLPAR+CreatePassThruCommand+CreateSystemProfile+DLPARRestoreHWResources+DeleteSystemProfile+DeployPartitionTemplate+DeploySystemPlan+DeploySystemTemplate+DeviceMaintenance+DisconnectOtherHmc+EditCECMTMS+InitializeProfileData+InitializeSPFailover+LSProfileSpace+LaunchAsm+ListCECProperty+ListCoDInformation+ListCoDNotifications+ListNPortLogin+ListPCIeTopology+ListRioTopology+ListSSP+ListSnmpAlerts+ListSystemProfileProperty+ListTrustedSystemKey+ListUtilizationData+ListVETInfo+MakeSystemPlan+ManageCECServEvents+ManageCoDNotifications+ManageDumps+ManageSPP+ManageSSP+ManageSriovAdapter+ManageSysProfile+ManageUtilizationData+ManageVirtualNetwork+ManageVirtualStorage+MoveSriovAdapter+PartitionConfigurationImage+RebuildCEC+RecoverPartitionData+RemoveCECConnection+RemoveCEConnection+RemoveProfileData+RestoreProfileData+SetCECKeylockPosition+SysProfileCopy+UpdateLIC+ValidateSystemProfile+ViewDumps+ViewPowerManagement+ViewSPP,lpar:ActivateLPAR+CapturePartitionTemplate+ChangeLPARProperty+ChangeNPortLogin+ChangeProfileProperty+CloseVTerm+Connect5250VTerm+CreateProfile+Delete5250VTerm+DeleteLPAR+DeleteProfile+DisableEnableVirtualEthernet+DlparOperation+HibernateLPAR+ListLPARProperty+ListProfileProperty+ManageLPARDebugData+ManageLPARServEvents+ManageLicenseKeys+ManageProfile+MigrateLPAR+Open5250VTerm+OpenVTerm+PartProfileCopy+RRStartLPAR+RebootLPAR+RemoteRestartLPAR+ShutdownLPAR+VirtualIOServerCommand,HMCConsole:5250Task+AddConnection+BackupHMCData+CRLManagement+CertificateManagement+ChangeBmcCertificates+ChangeHMCConfiguration+ChangeHMCEncrTask+ChangeHMCFileSystems+ChangeLocale+ChangeProxyConfiguration+ChangeUserPasswords+ChangeUtilizationConfiguration+CollectVPDInfo+ConfigureDataReplication+CreateWelcomeText+CustServiceSettings+EditConsoleMTMS+EditTemplate+ExportData+FormatMedia+GetUpgradeFiles+GroupingApp+GuidedSetupWizard+ListBmcCertificates+ListCloudConnServiceSettings+ListConnections+ListConsoleNotifications+ListHMCConfiguration+ListHMCEncrTask+ListHMCRole+ListHMCTask+ListHMCUser+ListLdapCfg+ListProxyConfiguration+ListSNMPServiceSettings+ListServiceableEvents+ListStorageMedia+ListSystemPlan+LsILMTScan+ManageAllUserPasswords+ManageCloudConnServiceSettings+ManageConsoleDumps+ManageConsoleNotifications+ManageFCS+ManageHMCRole+ManageHMCUser+ManageSNMPServiceSettings+ManageServEvents+ManageSystemPlan+RemoteSystemLogSettings+RepairServEvent+RestoreUpgradeData+RunILMTScan+SVAgentXmitServiceInfo+SaveUpgradeData+ScheduleOperations+ShutdownHMC+TemplateLibrary+TerminateHMCTask+TipOfTheDay+UpdateHMC+UserSettings+ViewAllUsersTasksLog+ViewConsoleEvents+ViewHMCFileSystems+ViewInstallResourceList+ViewTasksLog+ViewVIOSInstallResourceList+ViosAdminOp"""
taskrole 確認。既存のタスクロールに ViosAdminOpが追加されました。
testuser@hmc :~> lsaccfg -t taskrole | grep testrole
name=testrole,parent=hmcsuperadmin,"resources=""frame:ChangeFramePassword+ChangeFrameProperty+CheckPSN+DeactivateFrameIO+FrameInitialize+LaunchFrameAsm+ListFrameProperty+ManageFrameServEvents+ManagePSN+RefreshFrame+RemoveFrameConnection+RemoveFrameLock,cec:ActivateSystemProfile+BackupProfileData+CECPowerOff+CECPowerOn+CaptureSystemTemplate+ChangeCECPassword+ChangeCECProperty+ChangeCoD+ChangePowerManagement+ChangeSnmpAlerts+ChangeSystemConnectionProperty+ChangeSystemProfileProperty+ChangeTrustedSystemKey+ChangeVETCode+CoDPoolManagement+CollectCECVPDInfo+ConfigProcessorRecovery+CreateLPAR+CreatePassThruCommand+CreateSystemProfile+DLPARRestoreHWResources+DeleteSystemProfile+DeployPartitionTemplate+DeploySystemPlan+DeploySystemTemplate+DeviceMaintenance+DisconnectOtherHmc+EditCECMTMS+InitializeProfileData+InitializeSPFailover+LSProfileSpace+LaunchAsm+ListCECProperty+ListCoDInformation+ListCoDNotifications+ListNPortLogin+ListPCIeTopology+ListRioTopology+ListSSP+ListSnmpAlerts+ListSystemProfileProperty+ListTrustedSystemKey+ListUtilizationData+ListVETInfo+MakeSystemPlan+ManageCECServEvents+ManageCoDNotifications+ManageDumps+ManageSPP+ManageSSP+ManageSriovAdapter+ManageSysProfile+ManageUtilizationData+ManageVirtualNetwork+ManageVirtualStorage+MoveSriovAdapter+PartitionConfigurationImage+RebuildCEC+RecoverPartitionData+RemoveCECConnection+RemoveCEConnection+RemoveProfileData+RestoreProfileData+SetCECKeylockPosition+SysProfileCopy+UpdateLIC+ValidateSystemProfile+ViewDumps+ViewPowerManagement+ViewSPP,lpar:ActivateLPAR+CapturePartitionTemplate+ChangeLPARProperty+ChangeNPortLogin+ChangeProfileProperty+CloseVTerm+Connect5250VTerm+CreateProfile+Delete5250VTerm+DeleteLPAR+DeleteProfile+DisableEnableVirtualEthernet+DlparOperation+HibernateLPAR+ListLPARProperty+ListProfileProperty+ManageLPARDebugData+ManageLPARServEvents+ManageLicenseKeys+ManageProfile+MigrateLPAR+Open5250VTerm+OpenVTerm+PartProfileCopy+RRStartLPAR+RebootLPAR+RemoteRestartLPAR+ShutdownLPAR+ViosAdminOp+VirtualIOServerCommand,HMCConsole:5250Task+AddConnection+BackupHMCData+CRLManagement+CertificateManagement+ChangeBmcCertificates+ChangeHMCConfiguration+ChangeHMCEncrTask+ChangeHMCFileSystems+ChangeLocale+ChangeProxyConfiguration+ChangeUserPasswords+ChangeUtilizationConfiguration+CollectVPDInfo+ConfigureDataReplication+CreateWelcomeText+CustServiceSettings+EditConsoleMTMS+EditTemplate+ExportData+FormatMedia+GetUpgradeFiles+GroupingApp+GuidedSetupWizard+ListBmcCertificates+ListCloudConnServiceSettings+ListConnections+ListConsoleNotifications+ListHMCConfiguration+ListHMCEncrTask+ListHMCRole+ListHMCTask+ListHMCUser+ListLdapCfg+ListProxyConfiguration+ListSNMPServiceSettings+ListServiceableEvents+ListStorageMedia+ListSystemPlan+LsILMTScan+ManageAllUserPasswords+ManageCloudConnServiceSettings+ManageConsoleDumps+ManageConsoleNotifications+ManageFCS+ManageHMCRole+ManageHMCUser+ManageSNMPServiceSettings+ManageServEvents+ManageSystemPlan+RemoteSystemLogSettings+RepairServEvent+RestoreUpgradeData+RunILMTScan+SVAgentXmitServiceInfo+SaveUpgradeData+ScheduleOperations+ShutdownHMC+TemplateLibrary+TerminateHMCTask+TipOfTheDay+UpdateHMC+UserSettings+ViewAllUsersTasksLog+ViewConsoleEvents+ViewHMCFileSystems+ViewInstallResourceList+ViewTasksLog+ViewVIOSInstallResourceList"""
権限付与後の viosvrcmd コマンド --admin オプション確認
testrole を付与した testuser で、--admin オプションをつけて viosvrcmd コマンドを実行します。
testuser@hmc :~> viosvrcmd -m "Server-9105-41B-xxxxxx" -p "vios2" -c "whoami" --admin
root
無事 --admin オプション付きで 実行できました。
まとめ
・viosvrcmd コマンドを使用すると HMC から管理筐体の VIOSにコマンドを実行することができます。
・VIOSの oem_setup_env 環境は タスクロールに ViosAdminOp を付与することで実行できる。
あまり使用用途は多くないかもしれませんが、scripting に便利かもしれません。
以上です。