fog / fog-libvirt

libvirt provider for fog
MIT License
16 stars 42 forks source link

autostart support for servers #7

Closed plribeiro3000 closed 4 years ago

plribeiro3000 commented 9 years ago

Hi,

There is an autostart attribute in the server model for libvirt. However, I don't see where this attribute could be enabled when creating a VM. I don't know libvirt's API, but it seems there's a separate method to call when enabling autostart.

Is it currently possible to enable autostart when creating a VM with fog? If so, how? If not, would it be possible to add it?

Thank you.

Original issue opened by @eolamey at fog/fog#3343

cc/ @eolamey @geemus

ghost commented 9 years ago

Hi,

I am no longer needing this, should this issue be closed?

plribeiro3000 commented 9 years ago

Hey @eolamey. Thank you for the feedback but i believe those issues could live here a little longer. Now that we have a small repository it should be easier to add those features. =)

Thanks!

apatelKmd commented 4 years ago

Hey, @plribeiro3000 Is the issue planned for the near future? I use KVM on CentOS 7 and 8 and the missing auto start option will greatly enhance my setup.

plribeiro3000 commented 4 years ago

@apatelKmd would you be able to open a PR ?

apatelKmd commented 4 years ago

@plribeiro3000 Thanks for getting back. I am new to the project and willing to learn and contribute. I have consulted the CONTRIBUTION.md and the source code. I see that the :autostart as an attribute of the server.rb file but not used anywhere else.

Further investigation of ruby-libvirt-0.7.1/ext/libvirt/domain.c reveals methods exposed by the library.

I am having trouble with the starting point and need help. Review of the file CONTRIUBTION.md did not help me with a starting point. Do I need to work with the model or request? If the model, is it the server object or the node object?

This is what I am thinking I need to implement.

Query if the domain is set to autostart. Enable/Disable the domain to autostart based on the boolean value provided.

geemus commented 4 years ago

Querying the domain for an autostart value sounds like a request. And then checking the boolean and making the appropriate call sounds like something for the model. I'm not at all familiar with libvirt though. Does that help point you in the general direction?

plribeiro3000 commented 4 years ago

@apatelKmd Its just like @geemus said. The calls to libvirt-ruby should be encalsulated in a request together with parsing the response and generating the parameters.

Any other logic should fall in a model.

apatelKmd commented 4 years ago

Awesome, I think your inputs are helpful.

apatelKmd commented 4 years ago

FYI, @geemus and @plribeiro3000 I have opened a pull request to receive early feedback. https://github.com/fog/fog-libvirt/pull/73