Ask Your Question
0

How to execute a command on hosts (physical machines) via OpenStack code?

asked 2017-02-12 20:05:14 -0500

finixlei gravatar image

I am trying to modify/add some OpenStack code to implement such functionality: after users click one button on web page, some command will be executed on the specified host (e.g. one compute node). One user scenario is, enable KSM kernel feature on one specified host. All need to do is to execute "echo 1 > /sys/kernel/mm/ksm/run", then KSM kernel feature will be enabled. Now I can get the IP of the host (one compute node), but how to execute the above command by leveraging OpenStack code? (I checked all the Nova APIs. It seems there is no such Nova API to execute a command on a host. Also, I checked all the Ironic APIs. The same result.)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-02-17 01:32:10 -0500

silently gravatar image

so easy :

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.

you only get IP or hostname from webserver by openstack api . then call os's comand line .

don't forget get the result of last comand . because the command would executive failed in remote machine .

edit flag offensive delete link more
1

answered 2017-02-16 09:41:20 -0500

volenbovsky gravatar image

Hi,

OpenStack is not supposed to provide this functionality.

See Ansible for example, it has modules to manage many aspects of Linux hosts and hides a bit of complexity of Linux tools. You might leverage it in case you use Ansible (information about your hosts/authentication is already populated). Furthermore it might help in making further handling of this changes less error-prone. Or in general speaking: this is role of your installation/lifecycle management tool that you might be using for your deployment.

'Clicking button' in OpenStack context is about Horizon Dashboard, but integrating Horizon with management of physical hosts practically doesn't exist. At least when it comes to vanilla Horizon.

edit flag offensive delete link more

Comments

Horizon is not a problem. It's not vanilla Horizon but a custermized Horizon, so it can get node name and IP addresses.
I'm thinking such a strategy. Design a new Nova API that takes IP/node name. Then nova-api and nova-compute can take over. However, maybe permission is a problem.

finixlei gravatar imagefinixlei ( 2017-02-17 09:04:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-02-12 20:05:14 -0500

Seen: 355 times

Last updated: Feb 17 '17