$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\
$\mathit{RW}$ & {\tt actions/after\_shutdown} & on\_normal\_exit & action to take after the guest has shutdown itself \\
$\mathit{RW}$ & {\tt actions/after\_reboot} & on\_normal\_exit & action to take after the guest has rebooted itself \\
-$\mathit{RW}$ & {\tt actions/after\_suspend} & on\_normal\_exit & action to take after the guest has suspended itself \\
$\mathit{RW}$ & {\tt actions/after\_crash} & on\_crash\_behaviour & action to take if the guest crashes \\
$\mathit{RO}_\mathit{run}$ & {\tt consoles} & (console ref) Set & virtual console devices \\
$\mathit{RO}_\mathit{run}$ & {\tt VIFs} & (VIF ref) Set & virtual network interfaces \\
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_actions\_after\_suspend}
-
-{\bf Overview:}
-Get the actions/after\_suspend field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} (on_normal_exit) get_actions_after_suspend (session_id s, VM ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-on\_normal\_exit
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_actions\_after\_suspend}
-
-{\bf Overview:}
-Set the actions/after\_suspend field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_actions_after_suspend (session_id s, VM ref self, on_normal_exit value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline
-
-{\tt on\_normal\_exit } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
xen_int_float_map *vcpus_utilisation;
enum xen_on_normal_exit actions_after_shutdown;
enum xen_on_normal_exit actions_after_reboot;
- enum xen_on_normal_exit actions_after_suspend;
enum xen_on_crash_behaviour actions_after_crash;
struct xen_console_record_opt_set *consoles;
struct xen_vif_record_opt_set *vifs;
xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm);
-/**
- * Get the actions/after_suspend field of the given VM.
- */
-extern bool
-xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm);
-
-
/**
* Get the actions/after_crash field of the given VM.
*/
xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_reboot);
-/**
- * Set the actions/after_suspend field of the given VM.
- */
-extern bool
-xen_vm_set_actions_after_suspend(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_suspend);
-
-
/**
* Set the actions/after_crash field of the given VM.
*/
{ .key = "actions_after_reboot",
.type = &xen_on_normal_exit_abstract_type_,
.offset = offsetof(xen_vm_record, actions_after_reboot) },
- { .key = "actions_after_suspend",
- .type = &xen_on_normal_exit_abstract_type_,
- .offset = offsetof(xen_vm_record, actions_after_suspend) },
{ .key = "actions_after_crash",
.type = &xen_on_crash_behaviour_abstract_type_,
.offset = offsetof(xen_vm_record, actions_after_crash) },
}
-bool
-xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_on_normal_exit_abstract_type_;
- XEN_CALL_("VM.get_actions_after_suspend");
- return session->ok;
-}
-
-
bool
xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm)
{
}
-bool
-xen_vm_set_actions_after_suspend(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_suspend)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &xen_on_normal_exit_abstract_type_,
- .u.string_val = xen_on_normal_exit_to_string(after_suspend) }
- };
-
- xen_call_(session, "VM.set_actions_after_suspend", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
bool
xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash)
{
*/
static xen_vm create_new_vm(xen_session *session)
{
- xen_cpu_feature_set *empty_cpu_feature_set =
- xen_cpu_feature_set_alloc(0);
-
- xen_cpu_feature_set *force_off_cpu_feature_set =
- xen_cpu_feature_set_alloc(1);
- force_off_cpu_feature_set->contents[0] = XEN_CPU_FEATURE_MMX;
-
xen_vm_record vm_record =
{
.name_label = "NewVM",
.vcpus_policy = "credit",
.vcpus_params = "",
.vcpus_number = 2,
- .vcpus_features_required = empty_cpu_feature_set,
- .vcpus_features_can_use = empty_cpu_feature_set,
- .vcpus_features_force_on = empty_cpu_feature_set,
- .vcpus_features_force_off = force_off_cpu_feature_set,
.actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
.actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
- .actions_after_suspend = XEN_ON_NORMAL_EXIT_DESTROY,
.actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
.hvm_boot = "",
.pv_bootloader = "pygrub",
xen_vm vm;
xen_vm_create(session, &vm, &vm_record);
- xen_cpu_feature_set_free(empty_cpu_feature_set);
- xen_cpu_feature_set_free(force_off_cpu_feature_set);
-
if (!session->ok)
{
fprintf(stderr, "VM creation failed.\n");