1 | diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp |
---|
2 | index f38ba4a..d0a5aa9 100644 |
---|
3 | --- a/mythtv/programs/mythbackend/mainserver.cpp |
---|
4 | +++ b/mythtv/programs/mythbackend/mainserver.cpp |
---|
5 | @@ -4465,8 +4465,10 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
6 | { |
---|
7 | // If we don't have any dirs of our own, fallback to list of Default |
---|
8 | // dirs since that is what StorageGroup::Init() does. |
---|
9 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Checking Storage group directories")); |
---|
10 | if (!query.size()) |
---|
11 | { |
---|
12 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP This host does not have any specific directories")); |
---|
13 | query.prepare("SELECT MIN(id),dirname " |
---|
14 | "FROM storagegroup " |
---|
15 | "WHERE groupname = :GROUP " |
---|
16 | @@ -4482,12 +4484,15 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
17 | int bSize; |
---|
18 | while (query.next()) |
---|
19 | { |
---|
20 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Start Query")); |
---|
21 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Query start size %1").arg(strlist.size())); |
---|
22 | dirID = query.value(0).toString(); |
---|
23 | /* The storagegroup.dirname column uses utf8_bin collation, so Qt |
---|
24 | * uses QString::fromAscii() for toString(). Explicitly convert the |
---|
25 | * value using QString::fromUtf8() to prevent corruption. */ |
---|
26 | currentDir = QString::fromUtf8(query.value(1) |
---|
27 | .toByteArray().constData()); |
---|
28 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Directory %1").arg(currentDir)); |
---|
29 | if (currentDir.right(1) == "/") |
---|
30 | currentDir.remove(currentDir.length() - 1, 1); |
---|
31 | |
---|
32 | @@ -4496,6 +4501,7 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
33 | { |
---|
34 | if (checkDir.exists()) |
---|
35 | { |
---|
36 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Directory exists")); |
---|
37 | QByteArray cdir = currentDir.toAscii(); |
---|
38 | getDiskSpace(cdir.constData(), totalKB, usedKB); |
---|
39 | memset(&statbuf, 0, sizeof(statbuf)); |
---|
40 | @@ -4532,8 +4538,12 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
41 | foundDirs[currentDir] = true; |
---|
42 | } |
---|
43 | else |
---|
44 | + { |
---|
45 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Directory doesn't exist")); |
---|
46 | foundDirs[currentDir] = false; |
---|
47 | + } |
---|
48 | } |
---|
49 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Leaving Query")); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | @@ -4567,7 +4577,9 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
54 | |
---|
55 | for (list<PlaybackSock *>::iterator p = localPlaybackList.begin() ; |
---|
56 | p != localPlaybackList.end() ; ++p) { |
---|
57 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP start size %1").arg(strlist.size())); |
---|
58 | (*p)->GetDiskSpace(strlist); |
---|
59 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP end size %1").arg(strlist.size())); |
---|
60 | (*p)->DecrRef(); |
---|
61 | } |
---|
62 | } |
---|
63 | @@ -4578,21 +4590,82 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, |
---|
64 | FileSystemInfo fsInfo; |
---|
65 | QList<FileSystemInfo> fsInfos; |
---|
66 | |
---|
67 | - QStringList::const_iterator it = strlist.begin(); |
---|
68 | - while (it != strlist.end()) |
---|
69 | - { |
---|
70 | - fsInfo.setHostname(*(it++)); |
---|
71 | - fsInfo.setPath(*(it++)); |
---|
72 | - fsInfo.setLocal((*(it++)).toInt() > 0); |
---|
73 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, "In trigger"); |
---|
74 | + QStringList::const_iterator it = strlist.constBegin(); |
---|
75 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP Received %1").arg(strlist.size())); |
---|
76 | + int size=strlist.size(); |
---|
77 | + int counter=0; |
---|
78 | + while((size-counter)>7){ |
---|
79 | + |
---|
80 | + fsInfo.setHostname((strlist.value(counter))); |
---|
81 | + counter++; |
---|
82 | + fsInfo.setPath((strlist.value(counter))); |
---|
83 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPFilesystem %1").arg(fsInfo.getPath())); |
---|
84 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPHostname %1").arg(fsInfo.getHostname())); |
---|
85 | + counter++; |
---|
86 | + fsInfo.setLocal(((strlist.value(counter))).toInt() > 0); |
---|
87 | + counter++; |
---|
88 | + fsInfo.setFSysID(-1); |
---|
89 | + counter++; |
---|
90 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPLocal %1").arg(fsInfo.isLocal())); |
---|
91 | + //LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPFSID %1").arg(fsInfo.getFSysID())); |
---|
92 | + fsInfo.setGroupID(((strlist.value(counter))).toInt()); |
---|
93 | + counter++; |
---|
94 | + fsInfo.setBlockSize(((strlist.value(counter))).toInt()); |
---|
95 | + counter++; |
---|
96 | + fsInfo.setTotalSpace(((strlist.value(counter))).toLongLong()); |
---|
97 | + counter++; |
---|
98 | + fsInfo.setUsedSpace(((strlist.value(counter))).toLongLong()); |
---|
99 | + counter++; |
---|
100 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPGID %1").arg(fsInfo.getGroupID())); |
---|
101 | + fsInfos.push_back(fsInfo); |
---|
102 | + } |
---|
103 | + |
---|
104 | +/* while (it != strlist.constEnd()) |
---|
105 | + { |
---|
106 | + fsInfo.setHostname(*(it++)); |
---|
107 | + fsInfo.setPath(*(it++)); |
---|
108 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPFilesystem %1").arg(fsInfo.getPath())); |
---|
109 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPHostname %1").arg(fsInfo.getHostname())); |
---|
110 | + fsInfo.setLocal((*(it++)).toInt() > 0); |
---|
111 | fsInfo.setFSysID(-1); |
---|
112 | ++it; // Without this, the strlist gets out of whack |
---|
113 | - fsInfo.setGroupID((*(it++)).toInt()); |
---|
114 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPLocal %1").arg(fsInfo.isLocal())); |
---|
115 | + //LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPFSID %1").arg(fsInfo.getFSysID())); |
---|
116 | + fsInfo.setGroupID((*(it++)).toInt()); |
---|
117 | fsInfo.setBlockSize((*(it++)).toInt()); |
---|
118 | fsInfo.setTotalSpace((*(it++)).toLongLong()); |
---|
119 | fsInfo.setUsedSpace((*(it++)).toLongLong()); |
---|
120 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CPGID %1").arg(fsInfo.getGroupID())); |
---|
121 | +// fsInfo.setBlockSize((*(it)).toInt()); |
---|
122 | +// fsInfo.setTotalSpace((*(it)).toLongLong()); |
---|
123 | +// fsInfo.setUsedSpace((*(it)).toLongLong()); |
---|
124 | + fsInfos.push_back(fsInfo); |
---|
125 | +// ++it; |
---|
126 | + } |
---|
127 | +*/ |
---|
128 | +/* { |
---|
129 | + fsInfo.setHostname(*(it++)); |
---|
130 | + fsInfo.setPath(*(it++)); |
---|
131 | + LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPFilesystem %1").arg(fsInfo.getPath())); |
---|
132 | + LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPHostname %1").arg(fsInfo.getHostname())); |
---|
133 | + //LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPLocal %1").arg((*it))); |
---|
134 | + fsInfo.setLocal((*(it++)).toInt() > 0); |
---|
135 | +it++; |
---|
136 | + LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPLocal %1").arg(fsInfo.isLocal())); |
---|
137 | + fsInfo.setFSysID((*(it++)).toInt()); |
---|
138 | + LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPFSID %1").arg(fsInfo.getFSysID())); |
---|
139 | + fsInfo.setGroupID((*(it++)).toInt()); |
---|
140 | + LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, QString("CPGID %1").arg(fsInfo.getGroupID())); |
---|
141 | + fsInfo.setBlockSize((*(it)).toInt()); |
---|
142 | + fsInfo.setTotalSpace((*(it)).toLongLong()); |
---|
143 | + fsInfo.setUsedSpace((*(it)).toLongLong()); |
---|
144 | fsInfos.push_back(fsInfo); |
---|
145 | + ++it; |
---|
146 | } |
---|
147 | +*/ |
---|
148 | strlist.clear(); |
---|
149 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, "Out trigger"); |
---|
150 | |
---|
151 | // Consolidate hosts sharing storage |
---|
152 | int64_t maxWriteFiveSec = GetCurrentMaxBitrate()/12 /*5 seconds*/; |
---|
153 | @@ -4673,14 +4746,46 @@ void MainServer::GetFilesystemInfos(QList<FileSystemInfo> &fsInfos) |
---|
154 | |
---|
155 | BackendQueryDiskSpace(strlist, false, true); |
---|
156 | |
---|
157 | - QStringList::const_iterator it = strlist.begin(); |
---|
158 | - while (it != strlist.end()) |
---|
159 | + QStringList::const_iterator it = strlist.constBegin(); |
---|
160 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2 Received %1").arg(strlist.size())); |
---|
161 | + |
---|
162 | + int size=strlist.size(); |
---|
163 | + int counter=0; |
---|
164 | + while ((size-counter)>7) |
---|
165 | + { |
---|
166 | + fsInfo.setHostname((strlist.value(counter))); |
---|
167 | + counter++; |
---|
168 | + fsInfo.setPath((strlist.value(counter))); |
---|
169 | + counter++; |
---|
170 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Filesystem %1").arg(fsInfo.getPath())); |
---|
171 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Hostname %1").arg(fsInfo.getHostname())); |
---|
172 | + fsInfo.setLocal(((strlist.value(counter))).toInt() > 0); |
---|
173 | + counter++; |
---|
174 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Local %1").arg(fsInfo.isLocal())); |
---|
175 | + fsInfo.setFSysID(-1); |
---|
176 | + //it++; |
---|
177 | + counter++; |
---|
178 | + fsInfo.setGroupID(((strlist.value(counter))).toInt()); |
---|
179 | + counter++; |
---|
180 | + fsInfo.setBlockSize(((strlist.value(counter))).toInt()); |
---|
181 | + counter++; |
---|
182 | + fsInfo.setTotalSpace(((strlist.value(counter))).toLongLong()); |
---|
183 | + counter++; |
---|
184 | + fsInfo.setUsedSpace(((strlist.value(counter))).toLongLong()); |
---|
185 | + counter++; |
---|
186 | + fsInfo.setWeight(0); |
---|
187 | + fsInfos.push_back(fsInfo); |
---|
188 | + } |
---|
189 | +/* while (it != strlist.constEnd()) |
---|
190 | { |
---|
191 | fsInfo.setHostname(*(it++)); |
---|
192 | fsInfo.setPath(*(it++)); |
---|
193 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Filesystem %1").arg(fsInfo.getPath())); |
---|
194 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Hostname %1").arg(fsInfo.getHostname())); |
---|
195 | fsInfo.setLocal((*(it++)).toInt() > 0); |
---|
196 | + LOG(VB_SCHEDULE | VB_FILE, LOG_INFO, QString("CP2Local %1").arg(fsInfo.isLocal())); |
---|
197 | fsInfo.setFSysID(-1); |
---|
198 | - ++it; |
---|
199 | + it++; |
---|
200 | fsInfo.setGroupID((*(it++)).toInt()); |
---|
201 | fsInfo.setBlockSize((*(it++)).toInt()); |
---|
202 | fsInfo.setTotalSpace((*(it++)).toLongLong()); |
---|
203 | @@ -4688,7 +4793,7 @@ void MainServer::GetFilesystemInfos(QList<FileSystemInfo> &fsInfos) |
---|
204 | fsInfo.setWeight(0); |
---|
205 | fsInfos.push_back(fsInfo); |
---|
206 | } |
---|
207 | - |
---|
208 | +*/ |
---|
209 | LOG(VB_SCHEDULE | VB_FILE, LOG_DEBUG, "Determining unique filesystems"); |
---|
210 | size_t maxWriteFiveSec = GetCurrentMaxBitrate()/12 /*5 seconds*/; |
---|
211 | // safety for NFS mounted dirs |
---|