python - Get a hypervisor name from its obj_id while in a table_action -
i trying make changes openstack horizon ui running issues hoping can with. doing work on admin->hypervisor page , trying add button lets me perform actions on selected hypervisors (using table_actions this). have created own table_action being defined in meta of adminhypervisors class.
i have part of code selecting hypervisors working page , can form load... here issue... action(self,request, obj_id) function action implements gets passed obj_id of hypervisor , work need hypervisor host name. need way translate id host name...
here table_action class
class deployselection(tables.batchaction): name = "deploy" action_present = _("deploy") action_past = _("deploy selected selection ") data_type_singular = _("selection") data_type_plural = _("selections") classes = ("btn-deploy") def action(self, request, obj_id): log.warn(_("obj_id == %s") % obj_id) #convert obj_id here , hypervsior name #do work based using hypervisor name here in example, obj_id '2'
tl&dr: need find how function or way take hypervisors id , "hypervisor_hostname" associated hypervisor.
Comments
Post a Comment