示例#1
0
 def _to_job(self, item, target):
     id = item.id
     job = BackupTargetJob(
         id=id,
         status=BackupTargetJobStatusType.PENDING,
         progress=0,
         target=target,
         driver=self.connection.driver,
         extra={},
     )
     return job
示例#2
0
 def _to_backup_job(self, element, target, client_id):
     running_job = element.find(fixxpath('runningJob', BACKUP_NS))
     if running_job is not None:
         return BackupTargetJob(id=running_job.get('id'),
                                status=running_job.get('status'),
                                progress=int(
                                    running_job.get('percentageComplete')),
                                driver=self.connection.driver,
                                target=target,
                                extra={'clientId': client_id})
     return None
示例#3
0
 def _to_backup_job(self, element, target, client_id):
     running_job = element.find(fixxpath("runningJob", BACKUP_NS))
     if running_job is not None:
         return BackupTargetJob(
             id=running_job.get("id"),
             status=running_job.get("status"),
             progress=int(running_job.get("percentageComplete")),
             driver=self.connection.driver,
             target=target,
             extra={"clientId": client_id},
         )
     return None
示例#4
0
 def _to_job(self, el):
     id = findtext(element=el, xpath='snapshotId', namespace=NS)
     progress = findtext(element=el, xpath='progress', namespace=NS)\
         .replace('%', '')
     volume_id = findtext(element=el, xpath='volumeId', namespace=NS)
     target = self.ex_get_target_by_volume_id(volume_id)
     job = BackupTargetJob(
         id=id,
         status=BackupTargetJobStatusType.PENDING,
         progress=int(progress),
         target=target,
         driver=self.connection.driver,
         extra={},
     )
     return job