Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "DiskImage" copy constructor #301

Merged
merged 2 commits into from
Jun 2, 2022

Conversation

barpavel
Copy link
Member

A few "DiskImage" data members were overridden with wrong values at the end of Copy Constructor.
The data members are: CreationDate &LastModified & ImageStatus
Seems like the issue started at:
https://gerrit.ovirt.org/c/ovirt-engine/+/3835/4/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java#350

@barpavel
Copy link
Member Author

/ost

@barpavel barpavel force-pushed the fix_DiskImage_copy_constructor branch from c78eb31 to 75d9401 Compare April 24, 2022 19:34
@barpavel
Copy link
Member Author

/ost

@ahadas
Copy link
Member

ahadas commented May 23, 2022

/ost

Some "Date" data members are copied using reference copying, while in
some 3 places (without any visible reason) a new object is created.

Changing for consistency to a simple reference copy: if we want to
protect from changing an internal "Date" object via one of the
containing "DiskImage" instances, we probably need to do it in
many more places in this class (and other classes as well).

Signed-off-by: Pavel Bar <pbar@redhat.com>
@barpavel barpavel force-pushed the fix_DiskImage_copy_constructor branch from 6173ddb to 667b04b Compare May 24, 2022 16:03
…onstructor

1. For some reason during Copy Constructor of the "DiskImage" class,
the "CreationDate" & "LastModified" fields are overridden from having the
correct date of the original "DiskImage", to the current date.

2. Additionally there are 2 "ImageStatus" modifications: keeping the last one
("ImageStatus.LOCKED" status), since it's actually the one that matters.
There is an open question whether all disks created with this Copy Constructor
should always end up in "ImageStatus.LOCKED" status, but since the existing
code might rely on this strange behavior and the investigation would take a
lot of time, the decision was to keep the current behavior.

This code was refactored lately in:
https://gerrit.ovirt.org/c/ovirt-engine/+/117500/17/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/DiskImage.java#77

But it looks like this implementation started long before - at 2012:
https://gerrit.ovirt.org/c/ovirt-engine/+/3835/4/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java#350

Signed-off-by: Pavel Bar <pbar@redhat.com>
@barpavel barpavel force-pushed the fix_DiskImage_copy_constructor branch from 667b04b to 33f796d Compare May 24, 2022 16:07
@barpavel barpavel requested review from ahadas and bennyz May 25, 2022 14:48
@barpavel
Copy link
Member Author

/ost

@ahadas ahadas merged commit 54307d9 into oVirt:master Jun 2, 2022
@barpavel barpavel deleted the fix_DiskImage_copy_constructor branch June 2, 2022 07:53
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Sep 28, 2022
…if nothing needs doing

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Sep 29, 2022
…if nothing needs doing

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 3, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 6, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 7, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 7, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 10, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 10, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 10, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit to dangel101/ovirt-engine that referenced this pull request Oct 10, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 18, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 19, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 25, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
dangel101 added a commit to dangel101/ovirt-engine that referenced this pull request Oct 26, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
mwperina pushed a commit that referenced this pull request Oct 27, 2022
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint #301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants