Skip to content

kvm: Do not set backing file format of DATADISK in vm start/migration#4800

Merged
DaanHoogland merged 2 commits into
apache:4.15from
ustcweizhou:4.15-donot-rebase-datadisk-qcow2
Mar 24, 2021
Merged

kvm: Do not set backing file format of DATADISK in vm start/migration#4800
DaanHoogland merged 2 commits into
apache:4.15from
ustcweizhou:4.15-donot-rebase-datadisk-qcow2

Conversation

@ustcweizhou

@ustcweizhou ustcweizhou commented Mar 11, 2021

Copy link
Copy Markdown
Contributor

Description

We do not need to set backing file format of DATADISK and ROOT disk which does not have a backing file.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

@yadvr

yadvr commented Mar 11, 2021

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. [S]

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 95

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests [S]

@yadvr yadvr added this to the 4.15.1.0 milestone Mar 12, 2021
@blueorangutan

Copy link
Copy Markdown

[S] Trillian test result (tid-91)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 34323 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4800-t91-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Smoke tests completed. 85 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_migrate_VM_and_root_volume Error 80.66 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 48.22 test_vm_life_cycle.py

@shwstppr shwstppr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@DaanHoogland

Copy link
Copy Markdown
Contributor

@weizhouapache I'm confused by your description in context of the code change. If we do have a disk, but no backing format, we go ahead and rebase it as qcow2, am I right?
and if we don't have a file path or we do have a backing format, we do nothing.

@weizhouapache weizhouapache changed the title kvm: Do not rebase DATADISK in vm start/migration kvm: Do not set backing file format of DATADISK in vm start/migration Mar 12, 2021
@weizhouapache

weizhouapache commented Mar 12, 2021

Copy link
Copy Markdown
Member

@weizhouapache I'm confused by your description in context of the code change. If we do have a disk, but no backing format, we go ahead and rebase it as qcow2, am I right?
and if we don't have a file path or we do have a backing format, we do nothing.

@DaanHoogland I changed the title and description.

we do nothing if (1) disk does not have a backing file ; (2) disk has backing file, and also backing file format.
we set backing file format only if disk has a backing file but backing file format is missing

@DaanHoogland

Copy link
Copy Markdown
Contributor

@weizhouapache I'm confused by your description in context of the code change. If we do have a disk, but no backing format, we go ahead and rebase it as qcow2, am I right?
and if we don't have a file path or we do have a backing format, we do nothing.

@DaanHoogland I changed the title and description.

we do nothing if (1) disk does not have a backing file ; (2) disk has backing file, and also backing file format.
we set backing file format only if disk has a backing file but backing file format is missing

exactly what the code does, good text for the tin ;)

String backingFileFormat = info.get(new String("backing_file_format"));
if (org.apache.commons.lang.StringUtils.isEmpty(backingFileFormat)) {
if (org.apache.commons.lang.StringUtils.isNotBlank(backingFilePath)
&& org.apache.commons.lang.StringUtils.isEmpty(backingFileFormat)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the backing file format is not empty?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rhtyd then it is fine, we do nothing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe some log messages for debug/warn purposes would be interesting. Or do you think that it is something that system admins should not be bothered with?

I am thinking especially on cases such as backingFileFormat not empty and blank/empty backingFilePath, or vice versa.

Additionally, what do you think of replacing StringUtils.isEmpty(backingFileFormat) with StringUtils.isBlank(backingFileFormat)? In such case it would then check if backingFileFormat is whitespace, empty ("") or null.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe some log messages for debug/warn purposes would be interesting. Or do you think that it is something that system admins should not be bothered with?

I am thinking especially on cases such as backingFileFormat not empty and blank/empty backingFilePath, or vice versa.

Additionally, what do you think of replacing StringUtils.isEmpty(backingFileFormat) with StringUtils.isBlank(backingFileFormat)? In such case it would then check if backingFileFormat is whitespace, empty ("") or null.

@GabrielBrascher there is a info next to these lines

                s_logger.info("Setting backing file format of " + volPath);

I will add a line as comment to explain why we need this change.
https://libvirt.org/kbase/backing_chains.html#vm-refuses-to-start-due-to-misconfigured-backing-store-format

StringUtils.isBlank(backingFileFormat) and StringUtils.isEmpty(backingFileFormat) have no difference I think. there are only 2 possible values: empty and 'qcow2'. I will change to isBlank

@GabrielBrascher GabrielBrascher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR @weizhouapache.

String backingFileFormat = info.get(new String("backing_file_format"));
if (org.apache.commons.lang.StringUtils.isEmpty(backingFileFormat)) {
if (org.apache.commons.lang.StringUtils.isNotBlank(backingFilePath)
&& org.apache.commons.lang.StringUtils.isEmpty(backingFileFormat)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe some log messages for debug/warn purposes would be interesting. Or do you think that it is something that system admins should not be bothered with?

I am thinking especially on cases such as backingFileFormat not empty and blank/empty backingFilePath, or vice versa.

Additionally, what do you think of replacing StringUtils.isEmpty(backingFileFormat) with StringUtils.isBlank(backingFileFormat)? In such case it would then check if backingFileFormat is whitespace, empty ("") or null.

@GabrielBrascher GabrielBrascher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. [S]

1 similar comment
@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. [S]

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. [S]

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ centos7 ✖️ centos8 ✖️ debian. SL-JID 152

@yadvr

yadvr commented Mar 18, 2021

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests [S]

@@ -4266,7 +4266,11 @@ public void setBackingFileFormat(String volPath) {
Map<String, String> info = qemu.info(file);
String backingFilePath = info.get(new String("backing_file"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I detect that this code is problematic. According to the Performance (PERFORMANCE), Dm: Method invokes inefficient new String(String) constructor (DM_STRING_CTOR).
Using the java.lang.String(String) constructor wastes memory because the object so constructed will be functionally indistinguishable from the String passed as a parameter.  Just use the argument String directly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rubieHess good point. thanks ! I will create a pr for it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Happy to help.

@yadvr

yadvr commented Mar 24, 2021

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@yadvr yadvr self-assigned this Mar 24, 2021
@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-245)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 36842 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4800-t245-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Smoke tests completed. 85 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_migrate_VM_and_root_volume Error 82.99 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 52.30 test_vm_life_cycle.py

@DaanHoogland DaanHoogland merged commit 952b242 into apache:4.15 Mar 24, 2021
yadvr pushed a commit that referenced this pull request Apr 4, 2021
Thanks @rubieHess to point it out.
see #4800 (comment)
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.

8 participants