这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@fkorotkov
Copy link
Contributor

No description provided.

if populateCache {
let ociStorage = VMStorageOCI()
let expectedPushedVMDir = try ociStorage.create(pushedRemoteName)
try localVMDir.clone(to: expectedPushedVMDir, generateMAC: false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this will overwrite all the VM's files, including disk, even if an identical VM with the same digest already exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's practically impossible to get the same digest. Isn't it? I thought it's a hash of a newly formed manifest files from the uploaded layers.

Copy link
Collaborator

@edigaryev edigaryev May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's practically impossible to get the same digest. Isn't it? I thought it's a hash of a newly formed manifest files from the uploaded layers.

I think it quite possible if you push the same VM multiple times (e.g. to different registries).

It's tempting to neglect this, but on the other hand I'm not sure if overwriting 70 GB files is good for SSD and it seems that it's quite easy for us to skip doing needless work just by calling exists().

At this point the code here is almost identical to VMStorageOCI.cache(), and this is the "needless duplication" I was talking about in #103 (comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needless is a strong word in this context IMO. There are slight similarities but I don't see how it's identical. My concern was that these lines were really hard to understand:

let manifestDigest = try await localVMDir.pushToRegistry(registry: registry, references: remoteNamesForRegistry.map{ $0.reference.value })

// Populate the local cache (if requested)
if populateCache {
  for remoteName in remoteNamesForRegistry {
    defaultLogger.appendNewLine("caching \(localName) as \(remoteName)...")

    if let cacheToVMDir = try VMStorageOCI().cache(name: remoteName, digest: manifestDigest) {
      try localVMDir.clone(to: cacheToVMDir, generateMAC: false)
    }
  }
}

IMO it's not clear at all what is going on there without going into implementation details.

@edigaryev edigaryev merged commit e3e2446 into tart-push-populate-cache May 27, 2022
@edigaryev edigaryev deleted the review/tart-push-populate-cache branch May 27, 2022 15:42
edigaryev added a commit that referenced this pull request May 29, 2022
* tart pull: introduce --populate-cache flag

* VMStorageOCI: introduce cache() method

* Review comments (#107)

* Rename SetCommand back to Set

Co-authored-by: Fedor Korotkov <fedor.korotkov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants