Permalink
Browse files

Merge branch 'bareos-16.2'

  • Loading branch information...
pstorz committed Apr 7, 2017
2 parents 138fce0 + 7b1443a commit f462a248a29ac0d9292c207e7e7a7fe261acdd24
@@ -1423,14 +1423,27 @@ Function .onInit
/SD IDCANCEL IDOK uninst
Abort
- ;Run the uninstaller
uninst:
+
+ #
+ # workaround for bug in 16.2.4 and 16.2.5-r21.1: make copy of configuration files,
+ # before they are deleted by uninstaller of 16.2.4.
+ #
+ StrCpy $6 "$0" 6
+ StrCmp $6 "16.2.4" config_backup_workaround
+ StrCmp $6 "16.2.5" config_backup_workaround no_config_backup_workaround
+
+config_backup_workaround:
+ CreateDirectory "$PLUGINSDIR\config-backup"
+ CopyFiles "$APPDATA\${PRODUCT_NAME}\*.conf" "$PLUGINSDIR\config-backup"
+
+no_config_backup_workaround:
ClearErrors
+ # run the uninstaller
ExecWait '$R0 /S /SILENTKEEPCONFIG _?=$INSTDIR'
;Silent Uninstall, Keep Configuration files, Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller done
- # Exec $INSTDIR\uninst.exe
no_remove_uninstaller:
@@ -1442,6 +1455,10 @@ no_remove_uninstaller:
done:
+ # config backup workaround: restore config files
+ IfFileExists "$PLUGINSDIR\config-backup\*.conf" 0 +2
+ CopyFiles "$PLUGINSDIR\config-backup\*.conf" "$APPDATA\${PRODUCT_NAME}"
+
${GetOptions} $cmdLineParams "/CLIENTNAME=" $ClientName
ClearErrors
@@ -2080,12 +2097,19 @@ Section Uninstall
ConfDeleteSkip:
# delete config files *.conf.old and *.conf.new, ...
- Delete "$APPDATA\${PRODUCT_NAME}\bareos-fd.conf.*"
- Delete "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf.*"
- Delete "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf.*"
- Delete "$APPDATA\${PRODUCT_NAME}\tray-monitor.conf.*"
- Delete "$APPDATA\${PRODUCT_NAME}\bconsole.conf.*"
- Delete "$APPDATA\${PRODUCT_NAME}\bat.conf.*"
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-fd.conf.old"
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf.old"
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf.old"
+ Delete "$APPDATA\${PRODUCT_NAME}\tray-monitor.conf.old"
+ Delete "$APPDATA\${PRODUCT_NAME}\bconsole.conf.old"
+ Delete "$APPDATA\${PRODUCT_NAME}\bat.conf.old"
+
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-fd.conf.new"
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-sd.conf.new"
+ Delete "$APPDATA\${PRODUCT_NAME}\bareos-dir.conf.new"
+ Delete "$APPDATA\${PRODUCT_NAME}\tray-monitor.conf.new"
+ Delete "$APPDATA\${PRODUCT_NAME}\bconsole.conf.new"
+ Delete "$APPDATA\${PRODUCT_NAME}\bat.conf.new"
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
View
@@ -69,6 +69,45 @@ static inline bool validate_client(JCR *jcr)
}
}
+/**
+ * if both FD and SD have LanAddress set, use the storages' LanAddress to connect to.
+ */
+char* storage_address_to_contact(CLIENTRES *client, STORERES *store)
+{
+ if (store->lanaddress && client->lanaddress) {
+ return store->lanaddress;
+ } else {
+ return store->address;
+ }
+}
+
+/**
+ * if both FD and SD have LanAddress set, use the clients' LanAddress to connect to.
+ *
+ */
+char* client_address_to_contact(CLIENTRES *client, STORERES *store)
+{
+ if (store->lanaddress && client->lanaddress) {
+ return client->lanaddress;
+ } else {
+ return client->address;
+ }
+}
+
+/**
+ * if both readstorage and writestorage have LanAddress set,
+ * use wstores' LanAddress to connect to.
+ *
+ */
+char* storage_address_to_contact(STORERES *rstore, STORERES *wstore)
+{
+ if (rstore->lanaddress && wstore->lanaddress) {
+ return wstore->lanaddress;
+ } else {
+ return wstore->address;
+ }
+}
+
static inline bool validate_storage(JCR *jcr)
{
STORERES *store;
@@ -475,14 +514,17 @@ bool do_native_backup(JCR *jcr)
send_bwlimit_to_fd(jcr, jcr->Job); /* Old clients don't have this command */
}
+ client = jcr->res.client;
+ store = jcr->res.wstore;
+ char *connection_target_address;
+
/*
* See if the client is a passive client or not.
*/
if (!jcr->passive_client) {
/*
* Send Storage daemon address to the File daemon
*/
- store = jcr->res.wstore;
if (store->SDDport == 0) {
store->SDDport = store->SDport;
}
@@ -498,12 +540,13 @@ bool do_native_backup(JCR *jcr)
}
}
- fd->fsend(storaddrcmd, store->address, store->SDDport, tls_need);
+ connection_target_address = storage_address_to_contact(client, store);
+
+ fd->fsend(storaddrcmd, connection_target_address, store->SDDport, tls_need);
if (!response(jcr, fd, OKstore, "Storage", DISPLAY_ERROR)) {
goto bail_out;
}
} else {
- client = jcr->res.client;
/*
* TLS Requirement
@@ -516,10 +559,12 @@ bool do_native_backup(JCR *jcr)
}
}
+ connection_target_address = client_address_to_contact(client, store);
+
/*
* Tell the SD to connect to the FD.
*/
- sd->fsend(passiveclientcmd, client->address, client->FDport, tls_need);
+ sd->fsend(passiveclientcmd, connection_target_address, client->FDport, tls_need);
if (!response(jcr, sd, OKpassiveclient, "Passive client", DISPLAY_ERROR)) {
goto bail_out;
}
View
@@ -555,7 +555,7 @@ static bool init_sighandler_sighup()
* The algorithm used is as follows: we count how many jobs are
* running and mark the running jobs to make a callback on
* exiting. The old config is saved with the reload table
- * id in a reload table. The new config file is read. Now, as
+ * id in a reload table. The new configuration is read. Now, as
* each job exits, it calls back to the reload_job_end_cb(), which
* decrements the count of open jobs for the given reload table.
* When the count goes to zero, we release those resources.
@@ -569,11 +569,11 @@ static bool init_sighandler_sighup()
*/
bool do_reload_config()
{
- bool ok;
+ static bool already_here = false;
+ bool ok = false;
+ bool reloaded = false;
JCR *jcr;
int njobs = 0; /* Number of running jobs */
- bool reloaded = false;
- static bool already_here = false;
resource_table_reference prev_config;
if (already_here) {
View
@@ -216,6 +216,7 @@ static RES_ITEM cli_items[] = {
{ "Protocol", CFG_TYPE_AUTHPROTOCOLTYPE, ITEM(res_client.Protocol), 0, CFG_ITEM_DEFAULT, "Native", "13.2.0-", NULL },
{ "AuthType", CFG_TYPE_AUTHTYPE, ITEM(res_client.AuthType), 0, CFG_ITEM_DEFAULT, "None", NULL, NULL },
{ "Address", CFG_TYPE_STR, ITEM(res_client.address), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL },
+ { "LanAddress", CFG_TYPE_STR, ITEM(res_client.lanaddress), 0, CFG_ITEM_DEFAULT, NULL, NULL, NULL },
{ "FdAddress", CFG_TYPE_STR, ITEM(res_client.address), 0, CFG_ITEM_ALIAS, NULL, NULL, "Alias for Address." },
{ "Port", CFG_TYPE_PINT32, ITEM(res_client.FDport), 0, CFG_ITEM_DEFAULT, FD_DEFAULT_PORT, NULL, NULL },
{ "FdPort", CFG_TYPE_PINT32, ITEM(res_client.FDport), 0, CFG_ITEM_DEFAULT | CFG_ITEM_ALIAS, FD_DEFAULT_PORT, NULL, NULL },
@@ -262,6 +263,7 @@ static RES_ITEM store_items[] = {
{ "Protocol", CFG_TYPE_AUTHPROTOCOLTYPE, ITEM(res_store.Protocol), 0, CFG_ITEM_DEFAULT, "Native", NULL, NULL },
{ "AuthType", CFG_TYPE_AUTHTYPE, ITEM(res_store.AuthType), 0, CFG_ITEM_DEFAULT, "None", NULL, NULL },
{ "Address", CFG_TYPE_STR, ITEM(res_store.address), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL },
+ { "LanAddress", CFG_TYPE_STR, ITEM(res_store.lanaddress), 0, CFG_ITEM_DEFAULT, NULL, NULL, NULL },
{ "SdAddress", CFG_TYPE_STR, ITEM(res_store.address), 0, CFG_ITEM_ALIAS, NULL, NULL, "Alias for Address." },
{ "Port", CFG_TYPE_PINT32, ITEM(res_store.SDport), 0, CFG_ITEM_DEFAULT, SD_DEFAULT_PORT, NULL, NULL },
{ "SdPort", CFG_TYPE_PINT32, ITEM(res_store.SDport), 0, CFG_ITEM_DEFAULT | CFG_ITEM_ALIAS, SD_DEFAULT_PORT, NULL, "Alias for Port." },
@@ -2556,6 +2558,9 @@ void free_resource(RES *sres, int type)
if (res->res_client.address) {
free(res->res_client.address);
}
+ if (res->res_client.lanaddress) {
+ free(res->res_client.lanaddress);
+ }
if (res->res_client.username) {
free(res->res_client.username);
}
@@ -2571,6 +2576,9 @@ void free_resource(RES *sres, int type)
if (res->res_store.address) {
free(res->res_store.address);
}
+ if (res->res_store.lanaddress) {
+ free(res->res_store.lanaddress);
+ }
if (res->res_store.username) {
free(res->res_store.username);
}
View
@@ -246,21 +246,22 @@ struct runtime_job_status_t;
*/
class CLIENTRES: public BRSRES {
public:
- uint32_t Protocol; /**< Protocol to use to connect */
- uint32_t AuthType; /**< Authentication Type to use for protocol */
- uint32_t ndmp_loglevel; /**< NDMP Protocol specific loglevel to use */
- uint32_t ndmp_blocksize; /**< NDMP Protocol specific blocksize to use */
- uint32_t FDport; /**< Where File daemon listens */
- uint64_t SoftQuota; /**< Soft Quota permitted in bytes */
- uint64_t HardQuota; /**< Maximum permitted quota in bytes */
- uint64_t GraceTime; /**< Time remaining on gracetime */
- uint64_t QuotaLimit; /**< The total softquota supplied if over grace */
- utime_t SoftQuotaGracePeriod; /**< Grace time for softquota */
- utime_t FileRetention; /**< File retention period in seconds */
- utime_t JobRetention; /**< Job retention period in seconds */
- utime_t heartbeat_interval; /**< Interval to send heartbeats */
- char *address; /**< Hostname for remote access to Client */
- char *username; /**< Username to use for authentication if protocol supports it */
+ uint32_t Protocol; /* Protocol to use to connect */
+ uint32_t AuthType; /* Authentication Type to use for protocol */
+ uint32_t ndmp_loglevel; /* NDMP Protocol specific loglevel to use */
+ uint32_t ndmp_blocksize; /* NDMP Protocol specific blocksize to use */
+ uint32_t FDport; /* Where File daemon listens */
+ uint64_t SoftQuota; /* Soft Quota permitted in bytes */
+ uint64_t HardQuota; /* Maximum permitted quota in bytes */
+ uint64_t GraceTime; /* Time remaining on gracetime */
+ uint64_t QuotaLimit; /* The total softquota supplied if over grace */
+ utime_t SoftQuotaGracePeriod; /* Grace time for softquota */
+ utime_t FileRetention; /* File retention period in seconds */
+ utime_t JobRetention; /* Job retention period in seconds */
+ utime_t heartbeat_interval; /* Interval to send heartbeats */
+ char *address; /* Hostname for remote access to Client */
+ char *lanaddress; /* Hostname for remote access to Client if behind NAT in LAN */
+ char *username; /* Username to use for authentication if protocol supports it */
s_password password;
CATRES *catalog; /**< Catalog resource */
int32_t MaxConcurrentJobs; /**< Maximum concurrent jobs */
@@ -282,12 +283,13 @@ class CLIENTRES: public BRSRES {
*/
class STORERES : public BRSRES {
public:
- uint32_t Protocol; /**< Protocol to use to connect */
- uint32_t AuthType; /**< Authentication Type to use for protocol */
- uint32_t SDport; /**< Port where Directors connect */
- uint32_t SDDport; /**< Data port for File daemon */
- char *address; /**< Hostname for remote access to Storage */
- char *username; /**< Username to use for authentication if protocol supports it */
+ uint32_t Protocol; /* Protocol to use to connect */
+ uint32_t AuthType; /* Authentication Type to use for protocol */
+ uint32_t SDport; /* Port where Directors connect */
+ uint32_t SDDport; /* Data port for File daemon */
+ char *address; /* Hostname for remote access to Storage */
+ char *lanaddress; /* Hostname for remote access to Storage if behind NAT in LAN */
+ char *username; /* Username to use for authentication if protocol supports it */
s_password password;
char *media_type; /**< Media Type provided by this Storage */
char *changer_device; /**< If DIR controls storage directly changer device used */
View
@@ -1374,7 +1374,7 @@ static inline bool do_actual_migration(JCR *jcr)
}
/*
- * Open a message channel connection with the Reading Storage daemon.
+ * Open a message channel connection to the Reading Storage daemon.
*/
Dmsg0(110, "Open connection with reading storage daemon\n");
@@ -1484,7 +1484,8 @@ static inline bool do_actual_migration(JCR *jcr)
* to replicate to the other.
*/
if (jcr->remote_replicate) {
- STORERES *store;
+ STORERES *wstore = mig_jcr->res.wstore;
+ STORERES *rstore = jcr->res.rstore;
POOL_MEM command(PM_MESSAGE);
int tls_need = BNET_TLS_NONE;
@@ -1508,24 +1509,25 @@ static inline bool do_actual_migration(JCR *jcr)
/*
* Send Storage daemon address to the other Storage daemon
*/
- store = mig_jcr->res.wstore;
- if (store->SDDport == 0) {
- store->SDDport = store->SDport;
+ if (wstore->SDDport == 0) {
+ wstore->SDDport = wstore->SDport;
}
/*
* TLS Requirement
*/
- if (store->tls.enable) {
- if (store->tls.require) {
+ if (wstore->tls.enable) {
+ if (wstore->tls.require) {
tls_need = BNET_TLS_REQUIRED;
} else {
tls_need = BNET_TLS_OK;
}
}
- Mmsg(command, replicatecmd, mig_jcr->Job, store->address,
- store->SDDport, tls_need, mig_jcr->sd_auth_key);
+ char *connection_target_address = storage_address_to_contact(rstore, wstore);
+
+ Mmsg(command, replicatecmd, mig_jcr->Job, connection_target_address,
+ wstore->SDDport, tls_need, mig_jcr->sd_auth_key);
if (!jcr->store_bsock->fsend(command.c_str())) {
free_paired_storage(jcr);
View
@@ -63,6 +63,10 @@ bool send_accurate_current_files(JCR *jcr);
void generate_backup_summary(JCR *jcr, CLIENT_DBR *cr, int msg_type,
const char *term_msg);
+char* storage_address_to_contact(CLIENTRES *client, STORERES *store);
+char* client_address_to_contact(CLIENTRES *client, STORERES *store);
+char* storage_address_to_contact(STORERES *rstore, STORERES *wstore);
+
/* bsr.c */
RBSR *new_bsr();
void free_bsr(RBSR *bsr);
Oops, something went wrong.

0 comments on commit f462a24

Please sign in to comment.