Revision 6ffadd9d src/tm_mad/iscsi/clone

View differences:

src/tm_mad/iscsi/clone
92 92
ssh_exec_and_log "$TARGET_HOST" "$CLONE_CMD" \
93 93
        "Error cloning $DST_HOST:$TARGET_DEV"
94 94

  
95
DISCOVERY_CMD=$(cat <<EOF
95
LINK_CMD=$(cat <<EOF
96 96
    set -e
97

  
98
    # discover and login
97 99
    mkdir -p $DST_DIR
98 100
    $SUDO $(iscsiadm_discovery "$TARGET_HOST")
99 101
    $SUDO $(iscsiadm_login "$NEW_IQN" "$TARGET_HOST")
100
EOF
101
)
102

  
103
ssh_exec_and_log "$DST_HOST" "$DISCOVERY_CMD" \
104
        "Error discovering $NEW_IQN in $DST_HOST"
105 102

  
106
TEST_CMD=$(cat <<EOF
107
    set -e
103
    # poll
108 104
    while [ ! -L /dev/disk/by-path/*$NEW_IQN-lun-1 ]; do
109
	sleep 1
105
	   sleep 1
110 106
    done
111
EOF
112
)
113

  
114
ssh_exec_and_log "$DST_HOST" "$TEST_CMD" \
115
        "Error waiting for $NEW_IQN iSCSI LUN to appear in $DST_HOST"
116 107

  
117

  
118
LINK_CMD=$(cat <<EOF
119
    set -e
108
    # link
120 109
    DISK_BY_PATH=\$(ls /dev/disk/by-path/*$NEW_IQN-lun-1)
121 110
    ln -s "\$DISK_BY_PATH" "$DST_PATH"
122 111
    DISK_DEVNAME=\$(readlink -f \$DISK_BY_PATH  | awk -F'/' '{ print \$NF }')

Also available in: Unified diff