示例#1
0
 def create(self, drive_group: DriveGroupSpec) -> str:
     logger.debug(f"Processing DriveGroup {drive_group}")
     ret = []
     drive_group.osd_id_claims = self.find_destroyed_osds()
     logger.info(
         f"Found osd claims for drivegroup {drive_group.service_id} -> {drive_group.osd_id_claims}"
     )
     for host, drive_selection in self.prepare_drivegroup(drive_group):
         logger.info('Applying %s on host %s...' %
                     (drive_group.service_id, host))
         cmd = self.driveselection_to_ceph_volume(
             drive_group, drive_selection,
             drive_group.osd_id_claims.get(host, []))
         if not cmd:
             logger.debug("No data_devices, skipping DriveGroup: {}".format(
                 drive_group.service_id))
             continue
         # env_vars = [f"CEPH_VOLUME_OSDSPEC_AFFINITY={drive_group.service_id}"]
         # disable this until https://github.com/ceph/ceph/pull/34835 is merged
         env_vars: List[str] = []
         ret_msg = self.create_single_host(
             host,
             cmd,
             replace_osd_ids=drive_group.osd_id_claims.get(host, []),
             env_vars=env_vars)
         ret.append(ret_msg)
     return ", ".join(ret)
示例#2
0
文件: osd.py 项目: yzhan298/ceph
 def create_from_spec(self, drive_group: DriveGroupSpec) -> str:
     logger.debug(f"Processing DriveGroup {drive_group}")
     ret = []
     drive_group.osd_id_claims = self.find_destroyed_osds()
     logger.info(f"Found osd claims for drivegroup {drive_group.service_id} -> {drive_group.osd_id_claims}")
     for host, drive_selection in self.prepare_drivegroup(drive_group):
         logger.info('Applying %s on host %s...' % (drive_group.service_id, host))
         cmd = self.driveselection_to_ceph_volume(drive_group, drive_selection,
                                                  drive_group.osd_id_claims.get(host, []))
         if not cmd:
             logger.debug("No data_devices, skipping DriveGroup: {}".format(drive_group.service_id))
             continue
         ret_msg = self.create(host, cmd,
                                           replace_osd_ids=drive_group.osd_id_claims.get(host, []))
         ret.append(ret_msg)
     return ", ".join(ret)