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

Commit

Permalink
Add ESX service cmd "version" (#2056)
Browse files Browse the repository at this point in the history
This patch adds the command "version" to the ESX service so that VMDK
OPs VMs can send the command "version" to the VMCI socket and get back
the version of the ESX service running on the ESX host.
  • Loading branch information
akutz authored and shuklanirdesh82 committed Jan 30, 2018
1 parent b177434 commit ddbf56b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions esx_service/vmdk_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
VMDK name is formed as [vmdatastore] dockvols/"Name".vmdk
Commands ("cmd" in request):
"create" - create a VMDK in "[vmdatastore] dvol"
"remove" - remove a VMDK. We assume it's not open, and fail if it is
"list" - enumerate VMDKs
"get" - get info about an individual volume (vmdk)
"attach" - attach a VMDK to the requesting VM
"detach" - detach a VMDK from the requesting VM (assuming it's unmounted)
"create" - create a VMDK in "[vmdatastore] dvol"
"remove" - remove a VMDK. We assume it's not open, and fail if it is
"list" - enumerate VMDKs
"get" - get info about an individual volume (vmdk)
"attach" - attach a VMDK to the requesting VM
"detach" - detach a VMDK from the requesting VM (assuming it's unmounted)
"version" - get the ESX service version string
'''

import atexit
Expand Down Expand Up @@ -1827,8 +1827,13 @@ def execRequestThread(client_socket, cartel, request):
logging.warning("executeRequest '%s' failed: %s", req["cmd"], reply_string)
return

opts = req["details"]["Opts"] if "Opts" in req["details"] else {}
reply_string = executeRequest(
# If the command is "version" then there is no need to handle the request via
# the normal VM request handler.
if req["cmd"] == "version":
reply_string = {u'version': "%s" % vmdk_utils.get_version()}
else:
opts = req["details"]["Opts"] if "Opts" in req["details"] else {}
reply_string = executeRequest(
vm_uuid=vm_uuid,
vc_uuid=vc_uuid,
vm_name=vm_name,
Expand Down

0 comments on commit ddbf56b

Please # to comment.