def create_copytool(self, copytool_data):
from django.db import transaction
log.debug("Creating copytool from: %s" % copytool_data)
with self._lock:
host = ObjectCache.get_by_id(ManagedHost, int(copytool_data['host']))
copytool_data['host'] = host
filesystem = ObjectCache.get_by_id(ManagedFilesystem, int(copytool_data['filesystem']))
copytool_data['filesystem'] = filesystem
with transaction.commit_on_success():
copytool = Copytool.objects.create(**copytool_data)
# Add the copytool after the transaction commits
ObjectCache.add(Copytool, copytool)
log.debug("Created copytool: %s" % copytool)
mount = self._create_client_mount(host, filesystem, copytool_data['mountpoint'])
# Make the association between the copytool and client mount
with self._lock:
copytool.client_mount = mount
with transaction.commit_on_success():
copytool.save()
ObjectCache.update(copytool)
self.progress.advance()
return copytool.id
job_scheduler.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录