From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509060824000881.5387082054563; Thu, 26 Oct 2017 16:33:44 -0700 (PDT) Received: from localhost ([::1]:55078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7reR-0001zu-Vp for importer@patchew.org; Thu, 26 Oct 2017 19:33:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rcT-0000hS-QC for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rcP-0005QY-Qq for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:25 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rcP-0005Pa-HH for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:21 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNU5Wx006108 for ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dur20bfyb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:16 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 17:31:15 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 17:31:12 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVCJr63963208; Thu, 26 Oct 2017 16:31:12 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CC3DC6047; Thu, 26 Oct 2017 17:31:12 -0600 (MDT) Received: from localhost (unknown [9.80.110.224]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id EF5D0C6043; Thu, 26 Oct 2017 17:31:11 -0600 (MDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:49 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-0024-0000-0000-000017653588 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936942; UDB=6.00472189; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-0025-0000-0000-00004D42D060 Message-Id: <20171026233054.21133-2-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 1/6] qga: group agent init/cleanup init separate routines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch better separates the init/cleanup routines out into separate functions to make make the start-up procedure a bit easier to follow. This will be useful when we eventually break out the actual start/stop of the agent's main loop into separates routines that can be called multiple times after the init phase. Signed-off-by: Michael Roth --- qga/main.c | 82 ++++++++++++++++++++++++++++++++++++++--------------------= ---- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/qga/main.c b/qga/main.c index 62a62755bd..73aa9ac507 100644 --- a/qga/main.c +++ b/qga/main.c @@ -1250,9 +1250,21 @@ static bool check_is_frozen(GAState *s) return false; } =20 -static int run_agent(GAState *s, GAConfig *config, int socket_activation) +static GAState *initialize_agent(GAConfig *config) { - ga_state =3D s; + GAState *s =3D g_new0(GAState, 1); + + g_assert_null(ga_state); + + s->log_level =3D config->log_level; + s->log_file =3D stderr; +#ifdef CONFIG_FSFREEZE + s->fsfreeze_hook =3D config->fsfreeze_hook; +#endif + s->pstate_filepath =3D g_strdup_printf("%s/qga.state", config->state_d= ir); + s->state_filepath_isfrozen =3D g_strdup_printf("%s/qga.state.isfrozen", + config->state_dir); + s->frozen =3D check_is_frozen(s); =20 g_log_set_default_handler(ga_log, s); g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR); @@ -1268,7 +1280,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) if (g_mkdir_with_parents(config->state_dir, S_IRWXU) =3D=3D -1) { g_critical("unable to create (an ancestor of) the state directory" " '%s': %s", config->state_dir, strerror(errno)); - return EXIT_FAILURE; + return NULL; } #endif =20 @@ -1293,7 +1305,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) if (!log_file) { g_critical("unable to open specified log file: %s", strerror(errno)); - return EXIT_FAILURE; + return NULL; } s->log_file =3D log_file; } @@ -1304,7 +1316,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) s->pstate_filepath, ga_is_frozen(s))) { g_critical("failed to load persistent state"); - return EXIT_FAILURE; + return NULL; } =20 config->blacklist =3D ga_command_blacklist_init(config->blacklist); @@ -1325,12 +1337,37 @@ static int run_agent(GAState *s, GAConfig *config, = int socket_activation) #ifndef _WIN32 if (!register_signal_handlers()) { g_critical("failed to register signal handlers"); - return EXIT_FAILURE; + return NULL; } #endif =20 s->main_loop =3D g_main_loop_new(NULL, false); =20 + ga_state =3D s; + return s; +} + +static void cleanup_agent(GAState *s) +{ + if (s->command_state) { + ga_command_state_cleanup_all(s->command_state); + ga_command_state_free(s->command_state); + json_message_parser_destroy(&s->parser); + } + if (s->channel) { + ga_channel_free(s->channel); + } + g_free(s->pstate_filepath); + g_free(s->state_filepath_isfrozen); + if (s->main_loop) { + g_main_loop_unref(s->main_loop); + } + g_free(s); + ga_state =3D NULL; +} + +static int run_agent(GAState *s, GAConfig *config, int socket_activation) +{ if (!channel_init(ga_state, config->method, config->channel_path, socket_activation ? FIRST_SOCKET_ACTIVATION_FD : -1)= ) { g_critical("failed to initialize guest agent channel"); @@ -1354,7 +1391,7 @@ static int run_agent(GAState *s, GAConfig *config, in= t socket_activation) int main(int argc, char **argv) { int ret =3D EXIT_SUCCESS; - GAState *s =3D g_new0(GAState, 1); + GAState *s; GAConfig *config =3D g_new0(GAConfig, 1); int socket_activation; =20 @@ -1422,44 +1459,25 @@ int main(int argc, char **argv) } } =20 - s->log_level =3D config->log_level; - s->log_file =3D stderr; -#ifdef CONFIG_FSFREEZE - s->fsfreeze_hook =3D config->fsfreeze_hook; -#endif - s->pstate_filepath =3D g_strdup_printf("%s/qga.state", config->state_d= ir); - s->state_filepath_isfrozen =3D g_strdup_printf("%s/qga.state.isfrozen", - config->state_dir); - s->frozen =3D check_is_frozen(s); - if (config->dumpconf) { config_dump(config); goto end; } =20 + s =3D initialize_agent(config); + if (!s) { + g_critical("error initializing guest agent"); + goto end; + } ret =3D run_agent(s, config, socket_activation); + cleanup_agent(s); =20 end: - if (s->command_state) { - ga_command_state_cleanup_all(s->command_state); - ga_command_state_free(s->command_state); - json_message_parser_destroy(&s->parser); - } - if (s->channel) { - ga_channel_free(s->channel); - } - g_free(s->pstate_filepath); - g_free(s->state_filepath_isfrozen); - if (config->daemonize) { unlink(config->pid_filepath); } =20 config_free(config); - if (s->main_loop) { - g_main_loop_unref(s->main_loop); - } - g_free(s); =20 return ret; } --=20 2.11.0 From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509060979443338.7799171108758; Thu, 26 Oct 2017 16:36:19 -0700 (PDT) Received: from localhost ([::1]:55092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rh7-0004Bc-Gl for importer@patchew.org; Thu, 26 Oct 2017 19:36:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rdR-0001eh-MA for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:32:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rdN-000664-Pk for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:32:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44098 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rdN-0005Pj-KM for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:32:21 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNTbEa076063 for ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dunp59cj3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 19:31:16 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 19:31:13 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVD3L49348678; Thu, 26 Oct 2017 23:31:13 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB9592803A; Thu, 26 Oct 2017 19:31:05 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 712F42803E; Thu, 26 Oct 2017 19:31:05 -0400 (EDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:50 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-2213-0000-0000-00000231EAD5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936942; UDB=6.00472190; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:15 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-2214-0000-0000-000057FA2FC5 Message-Id: <20171026233054.21133-3-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 2/6] qga: hang GAConfig/socket_activation off of GAState global X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For w32 services we rely on the global GAState to access resources associated with the agent within service_main(). Currently this is sufficient for starting the agent since we open the channel once prior to calling service_main(), and simply start the GMainLoop to start the agent from within service_main(). Eventually we want to be able to also [re-]open the communication channel from within service_main(), which requires access to config/socket_activation variables, so we hang them off GAState in preparation for that. Signed-off-by: Michael Roth --- qga/main.c | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/qga/main.c b/qga/main.c index 73aa9ac507..6826cd5f45 100644 --- a/qga/main.c +++ b/qga/main.c @@ -66,6 +66,25 @@ typedef struct GAPersistentState { int64_t fd_counter; } GAPersistentState; =20 +typedef struct GAConfig { + char *channel_path; + char *method; + char *log_filepath; + char *pid_filepath; +#ifdef CONFIG_FSFREEZE + char *fsfreeze_hook; +#endif + char *state_dir; +#ifdef _WIN32 + const char *service; +#endif + gchar *bliststr; /* blacklist may point to this string */ + GList *blacklist; + int daemonize; + GLogLevelFlags log_level; + int dumpconf; +} GAConfig; + struct GAState { JSONMessageParser parser; GMainLoop *main_loop; @@ -91,6 +110,8 @@ struct GAState { #endif gchar *pstate_filepath; GAPersistentState pstate; + GAConfig *config; + int socket_activation; }; =20 struct GAState *ga_state; @@ -944,25 +965,6 @@ static GList *split_list(const gchar *str, const gchar= *delim) return list; } =20 -typedef struct GAConfig { - char *channel_path; - char *method; - char *log_filepath; - char *pid_filepath; -#ifdef CONFIG_FSFREEZE - char *fsfreeze_hook; -#endif - char *state_dir; -#ifdef _WIN32 - const char *service; -#endif - gchar *bliststr; /* blacklist may point to this string */ - GList *blacklist; - int daemonize; - GLogLevelFlags log_level; - int dumpconf; -} GAConfig; - static void config_load(GAConfig *config) { GError *gerr =3D NULL; @@ -1250,7 +1252,7 @@ static bool check_is_frozen(GAState *s) return false; } =20 -static GAState *initialize_agent(GAConfig *config) +static GAState *initialize_agent(GAConfig *config, int socket_activation) { GAState *s =3D g_new0(GAState, 1); =20 @@ -1343,6 +1345,8 @@ static GAState *initialize_agent(GAConfig *config) =20 s->main_loop =3D g_main_loop_new(NULL, false); =20 + s->config =3D config; + s->socket_activation =3D socket_activation; ga_state =3D s; return s; } @@ -1366,10 +1370,10 @@ static void cleanup_agent(GAState *s) ga_state =3D NULL; } =20 -static int run_agent(GAState *s, GAConfig *config, int socket_activation) +static int run_agent(GAState *s) { - if (!channel_init(ga_state, config->method, config->channel_path, - socket_activation ? FIRST_SOCKET_ACTIVATION_FD : -1)= ) { + if (!channel_init(s, s->config->method, s->config->channel_path, + s->socket_activation ? FIRST_SOCKET_ACTIVATION_FD : = -1)) { g_critical("failed to initialize guest agent channel"); return EXIT_FAILURE; } @@ -1464,12 +1468,12 @@ int main(int argc, char **argv) goto end; } =20 - s =3D initialize_agent(config); + s =3D initialize_agent(config, socket_activation); if (!s) { g_critical("error initializing guest agent"); goto end; } - ret =3D run_agent(s, config, socket_activation); + ret =3D run_agent(s); cleanup_agent(s); =20 end: --=20 2.11.0 From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15090608159071011.180331199235; Thu, 26 Oct 2017 16:33:35 -0700 (PDT) Received: from localhost ([::1]:55077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7reT-0001zW-4k for importer@patchew.org; Thu, 26 Oct 2017 19:33:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rcU-0000hT-5i for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rcP-0005Qu-Tk for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39074) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rcP-0005PP-Ko for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:21 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNV6S6125981 for ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dusba089w-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 19:31:15 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 19:31:14 -0400 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVDE046858268; Thu, 26 Oct 2017 23:31:13 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D580A124037; Thu, 26 Oct 2017 19:28:21 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id 9A5EB124035; Thu, 26 Oct 2017 19:28:21 -0400 (EDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:51 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-0048-0000-0000-000001FBE585 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936942; UDB=6.00472189; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:15 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-0049-0000-0000-000042FE2BF4 Message-Id: <20171026233054.21133-4-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 3/6] qga: move w32 service handling out of run_agent() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Eventually we want a w32 service to be able to restart the qga main loop from within service_main(). To allow for this we move service handling out of run_agent() such that service_main() calls run_agent() instead of the reverse. Signed-off-by: Michael Roth --- qga/main.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/qga/main.c b/qga/main.c index 6826cd5f45..2422ccf2f8 100644 --- a/qga/main.c +++ b/qga/main.c @@ -133,6 +133,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD typ= e, LPVOID data, LPVOID ctx); VOID WINAPI service_main(DWORD argc, TCHAR *argv[]); #endif +static int run_agent(GAState *s); =20 static void init_dfl_pathnames(void) @@ -768,7 +769,7 @@ VOID WINAPI service_main(DWORD argc, TCHAR *argv[]) service->status.dwWaitHint =3D 0; SetServiceStatus(service->status_handle, &service->status); =20 - g_main_loop_run(ga_state->main_loop); + run_agent(ga_state); =20 service->status.dwCurrentState =3D SERVICE_STOPPED; SetServiceStatus(service->status_handle, &service->status); @@ -1377,17 +1378,8 @@ static int run_agent(GAState *s) g_critical("failed to initialize guest agent channel"); return EXIT_FAILURE; } -#ifndef _WIN32 + g_main_loop_run(ga_state->main_loop); -#else - if (config->daemonize) { - SERVICE_TABLE_ENTRY service_table[] =3D { - { (char *)QGA_SERVICE_NAME, service_main }, { NULL, NULL } }; - StartServiceCtrlDispatcher(service_table); - } else { - g_main_loop_run(ga_state->main_loop); - } -#endif =20 return EXIT_SUCCESS; } @@ -1473,7 +1465,18 @@ int main(int argc, char **argv) g_critical("error initializing guest agent"); goto end; } + +#ifdef _WIN32 + if (config->daemonize) { + SERVICE_TABLE_ENTRY service_table[] =3D { + { (char *)QGA_SERVICE_NAME, service_main }, { NULL, NULL } }; + StartServiceCtrlDispatcher(service_table); + } else { + ret =3D run_agent(s); + } +#endif ret =3D run_agent(s); + cleanup_agent(s); =20 end: --=20 2.11.0 From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509060983790391.03405683401456; Thu, 26 Oct 2017 16:36:23 -0700 (PDT) Received: from localhost ([::1]:55094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rhB-0004Fa-T9 for importer@patchew.org; Thu, 26 Oct 2017 19:36:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rcU-0000hW-GK for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rcQ-0005RH-EU for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rcQ-0005QO-5i for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:22 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNUPPW136574 for ; Thu, 26 Oct 2017 19:31:18 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dukyaer6g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:18 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 19:31:17 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 19:31:14 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVE9x38731918; Thu, 26 Oct 2017 23:31:14 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 431FEB204E; Thu, 26 Oct 2017 19:28:28 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 0637DB2046; Thu, 26 Oct 2017 19:28:27 -0400 (EDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:52 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-0040-0000-0000-000003B8E7E7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936942; UDB=6.00472190; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:15 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-0041-0000-0000-000007ADF5EC Message-Id: <20171026233054.21133-5-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 4/6] qga: add --retry-path option for re-initializing channel on failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds an option to instruct the agent to periodically attempt re-opening the communication channel after a channel error has occurred. The main use-case for this is providing an OS-independent way of allowing the agent to survive situations like hotplug/unplug of the communication channel, or initial guest set up where the agent may be installed/started prior to the installation of the channel device's driver. There are nicer ways of implementing this functionality via things like systemd services, but this option is useful for platforms like *BSD/w32. Currently a channel error will result in the GSource for that channel being removed from the GMainLoop, but the main loop continuing to run. That behavior results in a dead loop when --retry-path isn't set, and prevents us from knowing when to attempt re-opening the channel when it is set, so we also force the loop to exit as part of this patch. Signed-off-by: Michael Roth --- qga/main.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----= ---- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/qga/main.c b/qga/main.c index 2422ccf2f8..8154e70c3c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -55,6 +55,7 @@ #endif #define QGA_SENTINEL_BYTE 0xFF #define QGA_CONF_DEFAULT CONFIG_QEMU_CONFDIR G_DIR_SEPARATOR_S "qemu-ga.co= nf" +#define QGA_RETRY_INTERVAL 5 =20 static struct { const char *state_dir; @@ -83,6 +84,7 @@ typedef struct GAConfig { int daemonize; GLogLevelFlags log_level; int dumpconf; + bool retry_path; } GAConfig; =20 struct GAState { @@ -112,6 +114,7 @@ struct GAState { GAPersistentState pstate; GAConfig *config; int socket_activation; + bool force_exit; }; =20 struct GAState *ga_state; @@ -134,6 +137,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD typ= e, LPVOID data, VOID WINAPI service_main(DWORD argc, TCHAR *argv[]); #endif static int run_agent(GAState *s); +static void stop_agent(GAState *s, bool requested); =20 static void init_dfl_pathnames(void) @@ -182,9 +186,7 @@ static void quit_handler(int sig) } g_debug("received signal num %d, quitting", sig); =20 - if (g_main_loop_is_running(ga_state->main_loop)) { - g_main_loop_quit(ga_state->main_loop); - } + stop_agent(ga_state, true); } =20 #ifndef _WIN32 @@ -269,6 +271,10 @@ QEMU_COPYRIGHT "\n" " to list available RPCs)\n" " -D, --dump-conf dump a qemu-ga config file based on current config\n" " options / command-line parameters to stdout\n" +" -r, --retry-path attempt re-opening path if it's unavailable or closed= \n" +" due to an error which may be recoverable in the futur= e\n" +" (virtio-serial driver re-install, serial device hot\n" +" plug/unplug, etc.)\n" " -h, --help display this help and exit\n" "\n" QEMU_HELP_BOTTOM "\n" @@ -670,6 +676,7 @@ static gboolean channel_event_cb(GIOCondition condition= , gpointer data) switch (status) { case G_IO_STATUS_ERROR: g_warning("error reading channel"); + stop_agent(s, false); return false; case G_IO_STATUS_NORMAL: buf[count] =3D 0; @@ -1013,6 +1020,10 @@ static void config_load(GAConfig *config) /* enable all log levels */ config->log_level =3D G_LOG_LEVEL_MASK; } + if (g_key_file_has_key(keyfile, "general", "retry-path", NULL)) { + config->retry_path =3D + g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr= ); + } if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) { config->bliststr =3D g_key_file_get_string(keyfile, "general", "blacklist", &gerr); @@ -1074,6 +1085,8 @@ static void config_dump(GAConfig *config) g_key_file_set_string(keyfile, "general", "statedir", config->state_di= r); g_key_file_set_boolean(keyfile, "general", "verbose", config->log_level =3D=3D G_LOG_LEVEL_MASK); + g_key_file_set_boolean(keyfile, "general", "retry-path", + config->retry_path); tmp =3D list_join(config->blacklist, ','); g_key_file_set_string(keyfile, "general", "blacklist", tmp); g_free(tmp); @@ -1092,7 +1105,7 @@ static void config_dump(GAConfig *config) =20 static void config_parse(GAConfig *config, int argc, char **argv) { - const char *sopt =3D "hVvdm:p:l:f:F::b:s:t:D"; + const char *sopt =3D "hVvdm:p:l:f:F::b:s:t:Dr"; int opt_ind =3D 0, ch; const struct option lopt[] =3D { { "help", 0, NULL, 'h' }, @@ -1112,6 +1125,7 @@ static void config_parse(GAConfig *config, int argc, = char **argv) { "service", 1, NULL, 's' }, #endif { "statedir", 1, NULL, 't' }, + { "retry-path", 0, NULL, 'r' }, { NULL, 0, NULL, 0 } }; =20 @@ -1156,6 +1170,9 @@ static void config_parse(GAConfig *config, int argc, = char **argv) case 'D': config->dumpconf =3D 1; break; + case 'r': + config->retry_path =3D true; + break; case 'b': { if (is_help_option(optarg)) { qmp_for_each_command(&ga_commands, ga_print_cmd, NULL); @@ -1359,9 +1376,6 @@ static void cleanup_agent(GAState *s) ga_command_state_free(s->command_state); json_message_parser_destroy(&s->parser); } - if (s->channel) { - ga_channel_free(s->channel); - } g_free(s->pstate_filepath); g_free(s->state_filepath_isfrozen); if (s->main_loop) { @@ -1371,7 +1385,7 @@ static void cleanup_agent(GAState *s) ga_state =3D NULL; } =20 -static int run_agent(GAState *s) +static int run_agent_once(GAState *s) { if (!channel_init(s, s->config->method, s->config->channel_path, s->socket_activation ? FIRST_SOCKET_ACTIVATION_FD : = -1)) { @@ -1381,9 +1395,41 @@ static int run_agent(GAState *s) =20 g_main_loop_run(ga_state->main_loop); =20 + if (s->channel) { + ga_channel_free(s->channel); + } + return EXIT_SUCCESS; } =20 +static int run_agent(GAState *s) +{ + int ret =3D EXIT_SUCCESS; + + s->force_exit =3D false; + + do { + ret =3D run_agent_once(s); + if (s->config->retry_path && !s->force_exit) { + g_warning("agent stopped unexpectedly, restarting..."); + sleep(QGA_RETRY_INTERVAL); + } + } while (s->config->retry_path && !s->force_exit); + + return ret; +} + +static void stop_agent(GAState *s, bool requested) +{ + if (!s->force_exit) { + s->force_exit =3D requested; + } + + if (g_main_loop_is_running(s->main_loop)) { + g_main_loop_quit(s->main_loop); + } +} + int main(int argc, char **argv) { int ret =3D EXIT_SUCCESS; --=20 2.11.0 From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 150906081590410.35833469351735; Thu, 26 Oct 2017 16:33:35 -0700 (PDT) Received: from localhost ([::1]:55079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7reT-00020j-Jx for importer@patchew.org; Thu, 26 Oct 2017 19:33:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rcU-0000hV-El for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rcP-0005Qp-T9 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rcP-0005PQ-Kt for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:21 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNTaB6121461 for ; Thu, 26 Oct 2017 19:31:18 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dusba08ak-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:18 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 19:31:16 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 19:31:15 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVFWP37028028; Thu, 26 Oct 2017 23:31:15 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FF4C112051; Thu, 26 Oct 2017 19:30:45 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP id EEB8F112034; Thu, 26 Oct 2017 19:30:44 -0400 (EDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:53 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-0044-0000-0000-000003A5E125 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936941; UDB=6.00472190; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-0045-0000-0000-000007D4EECE Message-Id: <20171026233054.21133-6-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 5/6] qga-win: install service with --retry-path set by default X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's nicer from a management perspective that the agent can survive hotplug/unplug of the channel device, or be started prior to the installation of the channel device's driver without and still be able to resume normal function afterward. On linux there are alternatives like systemd to support this, but on w32 --retry-path is the only option so it makes sense to set it by default when installed as a w32 service. Signed-off-by: Michael Roth --- qga/installer/qemu-ga.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 5af11627f8..fb2273507f 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -78,7 +78,7 @@ Account=3D"LocalSystem" ErrorControl=3D"ignore" Interactive=3D"no" - Arguments=3D"-d" + Arguments=3D"-d --retry-path" > --=20 2.11.0 From nobody Sat Nov 1 22:24:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509060982809228.41287575549597; Thu, 26 Oct 2017 16:36:22 -0700 (PDT) Received: from localhost ([::1]:55096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rhG-0004Ju-0q for importer@patchew.org; Thu, 26 Oct 2017 19:36:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7rcU-0000hU-8y for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7rcQ-0005R7-8R for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7rcQ-0005QE-01 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 19:31:22 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9QNTc2O004487 for ; Thu, 26 Oct 2017 19:31:21 -0400 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dur20bg1f-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 19:31:20 -0400 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 19:31:19 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 19:31:16 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9QNVFCS61800628; Thu, 26 Oct 2017 23:31:15 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C277FAE03B; Thu, 26 Oct 2017 19:31:59 -0400 (EDT) Received: from localhost (unknown [9.80.110.224]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 7D228AE03C; Thu, 26 Oct 2017 19:31:59 -0400 (EDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 18:30:54 -0500 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> References: <20171026233054.21133-1-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102623-0036-0000-0000-000002821ED6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007957; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936942; UDB=6.00472190; IPR=6.00717204; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017731; XFM=3.00000015; UTC=2017-10-26 23:31:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102623-0037-0000-0000-00004233483D Message-Id: <20171026233054.21133-7-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-26_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 6/6] qga-win: report specific error when failing to open channel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yan@daynix.com, daniel@daynix.com, sameeh@daynix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Useful in general, but especially now that errors might occur more frequently with --retry-path set. Signed-off-by: Michael Roth --- qga/channel-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qga/channel-win32.c b/qga/channel-win32.c index 7e6dc4d26f..335542f748 100644 --- a/qga/channel-win32.c +++ b/qga/channel-win32.c @@ -302,7 +302,8 @@ static gboolean ga_channel_open(GAChannel *c, GAChannel= Method method, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, = NULL); if (c->handle =3D=3D INVALID_HANDLE_VALUE) { - g_critical("error opening path %s", newpath); + g_critical("error opening path %s: %s", newpath, + g_win32_error_message(GetLastError())); return false; } =20 --=20 2.11.0