8000 fix(hatchery/openstack): use snapshot (#4417) · ovh/cds@8e2bc12 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 8e2bc12

Browse files
yesnaultbnjjj
authored andcommitted
fix(hatchery/openstack): use snapshot (#4417)
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent 1d4bddc commit 8e2bc12

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

engine/hatchery/openstack/openstack.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,20 +465,20 @@ func (h *HatcheryOpenstack) WorkersStartedByModel(model *sdk.Model) int {
465465
// NeedRegistration return true if worker model need regsitration
466466
func (h *HatcheryOpenstack) NeedRegistration(m *sdk.Model) bool {
467467
if m.NeedRegistration {
468-
log.Debug("NeedRegistration> true as worker model.NeedRegistration=true")
468+
log.Debug("NeedRegistration> true as worker model %s model.NeedRegistration=true", m.Name)
469469
return true
470470
}
471471
for _, img := range h.getImages() {
472472
w, _ := img.Metadata["worker_model_name"]
473473
if w == m.Name {
474474
if d, ok := img.Metadata["worker_model_last_modified"]; ok {
475475
if fmt.Sprintf("%d", m.UserLastModified.Unix()) == d.(string) {
476-
log.Debug("NeedRegistration> false. An image is already available for this workerModel.UserLastModified")
476+
log.Debug("NeedRegistration> false. An image is already available for this worker model %s workerModel.UserLastModified", m.Name)
477477
return false
478478
}
479479
}
480480
}
481481
}
482-
log.Debug("NeedRegistration> true. No existing image found for this worker model")
482+
log.Debug("NeedRegistration> true. No existing image found for this worker model %s", m.Name)
483483
return true
484484
}

engine/hatchery/openstack/spawn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (h *HatcheryOpenstack) SpawnWorker(ctx context.Context, spawnArgs hatchery.
6262
for _, img := range imgs {
6363
workerModelName, _ := img.Metadata["worker_model_name"]
6464
workerModelLastModified, _ := img.Metadata["worker_model_last_modified"]
65-
if workerModelName == spawnArgs.Model.Name && workerModelLastModified == spawnArgs.Model.UserLastModified.Unix() {
65+
if workerModelName == spawnArgs.Model.Name && fmt.Sprintf("%s", workerModelLastModified) == fmt.Sprintf("%d", spawnArgs.Model.UserLastModified.Unix()) {
6666
withExistingImage = true
6767
var jobInfo string
6868
if spawnArgs.JobID != 0 {

0 commit comments

Comments
 (0)
0