Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #447 from vmware/log-exceptions
Browse files Browse the repository at this point in the history
Log exceptions in ESX service
  • Loading branch information
pdhamdhere committed Jun 8, 2016
2 parents ada42c9 + 5c488b9 commit 762be39
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions esx_service/utils/kvESX.py
Expand Up @@ -173,6 +173,7 @@ def load(volpath):
try:
fh = open(metaFile, "r+")
except IOError:
logging.exception("Failed to open %s", metaFile);
return None

kvDict = json.load(fh)
Expand All @@ -189,6 +190,7 @@ def save(volpath, kvDict):
try:
fh = open(metaFile, "w+")
except IOError:
logging.exception("Failed to open %s", metaFile);
return False

json.dump(kvDict, fh)
Expand Down
2 changes: 1 addition & 1 deletion esx_service/utils/vmdk_utils.py
Expand Up @@ -94,7 +94,7 @@ def vmdk_is_a_descriptor(filepath):
line = f.readline()
return line.startswith('# Disk DescriptorFile')
except:
logging.warning("Failed to open %s for descriptor check", filepath)
logging.exception("Failed to open %s for descriptor check", filepath)

return False

Expand Down
1 change: 1 addition & 0 deletions esx_service/vmdk_ops.py
Expand Up @@ -309,6 +309,7 @@ def find_child(vm_name):
try:
vm = FindChild(GetVmFolder(), vm_name)
except Exception as e:
logging.exception("Failed to find vm: %s", vm_name)
vm = None
return vm, e

Expand Down
3 changes: 3 additions & 0 deletions esx_service/vsan_policy.py
Expand Up @@ -16,6 +16,7 @@
# Module for VSAN storage policy creation and configuration

import os
import logging
import vmdk_utils
import volume_kv as kv

Expand Down Expand Up @@ -67,6 +68,7 @@ def create_policy_file(filename, content):
f.write(content)
f.write('\n')
except:
logging.exception("Failed to open %s for writing", filename)
return 'Error: Failed to open {0} for writing'.format(filename)

return None
Expand All @@ -87,6 +89,7 @@ def delete(name):
try:
os.remove(policy_path(name))
except:
logging.exception("Failed to remove %s policy file", name)
return 'Error: {0} does not exist'.format(name)

return None
Expand Down
1 change: 1 addition & 0 deletions vmdk_plugin/vmdkops/esx_vmdkcmd.go
Expand Up @@ -57,6 +57,7 @@ type vmciError struct {
Error string `json:",omitempty"`
}

// EsxPort used to connect to ESX, passed in as command line param
var EsxPort int

// Run command Guest VM requests on ESX via vmdkops_serv.py listening on vSocket
Expand Down

0 comments on commit 762be39

Please sign in to comment.