set metadata_ip correctly after agent restart

Change-Id: I7ba58397f4cc03cbfd426177c3d78812ed97c033