Revision 78e300e5 src/tm_mad/iscsi/mv

View differences:

src/tm_mad/iscsi/mv
114 114

  
115 115
    TARGET_HOST=$(iqn_get_host "$IQN")
116 116

  
117
LOGIN_CMD=$(cat <<EOF
118
        set -e
119
        mkdir -p $DST_DIR
120
        $SUDO $(iscsiadm_discovery "$TARGET_HOST")
121
        $SUDO $(iscsiadm_login "$IQN" "$TARGET_HOST")
122
EOF
123
)
117
    LINK_CMD=$(cat <<EOF
118
    set -e
124 119

  
125
ssh_exec_and_log "$DST_HOST" "$LOGIN_CMD" \
126
    "Error logging in $IQN"
120
    # discover and login
121
    mkdir -p $DST_DIR
122
    $SUDO $(iscsiadm_discovery "$TARGET_HOST")
123
    $SUDO $(iscsiadm_login "$IQN" "$TARGET_HOST")
127 124

  
128
TEST_CMD=$(cat <<EOF
129
    set -e
125
    # poll
130 126
    while [ ! -L /dev/disk/by-path/*$IQN-lun-1 ]; do
131 127
        sleep 1
132 128
    done
133
EOF
134
)
135 129

  
136
ssh_exec_and_log "$DST_HOST" "$TEST_CMD" \
137
        "Error waiting for $IQN iSCSI LUN to appear in $DST_HOST"
138

  
139
LINK_CMD=$(cat <<EOF
140
        set -e
141
        DISK_BY_PATH=\$(ls /dev/disk/by-path/*$IQN-lun-1)
142
        ln -sf "\$DISK_BY_PATH" "$DST_PATH"
130
    # link
131
    DISK_BY_PATH=\$(ls /dev/disk/by-path/*$IQN-lun-1)
132
    ln -sf "\$DISK_BY_PATH" "$DST_PATH"
143 133
EOF
144 134
)
145 135

  
146
ssh_exec_and_log "$DST_HOST" "$LINK_CMD" \
147
    "Error linking to $DISK_BY_PATH $DST_PATH"
136
    ssh_exec_and_log "$DST_HOST" "$LINK_CMD" \
137
        "Error linking to $DISK_BY_PATH $DST_PATH"
148 138

  
149 139

  
150 140
fi

Also available in: Unified diff