fog / fog-xenserver

Module for the 'fog' gem to support XENSERVER
MIT License
16 stars 22 forks source link

VM.save - requires affinity #47

Closed fmbiete closed 9 years ago

fmbiete commented 9 years ago

Hi,

Why is affinity required?

require_before_save :name, :affinity

In a XenServer pool, from XenCenter, I can create VM without setting the affinity.

plribeiro3000 commented 9 years ago

Thats somewhat strange. The documentation for the Xenserver API just mention there are contructors (create) and desctructors (destroy) methods for each class but it does not mention what are the required attributes.

When playing with the api i've found this as a required attribute.

If you take a look at the old api at fog/fog you will see its required too (https://github.com/fog/fog/blob/master/lib/fog/xenserver/requests/compute/create_server.rb#L30-L31).

Hope this clarifies it to you.

fernandes commented 9 years ago

@fmbiete check if XenCenter does not automatically sets affinity to some machine on the pool, as @plribeiro3000 its a required one.

fmbiete commented 9 years ago

No, XenCenter leaves affinity undefined by default. At least in pool environments.

In a pool when you set the affinity for a vm, that vm will appear under the host even when halted. It's a bit tricky when the host is shutdown for maintenance.

Looking at XenCenter code doesn't seem mandatory: https://github.com/xenserver/xenadmin/blob/master/XenModel/Actions/VM/CreateVMAction.cs#L150

Tomorrow will make more testing and let you know