@@ -48,6 +48,8 @@ static int pr_manager_helper_read(PRManagerHelper *pr_mgr,
if (r < 0) {
object_unref(OBJECT(pr_mgr->ioc));
+ qapi_event_send_pr_manager_status_changed(pr_mgr->qom_path, false,
+ &error_abort);
pr_mgr->ioc = NULL;
return -EINVAL;
}
@@ -74,6 +76,8 @@ static int pr_manager_helper_write(PRManagerHelper *pr_mgr,
assert(n_written != QIO_CHANNEL_ERR_BLOCK);
object_unref(OBJECT(pr_mgr->ioc));
pr_mgr->ioc = NULL;
+ qapi_event_send_pr_manager_status_changed(pr_mgr->qom_path, false,
+ &error_abort);
return n_written < 0 ? -EINVAL : 0;
}
@@ -150,7 +154,6 @@ static int pr_manager_helper_run(PRManager *p,
int ret;
int expected_dir;
int attempts;
- bool was_connected = pr_mgr->ioc != NULL;
uint8_t cdb[PR_HELPER_CDB_SIZE] = { 0 };
if (!io_hdr->cmd_len || io_hdr->cmd_len > PR_HELPER_CDB_SIZE) {
@@ -232,11 +235,6 @@ static int pr_manager_helper_run(PRManager *p,
return ret;
out:
- if (was_connected) {
- qapi_event_send_pr_manager_status_changed(pr_mgr->qom_path, false,
- &error_abort);
- }
-
sense_len = scsi_build_sense(io_hdr->sbp, SENSE_CODE(LUN_COMM_FAILURE));
io_hdr->driver_status = SG_ERR_DRIVER_SENSE;
io_hdr->sb_len_wr = MIN(io_hdr->mx_sb_len, sense_len);
@@ -261,7 +259,7 @@ static void pr_manager_helper_complete(UserCreatable *uc, Error **errp)
{
PRManagerHelper *pr_mgr = PR_MANAGER_HELPER(uc);
- pr_mgr->qom_path = object_get_canonical_path(OBJECT(pr_mgr));
+ pr_mgr->qom_path = object_get_canonical_path_component(OBJECT(pr_mgr));
qemu_mutex_lock(&pr_mgr->lock);
pr_manager_helper_initialize(pr_mgr, errp);