def create_aff_grp(self, aff_grp=None, acc=None, domainid=None): aff_grp["name"] = "aff_grp_" + random_gen(size=6) try: aff_grp = AffinityGroup.create(self.apiclient, aff_grp, acc, domainid) return aff_grp except Exception as e: raise Exception("Error: Creation of Affinity Group failed : %s" %e)
def create_aff_grp(self, api_client=None, aff_grp=None, aff_grp_name=None, projectid=None): if not api_client: api_client = self.api_client if aff_grp is None: aff_grp = self.services["host_anti_affinity"] if aff_grp_name is None: aff_grp["name"] = "aff_grp_" + random_gen(size=6) else: aff_grp["name"] = aff_grp_name if projectid is None: projectid = self.project.id try: return AffinityGroup.create(api_client, aff_grp, None, None, projectid) except Exception as e: raise Exception("Error: Creation of Affinity Group failed : %s" % e)