From be69a0d16e6f91ab1e2c98df9afded3bfd68ed53 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 23 Nov 2002 16:48:04 +0000 Subject: [PATCH] Minor updates + doc -- see kes21Nov02 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@207 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 2 + bacula/scripts/gconsole.in | 5 +- bacula/src/cats/make_sqlite_tables.in | 3 +- bacula/src/console/.cvsignore | 1 + bacula/src/console/console.c | 2 +- bacula/src/dird/query.sql | 7 +- bacula/src/stored/askdir.c | 4 ++ bacula/src/stored/label.c | 6 +- bacula/src/stored/record.h | 100 +++++++++++++------------- bacula/src/version.h | 4 +- 10 files changed, 75 insertions(+), 59 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index 15cc6460a7..83be05e9b9 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -20,6 +20,8 @@ For 1.27 release: - Fix intmax_t on FreeBSD. After 1.27 +- Enhance schedule to have 1stSat, ... +- Make sure the MaxVolFiles is fully implemented in SD - Make Job err if WriteBootstrap fails. - Flush all the daemon messages at the end of every job. - Check if both CatalogFiles and UseCatalog are set to SD. diff --git a/bacula/scripts/gconsole.in b/bacula/scripts/gconsole.in index 0197d8da3b..44fe4c8d6b 100755 --- a/bacula/scripts/gconsole.in +++ b/bacula/scripts/gconsole.in @@ -1,8 +1,11 @@ #!/bin/sh +# +# Run gnome-console with test config file +# cd @BUILD_DIR@/src/gnome-console if [ $# = 1 ] ; then echo "doing gnome-console $1.conf" ./gnome-console -c $1.conf else - ./gnome-console + ./gnome-console -c test-gnome-console.conf fi diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index 2695230b8d..46c4a54058 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -129,7 +129,8 @@ CREATE TABLE Pool ( VolRetention BIGINT UNSIGNED DEFAULT 0, VolUseDuration BIGINT UNSIGNED DEFAULT 0, MaxVolJobs INTEGER UNSIGNED DEFAULT 0, - MaxVolfiles INTEGER UNSIGNED DEFAULT 0, + MaxVolFiles INTEGER UNSIGNED DEFAULT 0, + MaxVolBytes BIGINT UNSIGNED DEFAULT 0, AutoPrune TINYINT DEFAULT 0, Recycle TINYINT DEFAULT 0, PoolType VARCHAR(20) NOT NULL, diff --git a/bacula/src/console/.cvsignore b/bacula/src/console/.cvsignore index 3e7332fd02..a149a3fd4e 100644 --- a/bacula/src/console/.cvsignore +++ b/bacula/src/console/.cvsignore @@ -1,3 +1,4 @@ +test-console.conf Makefile btraceback btraceback.gdb diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index c88f21145e..6ae97e66fc 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -278,7 +278,7 @@ try_again: Dmsg2(-1, "Connecting to Director %s:%d\n", dir->address,dir->DIRport); - UA_sock = bnet_connect(&jcr, 5, 15, "Director daemon", dir->address, + UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address, NULL, dir->DIRport, 0); if (UA_sock == NULL) { terminate_console(0); diff --git a/bacula/src/dird/query.sql b/bacula/src/dird/query.sql index 5f86b0d9ae..1e9db805fa 100644 --- a/bacula/src/dird/query.sql +++ b/bacula/src/dird/query.sql @@ -112,6 +112,12 @@ SELECT * from temp2; !DROP TABLE temp; !DROP TABLE temp2; # +:List Pool Attributes for a selected Pool: +*Enter Pool name: +SELECT Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes + FROM Pool + WHERE Name='%1'; +# :List where a File is saved: *Enter Filename (no path): SELECT Job.JobId as JobId, Client.Name as Client, @@ -134,4 +140,3 @@ SELECT count(*) AS Jobs, sum(JobFiles) AS Files, WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId GROUP by VolumeName; - diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index c8a9e511c0..bbb5a1c3e3 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -167,6 +167,8 @@ int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel) Dmsg1(120, "update_volume_data(): %s", dir->msg); if (bnet_recv(dir) <= 0) { Dmsg0(190, "updateVolCatInfo error bnet_recv\n"); + Jmsg(jcr, M_ERROR, 0, _("Error updating Volume Info: %s\n"), + bnet_strerror(dir)); return 0; } Dmsg1(120, "Updatevol: %s", dir->msg); @@ -192,6 +194,8 @@ int dir_create_jobmedia_record(JCR *jcr) Dmsg1(100, "create_jobmedia(): %s", dir->msg); if (bnet_recv(dir) <= 0) { Dmsg0(190, "create_jobmedia error bnet_recv\n"); + Jmsg(jcr, M_ERROR, 0, _("Error creating JobMedia record: %s\n"), + bnet_strerror(dir)); return 0; } Dmsg1(120, "Create_jobmedia: %s", dir->msg); diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index f22425fe0b..df37be4018 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -355,7 +355,7 @@ static int create_volume_label(DEVICE *dev, char *VolName) dev->VolHdr.label_time = dt.julian_day_fraction; } - strcpy(dev->VolHdr.LabelProg, my_name); + bstrncpy(dev->VolHdr.LabelProg, my_name, sizeof(dev->VolHdr.LabelProg)); sprintf(dev->VolHdr.ProgVersion, "Ver. %s %s", VERSION, DATE); sprintf(dev->VolHdr.ProgDate, "Build %s %s", __DATE__, __TIME__); dev->state |= ST_LABEL; /* set has Bacula label */ @@ -389,8 +389,8 @@ int write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *Poo return 0; } strcpy(dev->VolHdr.MediaType, device->media_type); - strcpy(dev->VolHdr.VolName, VolName); - strcpy(dev->VolHdr.PoolName, PoolName); + bstrncpy(dev->VolHdr.VolName, VolName, sizeof(dev->VolHdr.VolName)); + bstrncpy(dev->VolHdr.PoolName, PoolName, sizeof(dev->VolHdr.PoolName)); if (!rewind_dev(dev)) { Dmsg2(30, "Bad status on %s from rewind. ERR=%s\n", dev_name(dev), strerror_dev(dev)); diff --git a/bacula/src/stored/record.h b/bacula/src/stored/record.h index 4c52729f3a..3000a037ea 100644 --- a/bacula/src/stored/record.h +++ b/bacula/src/stored/record.h @@ -30,14 +30,14 @@ #define __RECORD_H 1 /* Return codes from read_device_volume_label() */ -#define VOL_NOT_READ 0 /* Volume label not read */ -#define VOL_OK 1 /* volume name OK */ -#define VOL_NO_LABEL 2 /* volume not labeled */ -#define VOL_IO_ERROR 3 /* volume I/O error */ -#define VOL_NAME_ERROR 4 /* Volume name mismatch */ -#define VOL_CREATE_ERROR 5 /* Error creating label */ -#define VOL_VERSION_ERROR 6 /* Bacula version error */ -#define VOL_LABEL_ERROR 7 /* Bad label type */ +#define VOL_NOT_READ 0 /* Volume label not read */ +#define VOL_OK 1 /* volume name OK */ +#define VOL_NO_LABEL 2 /* volume not labeled */ +#define VOL_IO_ERROR 3 /* volume I/O error */ +#define VOL_NAME_ERROR 4 /* Volume name mismatch */ +#define VOL_CREATE_ERROR 5 /* Error creating label */ +#define VOL_VERSION_ERROR 6 /* Bacula version error */ +#define VOL_LABEL_ERROR 7 /* Bad label type */ /* See block.h for RECHDR_LENGTH */ @@ -60,10 +60,10 @@ */ /* Record state bit definitions */ -#define REC_NO_HEADER 0x01 /* No header read */ +#define REC_NO_HEADER 0x01 /* No header read */ #define REC_PARTIAL_RECORD 0x02 /* returning partial record */ #define REC_BLOCK_EMPTY 0x04 /* not enough data in block */ -#define REC_NO_MATCH 0x08 /* No match on continuation data */ +#define REC_NO_MATCH 0x08 /* No match on continuation data */ #define REC_CONTINUATION 0x10 /* Continuation record found */ #define is_partial_record(r) ((r)->state & REC_PARTIAL_RECORD) @@ -76,21 +76,21 @@ * This is the memory structure for the record header. */ typedef struct s_dev_rec { - int sync; /* synchronous */ + int sync; /* synchronous */ /* File and Block are always returned on reading records, but * only returned on writing if sync is set (obviously). */ - uint32_t File; /* File number */ - uint32_t Block; /* Block number */ - uint32_t VolSessionId; /* sequential id within this session */ - uint32_t VolSessionTime; /* session start time */ - int32_t FileIndex; /* sequential file number */ - int32_t Stream; /* stream number */ - uint32_t data_len; /* current record length */ - uint32_t remainder; /* remaining bytes to read/write */ - uint32_t state; /* state bits */ + uint32_t File; /* File number */ + uint32_t Block; /* Block number */ + uint32_t VolSessionId; /* sequential id within this session */ + uint32_t VolSessionTime; /* session start time */ + int32_t FileIndex; /* sequential file number */ + int32_t Stream; /* stream number */ + uint32_t data_len; /* current record length */ + uint32_t remainder; /* remaining bytes to read/write */ + uint32_t state; /* state bits */ uint8_t ser_buf[WRITE_RECHDR_LENGTH]; /* serialized record header goes here */ - POOLMEM *data; /* Record data. This MUST be a memory pool item */ + POOLMEM *data; /* Record data. This MUST be a memory pool item */ } DEV_RECORD; @@ -99,12 +99,12 @@ typedef struct s_dev_rec { * Note, these values are negative to distinguish them * from user records where the FileIndex is forced positive. */ -#define PRE_LABEL -1 /* Vol label on unwritten tape */ -#define VOL_LABEL -2 /* Volume label first file */ -#define EOM_LABEL -3 /* Writen at end of tape */ -#define SOS_LABEL -4 /* Start of Session */ -#define EOS_LABEL -5 /* End of Session */ -#define EOT_LABEL -6 /* End of physical tape (2 eofs) */ +#define PRE_LABEL -1 /* Vol label on unwritten tape */ +#define VOL_LABEL -2 /* Volume label first file */ +#define EOM_LABEL -3 /* Writen at end of tape */ +#define SOS_LABEL -4 /* Start of Session */ +#define EOS_LABEL -5 /* End of Session */ +#define EOT_LABEL -6 /* End of physical tape (2 eofs) */ /* * Volume Label Record. This is the in-memory definition. The @@ -119,27 +119,27 @@ struct Volume_Label { * in the DEVICE buffer, but are not actually written * to the tape. */ - int32_t LabelType; /* This is written in header only */ - uint32_t LabelSize; /* length of serialized label */ + int32_t LabelType; /* This is written in header only */ + uint32_t LabelSize; /* length of serialized label */ /* * The items below this line are stored on * the tape */ - char Id[32]; /* Bacula Immortal ... */ + char Id[32]; /* Bacula Immortal ... */ - uint32_t VerNum; /* Label version number */ + uint32_t VerNum; /* Label version number */ /* VerNum <= 10 */ - float64_t label_date; /* Date tape labeled */ - float64_t label_time; /* Time tape labeled */ + float64_t label_date; /* Date tape labeled */ + float64_t label_time; /* Time tape labeled */ /* VerNum >= 11 */ - btime_t label_btime; /* tdate tape labeled */ - btime_t write_btime; /* tdate tape written */ + btime_t label_btime; /* tdate tape labeled */ + btime_t write_btime; /* tdate tape written */ /* Unused with VerNum >= 11 */ - float64_t write_date; /* Date this label written */ - float64_t write_time; /* Time this label written */ + float64_t write_date; /* Date this label written */ + float64_t write_time; /* Time this label written */ char VolName[MAX_NAME_LENGTH]; /* Volume name */ char PrevVolName[MAX_NAME_LENGTH]; /* Previous Volume Name */ @@ -148,9 +148,9 @@ struct Volume_Label { char MediaType[MAX_NAME_LENGTH]; /* Type of this media */ char HostName[MAX_NAME_LENGTH]; /* Host name of writing computer */ - char LabelProg[32]; /* Label program name */ - char ProgVersion[32]; /* Program version */ - char ProgDate[32]; /* Program build date/time */ + char LabelProg[50]; /* Label program name */ + char ProgVersion[50]; /* Program version */ + char ProgDate[50]; /* Program build date/time */ }; #define SER_LENGTH_Volume_Label 1024 /* max serialised length of volume label */ @@ -163,27 +163,27 @@ typedef struct Volume_Label VOLUME_LABEL; * This record is at the beginning and end of each session */ struct Session_Label { - char Id[32]; /* Bacula Immortal ... */ + char Id[32]; /* Bacula Immortal ... */ - uint32_t VerNum; /* Label version number */ + uint32_t VerNum; /* Label version number */ - uint32_t JobId; /* Job id */ - uint32_t VolumeIndex; /* Sequence no of volume for this job */ + uint32_t JobId; /* Job id */ + uint32_t VolumeIndex; /* Sequence no of volume for this job */ /* VerNum >= 11 */ - btime_t write_btime; /* Tdate this label written */ + btime_t write_btime; /* Tdate this label written */ /* VerNum < 11 */ - float64_t write_date; /* Date this label written */ + float64_t write_date; /* Date this label written */ /* Unused VerNum >= 11 */ - float64_t write_time; /* Time this label written */ + float64_t write_time; /* Time this label written */ char PoolName[MAX_NAME_LENGTH]; /* Pool name */ char PoolType[MAX_NAME_LENGTH]; /* Pool type */ char JobName[MAX_NAME_LENGTH]; /* base Job name */ char ClientName[MAX_NAME_LENGTH]; - char Job[MAX_NAME_LENGTH]; /* Unique name of this Job */ + char Job[MAX_NAME_LENGTH]; /* Unique name of this Job */ char FileSetName[MAX_NAME_LENGTH]; char FileSetMD5[MAX_NAME_LENGTH]; uint32_t JobType; @@ -196,11 +196,11 @@ struct Session_Label { uint32_t StartFile; uint32_t EndFile; uint32_t JobErrors; - uint32_t JobStatus; /* Job status */ + uint32_t JobStatus; /* Job status */ }; typedef struct Session_Label SESSION_LABEL; -#define SERIAL_BUFSIZE 1024 /* volume serialisation buffer size */ +#define SERIAL_BUFSIZE 1024 /* volume serialisation buffer size */ #endif diff --git a/bacula/src/version.h b/bacula/src/version.h index 3b76368cdb..209a333ac9 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #define VERSION "1.27" #define VSTRING "1" -#define DATE "22 November 2002" -#define LSMDATE "22Nov02" +#define DATE "23 November 2002" +#define LSMDATE "23Nov02" /* Debug flags */ #define DEBUG 1 -- 2.39.5