Skip to content

Commit

Permalink
fix: More tweaks to OpenNebula driver
Browse files Browse the repository at this point in the history
  • Loading branch information
sfayer committed Oct 19, 2023
1 parent a5efaef commit 3ebe40e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/DIRAC/Resources/Computing/CloudProviders/OpenNebula.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,17 @@ def __new__(cls, *args, **kwargs):
return super(NodeDriver, cls).__new__(cls)

def create_node(self, name, size, image=None, network=None, context=None,
ex_onhold=False, ex_tmpl_network=True):
ex_onhold=False, ex_tmpl_network=True, **kwargs):
tmpl_id = None
if isinstance(size, int):
tmpl_id = size
elif isinstance(size, NodeSize):
tmpl_id = int(size.id)

# Allow use of ex_userdata in place of context
if context is None and "ex_userdata" in kwargs:
context = kwargs["ex_userdata"]

if tmpl_id is not None:
return self._create_vm_template(name, tmpl_id, context, ex_onhold,
ex_tmpl_network)
Expand All @@ -125,12 +129,12 @@ def _create_vm_template(self, name, tmpl_id, context, ex_onhold,
name,
ex_onhold,
extra_str)
return self.ex_get_node(res.object)
return self.ex_get_node_details(res.object)

def _create_vm_direct(self, name, size, image, network, context, ex_onhold):
tmpl_str = self._gen_template(name, size, image, network, context)
res = self.connection.request("one.vm.allocate", tmpl_str, ex_onhold)
return self.ex_get_node(res.object)
return self.ex_get_node_details(res.object)

def destroy_node(self, node, ex_hard=False):
action = 'terminate'
Expand Down Expand Up @@ -165,7 +169,7 @@ def list_networks(self):
*self.REQ_FILTER_ALL)
return self._to_networks(res.object)

def ex_get_node(self, node_id):
def ex_get_node_details(self, node_id):
res = self.connection.request("one.vm.info", node_id)
return self._to_node(res.object)

Expand Down

0 comments on commit 3ebe40e

Please sign in to comment.