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 Disk Util and Bek Disk Mounting #711

Merged
merged 8 commits into from
Feb 26, 2019

Conversation

vermashi
Copy link
Contributor

  1. Fix the disk util disk enumeration error
  2. Fix the BEK Mounting permissions
  3. Remove KV response logging line

@vermashi vermashi self-assigned this Dec 28, 2018
crypt_item.mapper_name = "osencrypt"
if encryption_status["os"] == "Encrypted" and not rootfs_crypt_item_found:
crypt_item = CryptItem()
crypt_item.mapper_name = "osencrypt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

try using a variable for this and other instances below.

@@ -226,7 +226,7 @@ def create_secret(self, AccessToken, KeyVaultURL, secret_value, KeyEncryptionAlg

self.logger.log("{0} {1}".format(result.status, result.getheaders()))
result_content = result.read()
self.logger.log("result_content is {0}".format(result_content))
# self.logger.log("result_content is {0}".format(result_content))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the line

Copy link
Collaborator

Choose a reason for hiding this comment

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

And maybe add a comment to not log the result in future since it contains secret


In reply to: 244847482 [](ancestors = 244847482)

Copy link
Collaborator

@mayank88mahajan mayank88mahajan left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Collaborator

@ejarvi ejarvi left a comment

Choose a reason for hiding this comment

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

Core changes look good to me. Some open comments related to side issues or lines changed by linter.

@@ -16,22 +16,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from DiskUtil import *
from Common import *
from Common import TestHooks
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this test hook is even being used anymore. I would prefer removing the import, the TestHook class from Common, and switch to using mocked unit tests or otherwise in the future to fully clean this up.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am OK with doing this next step of clean up in a separate PR if it makes more sense to do it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will address in future PR.

"""
self.make_sure_path_exists(mount_point)
mount_cmd = self.distro_patcher.mount_path + ' -L "' + bek_label + '" ' + mount_point + ' -o ' + option_string
return self.command_executor.Execute(mount_cmd)
Copy link
Collaborator

Choose a reason for hiding this comment

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

A fair amount of confusing log spew is being generated when BEK volume is already mounted and this function is called (because the mount fails in that case and the default parameter value when not specified is to log all errors). The end goal of this function is to exit with the BEK volume mounted. If we call Execute with suppress_logging=False and simply check the return code ourselves, we could eliminate log spew in cases where BEK volume is mounted and mount fails only because it was already mounted and there was nothing to do. This is a benign case but does generate log spew that makes diagnosing real failures more difficult. Another option could be to determine if it is already mounted and if so, skip the Execute.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also something we can work on in a future PR if it makes more sense to do that outside of this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will address in future PR.

def enable_encryption_format(passphrase, disk_format_query, disk_util, force=False):
logger.log('enable_encryption_format')
logger.log('disk format query is {0}'.format(disk_format_query))

json_parsed = json.loads(disk_format_query)

if type(json_parsed) is dict:
encryption_format_items = [json_parsed,]
encryption_format_items = [json_parsed, ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this proper syntax? I know it was from before but it looks odd..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did some testing and it does not cause a syntax error, although I'm not sure it is needed either (may have been left over from some prior change).

@ejarvi
Copy link
Collaborator

ejarvi commented Feb 25, 2019

@vermashi Back to you

@vermashi vermashi merged commit 80c2748 into Azure:master Feb 26, 2019
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