From: Eric Bollengier Date: Wed, 24 Nov 2010 20:45:46 +0000 (+0100) Subject: Add Maximum Bandwidth parameter to File Daemon X-Git-Tag: Release-5.2.1~873 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a29237e279cdfac60b7f0782869a337bdfb296f2;p=bacula%2Fbacula Add Maximum Bandwidth parameter to File Daemon --- diff --git a/bacula/src/filed/filed_conf.c b/bacula/src/filed/filed_conf.c index 04dc239817..4986f14733 100644 --- a/bacula/src/filed/filed_conf.c +++ b/bacula/src/filed/filed_conf.c @@ -118,6 +118,7 @@ static RES_ITEM cli_items[] = { {"tlscertificate", store_dir, ITEM(res_client.tls_certfile), 0, 0, 0}, {"tlskey", store_dir, ITEM(res_client.tls_keyfile), 0, 0, 0}, {"verid", store_str, ITEM(res_client.verid), 0, 0, 0}, + {"maximumbandwidth", store_speed, ITEM(res_client.max_bandwidth), 0, 0, 0}, {NULL, NULL, {0}, 0, 0, 0} }; @@ -138,6 +139,7 @@ static RES_ITEM dir_items[] = { {"tlskey", store_dir, ITEM(res_dir.tls_keyfile), 0, 0, 0}, {"tlsdhfile", store_dir, ITEM(res_dir.tls_dhfile), 0, 0, 0}, {"tlsallowedcn", store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0}, + {"maximumbandwidth", store_speed, ITEM(res_dir.max_bandwidth), 0, 0, 0}, {NULL, NULL, {0}, 0, 0, 0} }; diff --git a/bacula/src/filed/filed_conf.h b/bacula/src/filed/filed_conf.h index 2ad4593d6a..2200691f9b 100644 --- a/bacula/src/filed/filed_conf.h +++ b/bacula/src/filed/filed_conf.h @@ -69,7 +69,7 @@ struct DIRRES { char *tls_keyfile; /* TLS Server Key File */ char *tls_dhfile; /* TLS Diffie-Hellman Parameters */ alist *tls_allowed_cns; /* TLS Allowed Clients */ - + uint64_t max_bandwidth; /* Bandwidth limitation (per director) */ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */ }; @@ -105,6 +105,7 @@ struct CLIENT { alist *pki_recipients; /* Shared PKI Recipients */ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */ char *verid; /* Custom Id to print in version command */ + uint64_t max_bandwidth; /* Bandwidth limitation (global) */ }; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 7e9dfdb5a7..6453b81a92 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1694,6 +1694,15 @@ static int storage_cmd(JCR *jcr) /* Try to connect for 1 hour at 10 second intervals */ sd->set_source_address(me->FDsrc_addr); + + /* TODO: see if we put limit on restore and backup... */ + if (jcr->director->max_bandwidth) { + sd->set_bwlimit(jcr->director->max_bandwidth); + + } else if (me->max_bandwidth) { + sd->set_bwlimit(me->max_bandwidth); + } + if (!sd->connect(jcr, 10, (int)me->SDConnectTimeout, me->heartbeat_interval, _("Storage daemon"), jcr->stored_addr, NULL, stored_port, 1)) { sd->destroy();