Quick question about the XML-RPC API

Hi there,

We are looking for a way to use opennebula XML-RPC API to execute linux commands like for example ‘growpart’ or ‘resize2fs’ inside guest VMs.

Is there any API methods that we can use to do this?

The only way that OpenNebula has to launch these commands is at boot time through the context packages:

http://docs.opennebula.org/5.4/operation/vm_setup/context_overview.html

The action is triggered if there is a disk resize, but there is no way to force this other than making the resize through OpenNebula and rebooting the VM.

Not ideal, but for basic resizing on linux VMs the following snippet dropped as /etc/udev/rules.d/90-diskresize.rules works for me:

SUBSYSTEM!="block", GOTO="oneend"
ACTION=="change", GOTO="onediskresize"
GOTO="oneend"
LABEL="onediskresize"
ENV{PATH}="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
PROGRAM!="/etc/one-context.d/loc-05-grow-rootfs", GOTO="oneend"
LABEL="oneend"

It is a little bit weird but crafted this way works on the udev implementations I hit.

Best Regards,
Anton Todorov

2 Likes

Thanks, Anton!

The script is working perfectly :slight_smile:

1 Like