Exemple #1
0
 def get_status(self):
     status = False
     try:
         self.get_image_list()
         status = True
         LOG.info("Glance connection is established")
     except Exception as e:
         LOG.error("Couldn't connect to Glance client " + e)
     return status
Exemple #2
0
 def get_status(self):
     status = False
     try:
         self.get_flavors_list()
         status = True
         LOG.info("Nova connection is established")
     except Exception as e:
         LOG.error("Couldn't connect to Nova client " + e)
     return status
 def upload_image(self, name, image_location):
     try:
         name = str(name).split('.')[0]
     except:
         pass
     LOG.info("Uploading "+name+" image to glance ...")
     image = self.get_client().images.create(name=name, disk_format='vmdk', container_format='bare')
     self.get_client().images.upload(image.id, open(image_location))
     return image.id
 def get_status(self):
     status = False
     try:
         self.get_image_list()
         status = True
         LOG.info("Glance connection is established")
     except Exception as e:
         LOG.error("Couldn't connect to Glance client " + e)
     return status
Exemple #5
0
 def upload_image(self, name, image_location):
     try:
         name = str(name).split('.')[0]
     except:
         pass
     LOG.info("Uploading " + name + " image to glance ...")
     image = self.get_client().images.create(name=name,
                                             disk_format='vmdk',
                                             container_format='bare')
     self.get_client().images.upload(image.id, open(image_location))
     return image.id
Exemple #6
0
 def get_best_flavor(self, values):
     LOG.info("Getting the best flavor for virtual machine")
     best_list = self.get_flavor_map()
     for i in range(len(values)):
         initial_list = best_list
         best_list = {}
         for flavor in initial_list:
             if initial_list[flavor][i] >= values[i]:
                 best_list[flavor] = initial_list[flavor]
     if not best_list:
         LOG.error("No flavors matched")
     return get_smallest_flavor(best_list)
Exemple #7
0
 def get_image_list(self):
     LOG.info("Fetching image list ...")
     return self.get_client().images.list()
Exemple #8
0
 def create_stack(self, name,  body):
     LOG.info("Uploading template file to heat endpoint")
     self.get_client().stacks.create(stack_name=name,
                                     template=body)
     LOG.info("Template is uploaded successfully")
 def get_image_list(self):
     LOG.info("Fetching image list ...")
     return self.get_client().images.list()