Created
July 25, 2013 00:14
-
-
Save trentster/6075789 to your computer and use it in GitHub Desktop.
To copy a kvm vm via a UUID supplied by $1 to a specific destination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# SCRIPT: do-smartsend.sh | |
# AUTHOR: Mark Slatem | |
# DATE: 11 APRIL 2012 | |
# REV: 1.0.A | |
# | |
# PLATFORM: SmartOS | |
# REQUIREMENTS: SmartOS | |
# | |
# PURPOSE: To copy a kvm vm via a UUID supplied by $1 to a specific destination | |
# USAGE: do-smartsend.sh UUID TARGETIP | |
# REV LIST: | |
# DATE: DATE_of_REVISION | |
# BY: AUTHOR_of_MODIFICATION | |
# MODIFICATION: Describe what was modified, new features, etc-- | |
# TO DO: Email Notifications, data transfer and error checking | |
UUID="$1" | |
TARGETIP="$2" | |
#lets do the actual snapshots | |
zfs snapshot -r zones/$UUID@migration | |
zfs snapshot -r zones/$UUID-disk0@migration | |
#lets do the actual zfs send | |
zfs send zones/$UUID@migration | ssh root@$TARGETIP zfs recv zones/$UUID | |
zfs send zones/$UUID-disk0@migration | ssh root@$TARGETIP zfs recv zones/$UUID-disk0 | |
#lets copy over the xml manifest | |
scp /etc/zones/$UUID.xml root@$TARGETIP:/etc/zones/ | |
#lets put the UUID into the targets zone index file | |
echo "$UUID:installed:/zones/$UUID:$UUID" | ssh root@$TARGETIP 'cat >> /etc/zones/index' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment