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

CP-10203: XenAPI: api call for RDP on/off request #2042

Merged
merged 1 commit into from Jan 6, 2015

Conversation

huizh
Copy link
Contributor

@huizh huizh commented Dec 1, 2014

Signed-off-by: Hui Zhang hui.zhang@citrix.com

(Ref.string_of vm) domid (Printexc.to_string e);
false

let beg_rdp ~__context ~vm ~enabled =
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we read and write Xenstore nodes directly from xapi.
Wherever possible we want to do this only through xenopsd, so this function should just call a corresponding new function in xenopsd.
(Sorry I missed this on Friday when I was reviewing your earlier version of the code. In fact I should have mentioned it before you started.)

@@ -64,6 +64,8 @@ let allowed_power_states ~__context ~vmr ~(op:API.vm_operations) =
| `send_trigger
| `snapshot_with_quiesce
| `suspend
| `beg_rdp_on
Copy link
Contributor

Choose a reason for hiding this comment

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

This set of operations is currently in alphabetical order, which is helpful for readability.

It would be nice to preserve this by inserting the new items into the appropriate place (after awaiting_memory_live) instead of putting them at the end.

@thomassa
Copy link
Contributor

The code looks good now (except for the trivial cosmetic issue of the ordering of the items in xapi_vm_lifecycle.ml around line 67).

Please would you squash the two commits into one?
This is easy with git rebase --interactive HEAD^^ (note that the commits will be listed with the earliest at the top, i.e. in forward not reverse order).

@huizh
Copy link
Contributor Author

huizh commented Dec 15, 2014

Thanks Thomas for the comments.
The code has been updated for xapi_vm_lifecycle.ml.
Also the two commits have been squashed to one.

@@ -174,6 +174,7 @@ let vm_old_pv_drivers = "VM_OLD_PV_DRIVERS"
let vm_lacks_feature_shutdown = "VM_LACKS_FEATURE_SHUTDOWN"
let vm_lacks_feature_suspend = "VM_LACKS_FEATURE_SUSPEND"
let vm_lacks_feature_vcpu_hotplug = "VM_LACKS_FEATURE_VCPU_HOTPLUG"
let vm_lacks_feature_ts = "VM_LACKS_FEATURE_TS"
Copy link
Member

Choose a reason for hiding this comment

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

Why _ts? What does it stand for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Rob, "ts" is for "terminal services", Windows terminology for RDP.
This corresponds to the xenstore nodes data/ts, control/feature-ts and control-ts used by the guest agent.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see, fair enough. However, this error name is part of the high-level XenAPI, and does not necessarily need to use the same terminology as the low-level xenstore interface. In fact, the API calls use "rdp" rather than "ts" already. From a XenAPI user's point of view, it may be clearer to use "rdp" in the error as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the other FEATURE_s in the context (shutdown, suspend, vcpu_hotplug) they all correspond to operations on the VM "virtual hardware". The XenAPI VM.* is mostly about manipulating and monitoring the "virtual hardware" and mostly not about performing operations within the guest operating system (although the implementation of VM.clean_shutdown happens to do this as part of its implementation it could have been implemented in terms of an ACPI button push). This means that the VM.* functions don't really care whether you're running Linux, FreeBSD or Windows.

Since this feature seems very Windows-dependent ("terminal services") and is tied to our particular guest agent (and is not part of the standard Xen guest interface which is more minimal), I think we should reflect that in the name. Perhaps we should call the API VM_guest_agent.foo?

@robhoes
Copy link
Member

robhoes commented Dec 15, 2014

As said on the xenopsd pull request, I'd prefer to use the verb request in the API calls rather than beg.

@robhoes
Copy link
Member

robhoes commented Dec 15, 2014

I realise I should have made most of my above comments on xapi-project/xapi-project.github.io#12 :/

@huizh
Copy link
Contributor Author

huizh commented Dec 16, 2014

Thanks all the comments and suggestion.
Here is a summary of what should the code be updated:

  1. Change the APIs' name from "beg_rdp_on" and "beg_rdp_off" to "request_rdp_on" and "request_rdp_off". All the corresponding code including xen-api, xcp-idl and xenopsd should be updated.
  2. Change "vm_lacks_feature_ts" to "vm_lacks_feature_rdp" in api_errors.ml and corresponding code.
  3. Remove "check_power_state" in xapi_xenops.ml.
  4. About Dave's comment that changing the APIs from "VM." to "VM_guest_agent.", does it mean the APIs should be moved out from VM scope to VM_guest_agent (Is there any existing API in VM_guest_agent? I didn't find.)

Could you please correct me if I miss or misunderstand anything?
Thanks a lot.

Update: Just uploaded the code here to address comments 1 ~ 3.

@huizh
Copy link
Contributor Author

huizh commented Dec 30, 2014

Thanks all for the comments and suggestions.
Based on the decision made with
xapi-project/xapi-project.github.io#12 (comment),
here I update the code to implement.

Could you please help review it?
Much appreciate.

let call_plugin ~__context ~vm ~plugin ~fn ~args =
if plugin <> "guest-agent-operation" then
raise (Api_errors.Server_error(Api_errors.xenapi_missing_plugin, [ plugin ]));
let _ =
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the point of this? Either

  • ignore args completely, or
  • raise an exception if args <> [] (but this only makes sense after checking that fn is valid)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.
I should have added a comment in code that args might be used in future and here it is just an example.
Would remove this evaluation statement if it's not necessary.

@thomassa
Copy link
Contributor

thomassa commented Jan 2, 2015

Looking good, but there are a few small changes to make.

datamodel.ml is in an odd state: the request_rdp items are still defined, but no longer listed in the messages of VM so I am not sure whether or in what form they will end up in the autogenerated documentation. Can you remove them from the datamodel altogether?

With those function specifications gone from the public API, it probably also makes sense to remove the datamodel entry for Errors.vm_lacks_feature_rdp, then catch that exception in the call_plugin implementation in ocaml/xapi/xapi_vm.ml and handle it as if the function name had not been recognised by the plugin (i.e. the plugin doesn't have the function).

@huizh
Copy link
Contributor Author

huizh commented Jan 5, 2015

Thanks Thomas.
Yes, for the datamodel.ml, request_rdp items should be deleted. Also I would remove Errors.vm_lacks_feature_rdp item and handle it in call_plugin correspondingly.

Signed-off-by: Hui Zhang <hui.zhang@citrix.com>
thomassa added a commit that referenced this pull request Jan 6, 2015
CP-10203: XenAPI: api call for RDP on/off request
@thomassa thomassa merged commit 740eaf4 into xapi-project:master Jan 6, 2015
@huizh
Copy link
Contributor Author

huizh commented Jan 7, 2015

Thanks @thomassa

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.

None yet

5 participants