return;
errmsg = __virErrorMsg(error, info);
- __virRaiseError(conn, NULL, VIR_FROM_XEND, error, VIR_ERR_ERROR,
+ __virRaiseError(conn, NULL, VIR_FROM_PROXY, error, VIR_ERR_ERROR,
errmsg, info, NULL, 0, 0, errmsg, info);
}
* @fd: the socket
* @buffer: the target memory area
* @len: the lenght in bytes
+ * @quiet: quiet access
*
* Process a read from a client socket
*
* Returns the number of byte read or -1 in case of error.
*/
static int
-virProxyReadClientSocket(int fd, char *buffer, int len) {
+virProxyReadClientSocket(int fd, char *buffer, int len, int quiet) {
int ret;
if ((fd < 0) || (buffer == NULL) || (len < 0))
fprintf(stderr, "read socket %d interrupted\n", fd);
goto retry;
}
- fprintf(stderr, "Failed to read socket %d\n", fd);
+ if (!quiet)
+ fprintf(stderr, "Failed to read socket %d\n", fd);
return(-1);
}
static int
xenProxyCommand(virConnectPtr conn, virProxyPacketPtr request,
- virProxyFullPacketPtr answer) {
+ virProxyFullPacketPtr answer, int quiet) {
static int serial = 0;
int ret;
virProxyPacketPtr res = NULL;
if (answer == NULL) {
/* read in situ */
ret = virProxyReadClientSocket(conn->proxy, (char *) request,
- sizeof(virProxyPacket));
+ sizeof(virProxyPacket), quiet);
if (ret < 0)
return(-1);
if (ret != sizeof(virProxyPacket)) {
} else {
/* read in packet provided */
ret = virProxyReadClientSocket(conn->proxy, (char *) answer,
- sizeof(virProxyPacket));
+ sizeof(virProxyPacket), quiet);
if (ret < 0)
return(-1);
if (ret != sizeof(virProxyPacket)) {
if (res->len > sizeof(virProxyPacket)) {
ret = virProxyReadClientSocket(conn->proxy,
(char *) &(answer->extra.arg[0]),
- res->len - ret);
+ res->len - ret, quiet);
if (ret != (int) (res->len - sizeof(virProxyPacket))) {
fprintf(stderr,
"Communication error with proxy: got %d bytes of %d\n",
memset(&req, 0, sizeof(req));
req.command = VIR_PROXY_NONE;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, NULL);
+ ret = xenProxyCommand(conn, &req, NULL, 1);
if ((ret < 0) || (req.command != VIR_PROXY_NONE)) {
- virProxyError(conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ if (!(flags & VIR_DRV_OPEN_QUIET))
+ virProxyError(conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
xenProxyClose(conn);
return(-1);
}
memset(&req, 0, sizeof(req));
req.command = VIR_PROXY_VERSION;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, NULL);
+ ret = xenProxyCommand(conn, &req, NULL, 0);
if (ret < 0) {
xenProxyClose(conn);
return(-1);
memset(&req, 0, sizeof(req));
req.command = VIR_PROXY_LIST;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, &ans);
+ ret = xenProxyCommand(conn, &req, &ans, 0);
if (ret < 0) {
xenProxyClose(conn);
return(-1);
memset(&req, 0, sizeof(req));
req.command = VIR_PROXY_NUM_DOMAIN;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, NULL);
+ ret = xenProxyCommand(conn, &req, NULL, 0);
if (ret < 0) {
xenProxyClose(conn);
return(-1);
req.command = VIR_PROXY_MAX_MEMORY;
req.data.arg = id;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, NULL);
+ ret = xenProxyCommand(conn, &req, NULL, 0);
if (ret < 0) {
xenProxyClose(conn);
return(-1);
req.command = VIR_PROXY_DOMAIN_INFO;
req.data.arg = domain->handle;
req.len = sizeof(req);
- ret = xenProxyCommand(domain->conn, &req, &ans);
+ ret = xenProxyCommand(domain->conn, &req, &ans, 0);
if (ret < 0) {
xenProxyClose(domain->conn);
return(-1);
req.command = VIR_PROXY_LOOKUP_ID;
req.data.arg = id;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, &ans);
+ ret = xenProxyCommand(conn, &req, &ans, 0);
if (ret < 0) {
xenProxyClose(conn);
return(NULL);
memset(&req, 0, sizeof(virProxyPacket));
req.command = VIR_PROXY_LOOKUP_UUID;
req.len = sizeof(virProxyPacket) + 16;
- ret = xenProxyCommand(conn, (virProxyPacketPtr) &req, &req);
+ ret = xenProxyCommand(conn, (virProxyPacketPtr) &req, &req, 0);
if (ret < 0) {
xenProxyClose(conn);
return(NULL);
req.command = VIR_PROXY_LOOKUP_NAME;
req.len = sizeof(virProxyPacket) + len + 1;
strcpy(&req.extra.str[0], name);
- ret = xenProxyCommand(conn, (virProxyPacketPtr) &req, &req);
+ ret = xenProxyCommand(conn, (virProxyPacketPtr) &req, &req, 0);
if (ret < 0) {
xenProxyClose(conn);
return(NULL);
req.command = VIR_PROXY_NODE_INFO;
req.data.arg = 0;
req.len = sizeof(req);
- ret = xenProxyCommand(conn, &req, &ans);
+ ret = xenProxyCommand(conn, &req, &ans, 0);
if (ret < 0) {
xenProxyClose(conn);
return(-1);