xen: scsiback: add LUN of restored domain

When a xen domain is being restored the LUN state of a pvscsi device
is "Connected" and not "Initialising" as in case of attaching a new
pvscsi LUN.

This must be taken into account when adding a new pvscsi device for
a domain as otherwise the pvscsi LUN won't be connected to the
SCSI target associated with it.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:
Juergen Gross 2015-02-17 08:02:48 +01:00 коммит произвёл David Vrabel
Родитель 785748788b
Коммит 169e6cf066
1 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -990,7 +990,7 @@ found:
} }
static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state, static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
char *phy, struct ids_tuple *vir) char *phy, struct ids_tuple *vir, int try)
{ {
if (!scsiback_add_translation_entry(info, phy, vir)) { if (!scsiback_add_translation_entry(info, phy, vir)) {
if (xenbus_printf(XBT_NIL, info->dev->nodename, state, if (xenbus_printf(XBT_NIL, info->dev->nodename, state,
@ -998,7 +998,7 @@ static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
pr_err("xenbus_printf error %s\n", state); pr_err("xenbus_printf error %s\n", state);
scsiback_del_translation_entry(info, vir); scsiback_del_translation_entry(info, vir);
} }
} else { } else if (!try) {
xenbus_printf(XBT_NIL, info->dev->nodename, state, xenbus_printf(XBT_NIL, info->dev->nodename, state,
"%d", XenbusStateClosed); "%d", XenbusStateClosed);
} }
@ -1058,10 +1058,19 @@ static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
switch (op) { switch (op) {
case VSCSIBACK_OP_ADD_OR_DEL_LUN: case VSCSIBACK_OP_ADD_OR_DEL_LUN:
if (device_state == XenbusStateInitialising) switch (device_state) {
scsiback_do_add_lun(info, state, phy, &vir); case XenbusStateInitialising:
if (device_state == XenbusStateClosing) scsiback_do_add_lun(info, state, phy, &vir, 0);
break;
case XenbusStateConnected:
scsiback_do_add_lun(info, state, phy, &vir, 1);
break;
case XenbusStateClosing:
scsiback_do_del_lun(info, state, &vir); scsiback_do_del_lun(info, state, &vir);
break;
default:
break;
}
break; break;
case VSCSIBACK_OP_UPDATEDEV_STATE: case VSCSIBACK_OP_UPDATEDEV_STATE: