On Tue, 01/17 10:54, Stefan Hajnoczi wrote: > On Tue, Jan 17, 2017 at 12:07:30AM +0800, Fam Zheng wrote: > > static void virtio_scsi_device_realize(DeviceState *dev, Error **errp) > > { > > VirtIODevice *vdev = VIRTIO_DEVICE(dev); > > VirtIOSCSI *s = VIRTIO_SCSI(dev); > > + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); > > Error *err = NULL; > > > > + if (vs->conf.fc_host) { > > + if (!strcmp(vs->conf.fc_host, "off")) { > > + vs->conf.primary_wwpn = 0; > > + vs->conf.primary_wwnn = 0; > > + vs->conf.secondary_wwpn = 0; > > + vs->conf.secondary_wwnn = 0; > > + } else if (!strcmp(vs->conf.fc_host, "primary") || > > + !strcmp(vs->conf.fc_host, "secondary")) { > > + virtio_add_feature(&vdev->host_features, > > VIRTIO_SCSI_F_FC_HOST); > > + vs->conf.primary_active = !strcmp(vs->conf.fc_host, "primary"); > > + if (!vs->conf.primary_wwpn) { > > + error_setg(errp, "fc_host enabled but primary_wwpn not > > set"); > > + return; > > + } > > + if (!vs->conf.primary_wwnn) { > > + error_setg(errp, "fc_host enabled but primary_wwnn not > > set"); > > + return; > > + } > > + if (!vs->conf.secondary_wwpn) { > > + error_setg(errp, "fc_host enabled but secondary_wwpn not > > set"); > > + return; > > + } > > + if (!vs->conf.secondary_wwnn) { > > + error_setg(errp, "fc_host enabled but secondary_wwnn not > > set"); > > + return; > > + } > > + s->vm_state_change = > > + > > qemu_add_vm_change_state_handler(virtio_scsi_vm_state_change, s); > > Missing qemu_del_vm_change_state_handler() in .unrealize() and in error > code paths in this function.
Will fix it. Thanks! Fam