def _start_snapshot_request(self):
"""
Issues the HTTP request to etcd to load the snapshot but only
loads it as far as the headers.
:return: tuple of response and snapshot's etcd index.
:raises HTTPException
:raises HTTPError
:raises socket.error
:raises DriverShutdown if the etcd cluster ID changes.
"""
_log.info("Loading snapshot headers...")
resp = self._etcd_request(self._resync_http_pool,
VERSION_DIR,
recursive=True,
timeout=120,
preload_content=False)
snapshot_index = int(resp.getheader("x-etcd-index", 1))
if not self._cluster_id:
_log.error("Snapshot response did not contain cluster ID, "
"resyncing to avoid inconsistency")
raise ResyncRequired()
_log.info("Got snapshot headers, snapshot index is %s; starting "
"watcher...", snapshot_index)
return resp, snapshot_index
评论列表
文章目录