简体   繁体   English

如何在Rails控制台中设置基本ManageIQ自动化环境?

[英]How to setup basic ManageIQ automate environment in Rails console?

I used to run some operations in ManageIQ through automate simulation, which is available from UI. 我曾经通过自动仿真在ManageIQ中运行一些操作,这可以从UI中获得。 I'd like to find a way to reproduce these operations from rails console. 我想找到一种从Rails控制台重现这些操作的方法。

For example operations for Instance management - migrate , evacuate or relocate instance. 例如,实例管理操作- migrateevacuate或重relocate实例。 How do I make it? 我该怎么做?

There's the common way to do this: 有这样做的常见方法:

Set up a basic $evm context in a Rails console 在Rails控制台中设置基本的$ evm上下文

# rails c

# $evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)

For example you can find any VM in vmdb and define it into a variable: 例如,您可以在vmdb中找到任何VM,并将其定义为变量:

# vm = $evm.vmdb('vm').find('some_id')

Similar with other objects, eg 与其他物体相似,例如

flavor = $evm.vmdb('flavor').find(flavor_id)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM