Exemple #1
0
  def check(self):
    storage_filename = self._get_storage_filename()
    volume_manager = JsonVolumeManager(storage_filename)

    all_mountable_volumes = []
    roles = volume_manager.get_roles()
    for r in roles:
        all_mountable_volumes.extend(sum(self._get_mountable_volumes(r),[]))

    if not all_mountable_volumes:
        print "No EBS volumes found. Have you executed 'create-storage' first?"
        return

    error = False

    # disable boto ERROR logging for now
    boto_logging = logging.getLogger('boto')
    level = boto_logging.level
    boto_logging.setLevel(logging.FATAL)

    for vid in [v.volume_id for v in all_mountable_volumes]:
        try:
            self.cluster.ec2Connection.get_all_volumes([vid])
        except:
            error = True
            print "Volume does not exist: %s" % vid

    if not error:
        print "Congrats! All volumes exist!"

    # reset boto logging
    boto_logging.setLevel(level)
Exemple #2
0
  def check(self):
    storage_filename = self._get_storage_filename()
    volume_manager = JsonVolumeManager(storage_filename)

    all_mountable_volumes = []
    roles = volume_manager.get_roles()
    for r in roles:
        all_mountable_volumes.extend(sum(self._get_mountable_volumes(r),[]))

    if not all_mountable_volumes:
        print "No EBS volumes found. Have you executed 'create-storage' first?"
        return

    error = False

    # disable boto ERROR logging for now
    boto_logging = logging.getLogger('boto')
    level = boto_logging.level
    boto_logging.setLevel(logging.FATAL)

    for vid in [v.volume_id for v in all_mountable_volumes]:
        try:
            self.cluster.ec2Connection.get_all_volumes([vid])
        except:
            error = True
            print "Volume does not exist: %s" % vid

    if not error:
        print "Congrats! All volumes exist!"

    # reset boto logging
    boto_logging.setLevel(level)
Exemple #3
0
 def get_volumes(self, roles=None, volumes=None):
   result = []
   if volumes is not None:
     for r, v in volumes:
       result.append((r,v))
   else:
     if roles is None:
       storage_filename = self._get_storage_filename()
       volume_manager = JsonVolumeManager(storage_filename)
       roles = volume_manager.get_roles()
     for role in roles:
       mountable_volumes_list = self._get_mountable_volumes(role)
       ec2_volumes = self._get_ec2_volumes_dict(mountable_volumes_list)
       for mountable_volumes in mountable_volumes_list:
         for mountable_volume in mountable_volumes:
           result.append((role, ec2_volumes[mountable_volume.volume_id]))
   return result
Exemple #4
0
 def get_volumes(self, roles=None, volumes=None):
   result = []
   if volumes is not None:
     for r, v in volumes:
       result.append((r,v))
   else:
     if roles is None:
       storage_filename = self._get_storage_filename()
       volume_manager = JsonVolumeManager(storage_filename)
       roles = volume_manager.get_roles()
     for role in roles:
       mountable_volumes_list = self._get_mountable_volumes(role)
       ec2_volumes = self._get_ec2_volumes_dict(mountable_volumes_list)
       for mountable_volumes in mountable_volumes_list:
         for mountable_volume in mountable_volumes:
           result.append((role, ec2_volumes[mountable_volume.volume_id]))
   return result
Exemple #5
0
 def get_roles(self):
   storage_filename = self._get_storage_filename()
   volume_manager = JsonVolumeManager(storage_filename)
   return volume_manager.get_roles()
Exemple #6
0
 def get_roles(self):
   storage_filename = self._get_storage_filename()
   volume_manager = JsonVolumeManager(storage_filename)
   return volume_manager.get_roles()