set -e
-#/root/dnd.sh &
-/migrator/dnd.sh &
+/root/dnd.sh &
sleep 2
-arv-get $1 | docker load
+image_tar_keepref=$1
+image_id=$2
+image_repo=$3
+image_tag=$4
+project_uuid=$5
-docker tag $2 $3:$4
+arv-get $image_tar_keepref | docker load
+
+docker tag $image_id $image_repo:$image_tag
docker images -a
cd /root/pkgs
dpkg -i libltdl7_2.4.2-1.11+b1_amd64.deb docker-engine_1.13.1-0~debian-jessie_amd64.deb
-/migrator/dnd.sh &
+/root/dnd.sh &
sleep 2
docker images -a
-UUID=$(arv-keepdocker --project-uuid=$5 $3 $4)
+UUID=$(arv-keepdocker --project-uuid=$project_uuid $image_repo $image_tag)
kill $(cat /var/run/docker.pid)
sleep 1
key = (img["repo"], img["tag"], img["timestamp"])
old_images.append(img)
- print old_images
-
migration_links = arvados.util.list_all(api_client.links().list, filters=[
['link_class', '=', arvados.commands.keepdocker._migration_link_class],
['name', '=', arvados.commands.keepdocker._migration_link_name],
for m in migration_links:
already_migrated.add(m["tail_uuid"])
-# ['tail_uuid', '=', old_pdh],
-# ['head_uuid', '=', new_pdh]]).execute()['items']
-
- pprint(old_images)
- pprint(already_migrated)
-
for old_image in old_images:
if old_image["collection"] in already_migrated:
continue
tarfile[0:40],
old_image["repo"],
old_image["tag"],
- old_image["owner_uuid"]]
+ col.api_response()["owner_uuid"]]
out = subprocess.check_output(dockercmd)
new_collection = re.search(r"Migrated uuid is ([a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15})", out)
- print "New collection is '%s'" % new_collection.group(1)
+ api_client.links().create(body={"link": {
+ 'owner_uuid': col.api_response()["owner_uuid"],
+ 'link_class': arvados.commands.keepdocker._migration_link_class,
+ 'name': arvados.commands.keepdocker._migration_link_name,
+ 'tail_uuid': old_image["collection"],
+ 'head_uuid': new_collection.group(1)
+ }}).execute(num_retries=3)
+
+ print "Migrated '%s' to '%s'" % (old_image["collection"], new_collection.group(1))
finally:
shutil.rmtree(varlibdocker)