Skip to content

Commit

Permalink
Fix CD-ROM backing ISO library item size check (#832)
Browse files Browse the repository at this point in the history
This PR uses `apimachinery.resource.Quantity`'s `IsZero()` function to correctly check if the CD-ROM's backing ISO library library item is empty. The originally used `Size ()` function returns the number of bytes required to marshal the value to protobuf (i.e. the statement would always be false as that function returns 3 for zero-size quantity).
  • Loading branch information
dilyar85 authored Dec 17, 2024
1 parent e9441ce commit 74c97a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/providers/vsphere/virtualmachine/cdrom.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func getBackingFileNameByImageRef(

// Subscribed content library item file may not always be stored in VC.
// Sync the item to ensure the file is available for CD-ROM connection.
if syncFile && (!itemStatus.Cached || itemStatus.SizeInBytes.Size() == 0) {
if syncFile && (!itemStatus.Cached || itemStatus.SizeInBytes.IsZero()) {
vmCtx.Logger.Info("Syncing content library item", "libItemUUID", libItemUUID)
libItem, err := libManager.GetLibraryItem(vmCtx, libItemUUID)
if err != nil {
Expand Down

0 comments on commit 74c97a1

Please sign in to comment.