def __init__(self, vim_client, ds_manager): super(EsxImageManager, self).__init__() self._logger = logging.getLogger(__name__) self._vim_client = vim_client self._ds_manager = ds_manager self._image_reaper = None self._uwsim_nas_exist = None agent_config = services.get(ServiceName.AGENT_CONFIG) self._in_uwsim = agent_config.in_uwsim
def f(self, request): locked_vms = services.get(ServiceName.LOCKED_VMS) try: locked_vms.add(request.vm_id) try: return func(self, request) finally: locked_vms.remove(request.vm_id) except DuplicatedValue: raise ConcurrentVmOperation("%s is locked" % request.vm_id)
def __init__(self): self._request_id = services.get(ServiceName.REQUEST_ID)
#gw.jvm.service.bookmark.RecordBookmarkService.setupBookmark("pyTest",77,None) import common.services as services import dateutil.parser as dateparser #mysql_service=services.get('local') #mysql_service.sql('create table testTabl25 (col1 int not null)') #mysql_service.duplicate_update_subquery('table', 'select * from table 2', ['a','b'], ['c', 'd'],['e','f']) bookmark_name = "testBookmark34543" bookmark_service = services.get("record_bookmark", { "bookmark_name": bookmark_name, "id_batch_size": 7, "rollover_id": 34 }) bookmark_service.create_bookmark(bookmark_name, 0, None) bookmark_service.insert_id(0) iterator = bookmark_service.id_iter(34) while iterator.hasNext(): iterator.next() print('Start:' + str(iterator.getRangeStart())) print('End:' + str(iterator.getRangeEnd())) print('-----') print('Inserting last range: ' + str(iterator.getRangeEnd())) bookmark_service.insert_id(iterator.getRangeEnd()) print('**-----**')
import common.services as services import common.bookmark.model.record_bookmark as bookmark_model from datetime import datetime mysql_service = services.get('local') bookmark_service = services.get('record_bookmark') bookmark = bookmark_model bookmark_name = 'bookmark_test4' bookmark.bookmark_name = bookmark_name bookmark_service.create_bookmark(bookmark_name, 34, datetime.now()) print(bookmark_service.get_last_record_time(bookmark_name)) print(bookmark_service.get_last_record_time(bookmark_name)) bookmark.record_id = 35 bookmark.record_time = datetime.now() bookmark.input_size = 7.0 bookmark.output_size = 9.0 bookmark.process_start_time = datetime.now() bookmark.process_end_time = datetime.now() bookmark_service.updateBookmark(bookmark) bookmark_service.updateBookmark(None, bookmark_name, 36, datetime.now())