- invoke-rc.d xvm-iscsi-config restart
- invoke-rc.d open-iscsi restart
- iscsiadm -m discovery -t st -p $(invirt-getconf iscsi.address):3260
+
+ # Attempt to determine whether the iSCSI configuration has changed at all
+ safe=""
+
+ if [ -z "$2" ]; then
+ invoke-rc.d xvm-iscsi-config restart
+ invoke-rc.d open-iscsi restart
+ elif [[ "$USERNAME" -ne "$OLD_USERNAME" || "$PASSWORD" -ne "$OLD_PASSWORD" ]]; then
+ cat <<EOF
+xvm-iscsi-config: The login credentials have changed. Restart iscsi:
+ /etc/init.d/xvm-iscsi-config restart
+ /etc/init.d/open-iscsi restart
+EOF
+ safe=no
+ fi
+ if ! diff <(get_current_sessions) <(get_new_sessions) >/dev/null; then
+ if [ -z "$safe" ]; then
+ /usr/lib/xvm-iscsi-connect
+ else
+ echo " /usr/lib/xvm-iscsi-connect"
+ fi
+ cat <<EOF
+You may want to recreate the LVM nodes:
+ lvchange -a ln /dev/xenvg && lvchange -a y /dev/xenvg
+This will leave VMs unable to access their disks, so migrate them first.
+
+EOF
+ fi