nbd: set name for all I/O channels created
Ensure that all I/O channels created for NBD are given names to distinguish their respective roles. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
		
							parent
							
								
									20f4aa265e
								
							
						
					
					
						commit
						0d73f7253e
					
				@ -248,6 +248,7 @@ static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
 | 
				
			|||||||
    Error *local_err = NULL;
 | 
					    Error *local_err = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sioc = qio_channel_socket_new();
 | 
					    sioc = qio_channel_socket_new();
 | 
				
			||||||
 | 
					    qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qio_channel_socket_connect_sync(sioc,
 | 
					    qio_channel_socket_connect_sync(sioc,
 | 
				
			||||||
                                    saddr,
 | 
					                                    saddr,
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,7 @@ static gboolean nbd_accept(QIOChannel *ioc, GIOCondition condition,
 | 
				
			|||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server");
 | 
				
			||||||
    nbd_client_new(NULL, cioc,
 | 
					    nbd_client_new(NULL, cioc,
 | 
				
			||||||
                   nbd_server->tlscreds, NULL,
 | 
					                   nbd_server->tlscreds, NULL,
 | 
				
			||||||
                   nbd_client_put);
 | 
					                   nbd_client_put);
 | 
				
			||||||
@ -111,6 +112,8 @@ void qmp_nbd_server_start(SocketAddress *addr,
 | 
				
			|||||||
    nbd_server = g_new0(NBDServerData, 1);
 | 
					    nbd_server = g_new0(NBDServerData, 1);
 | 
				
			||||||
    nbd_server->watch = -1;
 | 
					    nbd_server->watch = -1;
 | 
				
			||||||
    nbd_server->listen_ioc = qio_channel_socket_new();
 | 
					    nbd_server->listen_ioc = qio_channel_socket_new();
 | 
				
			||||||
 | 
					    qio_channel_set_name(QIO_CHANNEL(nbd_server->listen_ioc),
 | 
				
			||||||
 | 
					                         "nbd-listener");
 | 
				
			||||||
    if (qio_channel_socket_listen_sync(
 | 
					    if (qio_channel_socket_listen_sync(
 | 
				
			||||||
            nbd_server->listen_ioc, addr, errp) < 0) {
 | 
					            nbd_server->listen_ioc, addr, errp) < 0) {
 | 
				
			||||||
        goto error;
 | 
					        goto error;
 | 
				
			||||||
 | 
				
			|||||||
@ -387,6 +387,7 @@ static QIOChannel *nbd_receive_starttls(QIOChannel *ioc,
 | 
				
			|||||||
    if (!tioc) {
 | 
					    if (!tioc) {
 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    qio_channel_set_name(QIO_CHANNEL(tioc), "nbd-client-tls");
 | 
				
			||||||
    data.loop = g_main_loop_new(g_main_context_default(), FALSE);
 | 
					    data.loop = g_main_loop_new(g_main_context_default(), FALSE);
 | 
				
			||||||
    TRACE("Starting TLS handshake");
 | 
					    TRACE("Starting TLS handshake");
 | 
				
			||||||
    qio_channel_tls_handshake(tioc,
 | 
					    qio_channel_tls_handshake(tioc,
 | 
				
			||||||
 | 
				
			|||||||
@ -349,6 +349,7 @@ static QIOChannel *nbd_negotiate_handle_starttls(NBDClient *client,
 | 
				
			|||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    qio_channel_set_name(QIO_CHANNEL(tioc), "nbd-server-tls");
 | 
				
			||||||
    TRACE("Starting TLS handshake");
 | 
					    TRACE("Starting TLS handshake");
 | 
				
			||||||
    data.loop = g_main_loop_new(g_main_context_default(), FALSE);
 | 
					    data.loop = g_main_loop_new(g_main_context_default(), FALSE);
 | 
				
			||||||
    qio_channel_tls_handshake(tioc,
 | 
					    qio_channel_tls_handshake(tioc,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user