SoftLayer API: 将服务器迁移到新的 Xen
SoftLayer API: migrate server to new Xen
我们已收到有关计划迁移到新管理程序的通知,提到我们可以在 SL Portal 中或通过 API 进行此类迁移。
问:如何通过API调用迁移服务器:
休息
slcli调用-api方法
我们收到的通知:
IBM Bluemix is extending "hot patching" capabilities for VSIs (Virtual Server Instances) in all locations. Hot patching allows the IBM Bluemix Virtual Server team to apply many software and security patches to virtual machine hosts without disrupting client workloads with a host reboot.
To provide flexibility, clients will be able to self migrate prior to the migration window either through the API or UI as noted below:
To self migrate your virtual server, go to the "Device List", which can be found under "Devices" across the top of Control Portal, and select "Actions". A "Migrate Host" should be selectable (capacity dependent).
使用 rest 你可以使用这个请求:
https://$USERNAME:$APIKEY@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$VSIID/migrate
Note: replace $USERNAM , $APIKEY and $VSIID
此致
这是我们用来逐个迁移 VM 的脚本。
您可以使用此命令列出可迁移的 VM slcli virtual list --columns id,hostname,pendingMigrationFlag | grep True
,实际迁移可以使用此命令完成 slcli call-api Virtual_Guest migrate "--id=$VSID"
#!/bin/bash
TYPE=${1:-server}
while :; do
VSID=`slcli virtual list --columns id,hostname,pendingMigrationFlag | grep "$TYPE" | grep True | head -1 | cut -d ' ' -f1`;
if [[ -n "$VSID" ]]; then
echo "Next item to migrate: $VSID"
slcli vs detail "$VSID"
slcli call-api Virtual_Guest migrate "--id=$VSID"
if [[ "$?" -eq "0" ]]; then
echo "Waiting for the migration to complete..."
while :; do
sleep 5
STATE=`slcli vs detail "$VSID" | grep active_transaction | awk '{print }'`
if [ "$STATE" = "NULL" ]; then
echo "Migration finished"
break
else
echo "Current state: $STATE"
fi
done
fi
else
echo "No vs found to migrate"
break
fi
done
我们已收到有关计划迁移到新管理程序的通知,提到我们可以在 SL Portal 中或通过 API 进行此类迁移。
问:如何通过API调用迁移服务器:
休息
slcli调用-api方法
我们收到的通知:
IBM Bluemix is extending "hot patching" capabilities for VSIs (Virtual Server Instances) in all locations. Hot patching allows the IBM Bluemix Virtual Server team to apply many software and security patches to virtual machine hosts without disrupting client workloads with a host reboot.
To provide flexibility, clients will be able to self migrate prior to the migration window either through the API or UI as noted below:
To self migrate your virtual server, go to the "Device List", which can be found under "Devices" across the top of Control Portal, and select "Actions". A "Migrate Host" should be selectable (capacity dependent).
使用 rest 你可以使用这个请求:
https://$USERNAME:$APIKEY@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$VSIID/migrate
Note: replace $USERNAM , $APIKEY and $VSIID
此致
这是我们用来逐个迁移 VM 的脚本。
您可以使用此命令列出可迁移的 VM slcli virtual list --columns id,hostname,pendingMigrationFlag | grep True
,实际迁移可以使用此命令完成 slcli call-api Virtual_Guest migrate "--id=$VSID"
#!/bin/bash
TYPE=${1:-server}
while :; do
VSID=`slcli virtual list --columns id,hostname,pendingMigrationFlag | grep "$TYPE" | grep True | head -1 | cut -d ' ' -f1`;
if [[ -n "$VSID" ]]; then
echo "Next item to migrate: $VSID"
slcli vs detail "$VSID"
slcli call-api Virtual_Guest migrate "--id=$VSID"
if [[ "$?" -eq "0" ]]; then
echo "Waiting for the migration to complete..."
while :; do
sleep 5
STATE=`slcli vs detail "$VSID" | grep active_transaction | awk '{print }'`
if [ "$STATE" = "NULL" ]; then
echo "Migration finished"
break
else
echo "Current state: $STATE"
fi
done
fi
else
echo "No vs found to migrate"
break
fi
done