Scheduler making wrong decisions for automatic_requirements

I have come to the specific point where automatic scheduler requirements are preventing my VM to be deployed. From other posts my understanding is that ONE is making these requirements based on type of images, hosts and similar stuff. We cannot influence on that decision.

Yet I have the following problem. Imported template from vcenter which deploys perfectly when doing manual instance. But when the same template is called through API, for some reason ONE is thinking this VM should NOT be deployed on a vmware system.
These are my auto-req when doing manual instance, which works fine:
AUTOMATIC_REQUIREMENTS="(CLUSTER_ID = 100) & !(PUBLIC_CLOUD = YES) | (PUBLIC_CLOUD = YES & (HYPERVISOR = vcenter))"

These are the same reqs when doing the API call:
AUTOMATIC_REQUIREMENTS="(CLUSTER_ID = 100) & !(PUBLIC_CLOUD = YES)"

As you can see, the working instance has “OR” clause which tells us we can run sort of a public cloud if hypervisor is “vcenter”. And it works fine. The failing instance does not have that second part and it demands I should NOT have vcenter i.e. I have to use KVM for instance.

Can someone tell me why this difference is appearing? The template is the same, I am not changing anything inside. But when comparing VM instances after creation, I can see that the failing VM does not have “USER TEMPLATE” section at all. Working VM has it like this:
USER TEMPLATE
DESCRIPTION="vCenter Template imported by OpenNebula from Cluster Cloud-Cluster"
HYPERVISOR="vcenter"
KEEP_DISKS_ON_DONE="NO"
LOGO="images/logos/ubuntu.png"
PUBLIC_CLOUD=[
TYPE=“vcenter”,
VM_TEMPLATE=“42352e2f-0396-7395-bcfe-bf290060452b” ]
VCENTER_DATASTORE=“PrivateCloud01”

I guess this is telling OpenNebula to use vcenter host. But why this other VM instance is not seeing this information?

Hi Bojan,
the following section:

USER TEMPLATE
DESCRIPTION="vCenter Template imported by OpenNebula from Cluster Cloud-Cluster"
HYPERVISOR="vcenter"
KEEP_DISKS_ON_DONE="NO"
LOGO="images/logos/ubuntu.png"
PUBLIC_CLOUD=[
TYPE=“vcenter”,
VM_TEMPLATE=“42352e2f-0396-7395-bcfe-bf290060452b” ]
VCENTER_DATASTORE=“PrivateCloud01”

That info is indeed added by OpenNebula when you import a VM template from vCenter, adding the VMWare ID for the template (that hash starting with 42352e2f…), the datastore which new VM instances wil use etc…

I haven’t used the API so I may be wrong. If you use !(PUBLIC_CLOUD=YES) it would be evaluated as PUBLIC_CLOUD=NO Then I guess that the failing VM can’t use the PUBLIC_CLOUD section of the template and can’t be deployed as it can’t find which vCenter’s datastore must be used, which VMWare VM template is needed…

Not sure if it that’s the right answer for the problem.

Cheers!

Thanks but the point is in the automatic part of the scheduler. I am not doing anything but instantiating template with some ID.
If you recheck my post you will the additional part of the auto-sched which allows the instance on vmware. The part of the OR clause on the right side. This is missing when using api.

Bojan

---- Miguel Ángel Alvarez Cabrerizo wrote ----

[https://sjc6.discourse-cdn.com/standard11/user_avatar/forum.opennebula.org/mcabrerizo/45/4829_1.png] mcabrerizohttps://forum.opennebula.io/users/mcabrerizo Miguel Ángel Alvarez Cabrerizohttps://forum.opennebula.io/users/mcabrerizo
October 14

Hi Bojan,
the following section:

USER TEMPLATE
DESCRIPTION="vCenter Template imported by OpenNebula from Cluster Cloud-Cluster"
HYPERVISOR="vcenter"
KEEP_DISKS_ON_DONE="NO"
LOGO="images/logos/ubuntu.png"
PUBLIC_CLOUD=[
TYPE=“vcenter”,
VM_TEMPLATE=“42352e2f-0396-7395-bcfe-bf290060452b” ]
VCENTER_DATASTORE=“PrivateCloud01”

That info is indeed added by OpenNebula when you import a VM template from vCenter, adding the VMWare ID for the template (that hash starting with 42352e2f…), the datastore which new VM instances wil use etc…

I haven’t used the API so I may be wrong. If you use !(PUBLIC_CLOUD=YES) it would be evaluated as PUBLIC_CLOUD=NO Then I guess that the failing VM can’t use the PUBLIC_CLOUD section of the template and can’t be deployed as it can’t find which vCenter’s datastore must be used, which VMWare VM template is needed…

Not sure if it that’s the right answer for the problem.

Cheers!