aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2007-06-15 13:33:11 -0600
committerAlex Williamson <alex.williamson@hp.com>2007-06-15 13:33:11 -0600
commitb51cbb0e1244018e05fc6c1a28eb7539e1e3bbea (patch)
treedae6f656f612685d1c528cb0b6a13badbd6370d8 /tools
parent2d869d45e5c9969ee47d2f3d2cd127e5ff995685 (diff)
parentb010d6c68edcd9a057310240a97de6186db12437 (diff)
downloadxen-b51cbb0e1244018e05fc6c1a28eb7539e1e3bbea.tar.gz
xen-b51cbb0e1244018e05fc6c1a28eb7539e1e3bbea.tar.bz2
xen-b51cbb0e1244018e05fc6c1a28eb7539e1e3bbea.zip
merge with xen-unstable.hg
Diffstat (limited to 'tools')
-rw-r--r--tools/libxen/src/xen_vbd.c4
-rw-r--r--tools/libxen/src/xen_vm.c6
-rw-r--r--tools/python/xen/xend/XendAPI.py17
-rw-r--r--tools/python/xen/xend/osdep.py10
-rw-r--r--tools/python/xen/xend/server/DevController.py32
-rw-r--r--tools/xenfb/xenfb.c1
-rw-r--r--tools/xenstat/xentop/xentop.c51
7 files changed, 75 insertions, 46 deletions
diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c
index 85b034b45a..9efbca4f58 100644
--- a/tools/libxen/src/xen_vbd.c
+++ b/tools/libxen/src/xen_vbd.c
@@ -463,7 +463,7 @@ xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode)
{ .type = &abstract_type_string,
.u.string_val = vbd },
{ .type = &xen_vbd_mode_abstract_type_,
- .u.string_val = xen_vbd_mode_to_string(mode) }
+ .u.enum_val = mode }
};
xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL);
@@ -479,7 +479,7 @@ xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type)
{ .type = &abstract_type_string,
.u.string_val = vbd },
{ .type = &xen_vbd_type_abstract_type_,
- .u.string_val = xen_vbd_type_to_string(type) }
+ .u.enum_val = type }
};
xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL);
diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c
index 495103c9a9..d3406ab2ec 100644
--- a/tools/libxen/src/xen_vm.c
+++ b/tools/libxen/src/xen_vm.c
@@ -1142,7 +1142,7 @@ xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_n
{ .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_shutdown) }
+ .u.enum_val = after_shutdown }
};
xen_call_(session, "VM.set_actions_after_shutdown", param_values, 2, NULL, NULL);
@@ -1158,7 +1158,7 @@ xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_nor
{ .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_reboot) }
+ .u.enum_val = after_reboot }
};
xen_call_(session, "VM.set_actions_after_reboot", param_values, 2, NULL, NULL);
@@ -1174,7 +1174,7 @@ xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_cras
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &xen_on_crash_behaviour_abstract_type_,
- .u.string_val = xen_on_crash_behaviour_to_string(after_crash) }
+ .u.enum_val = after_crash }
};
xen_call_(session, "VM.set_actions_after_crash", param_values, 2, NULL, NULL);
diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py
index 45f9e2bdb4..641ca944e5 100644
--- a/tools/python/xen/xend/XendAPI.py
+++ b/tools/python/xen/xend/XendAPI.py
@@ -1483,6 +1483,12 @@ class XendAPI(object):
else:
return xen_api_success_void()
+ def VM_set_VCPUs_at_startup(self, session, vm_ref, num):
+ return self.VM_set('VCPUs_at_startup', session, vm_ref, num)
+
+ def VM_set_VCPUs_max(self, session, vm_ref, num):
+ return self.VM_set('VCPUs_max', session, vm_ref, num)
+
def VM_set_actions_after_shutdown(self, session, vm_ref, action):
if action not in XEN_API_ON_NORMAL_EXIT:
return xen_api_error(['VM_ON_NORMAL_EXIT_INVALID', vm_ref])
@@ -1887,6 +1893,17 @@ class XendAPI(object):
xd.managed_config_save(vm)
return xen_api_success_void()
+ def VBD_set_mode(self, session, vbd_ref, mode):
+ if mode == 'RW':
+ mode = 'w'
+ else:
+ mode = 'r'
+ xd = XendDomain.instance()
+ vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref)
+ vm.set_dev_property('vbd', vbd_ref, 'mode', mode)
+ xd.managed_config_save(vm)
+ return xen_api_success_void()
+
def VBD_get_all(self, session):
xendom = XendDomain.instance()
vbds = [d.get_vbds() for d in XendDomain.instance().list('all')]
diff --git a/tools/python/xen/xend/osdep.py b/tools/python/xen/xend/osdep.py
index b3abbf782b..3dc343385e 100644
--- a/tools/python/xen/xend/osdep.py
+++ b/tools/python/xen/xend/osdep.py
@@ -65,11 +65,11 @@ def _solaris_balloon_stat(label):
import fcntl
import array
DEV_XEN_BALLOON = '/dev/xen/balloon'
- BLN_IOCTL_CURRENT = 0x4201
- BLN_IOCTL_TARGET = 0x4202
- BLN_IOCTL_LOW = 0x4203
- BLN_IOCTL_HIGH = 0x4204
- BLN_IOCTL_LIMIT = 0x4205
+ BLN_IOCTL_CURRENT = 0x42410001
+ BLN_IOCTL_TARGET = 0x42410002
+ BLN_IOCTL_LOW = 0x42410003
+ BLN_IOCTL_HIGH = 0x42410004
+ BLN_IOCTL_LIMIT = 0x42410005
label_to_ioctl = { 'Current allocation' : BLN_IOCTL_CURRENT,
'Requested target' : BLN_IOCTL_TARGET,
'Low-mem balloon' : BLN_IOCTL_LOW,
diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py
index faba7bf400..6984435385 100644
--- a/tools/python/xen/xend/server/DevController.py
+++ b/tools/python/xen/xend/server/DevController.py
@@ -213,7 +213,7 @@ class DevController:
devid = int(devid)
frontpath = self.frontendPath(devid)
- if frontpath:
+ if frontpath:
backpath = xstransact.Read(frontpath, "backend")
# Modify online status /before/ updating state (latter is watched by
@@ -224,22 +224,22 @@ class DevController:
if force:
if backpath:
xstransact.Remove(backpath)
- if frontpath:
+ if frontpath:
xstransact.Remove(frontpath)
- return
-
- # Wait till both frontpath and backpath are removed from
- # xenstore, or timed out
- if frontpath:
- status = self.waitUntilDestroyed(frontpath)
- if status == Timeout:
- # Exception will be caught by destroyDevice in XendDomainInfo.py
- raise EnvironmentError
- if backpath:
- status = self.waitUntilDestroyed(backpath)
- if status == Timeout:
- # Exception will be caught by destroyDevice in XendDomainInfo.py
- raise EnvironmentError
+ return
+
+ # Wait till both frontpath and backpath are removed from
+ # xenstore, or timed out
+ if frontpath:
+ status = self.waitUntilDestroyed(frontpath)
+ if status == Timeout:
+ # Exception will be caught by destroyDevice in XendDomainInfo.py
+ raise EnvironmentError
+ if backpath:
+ status = self.waitUntilDestroyed(backpath)
+ if status == Timeout:
+ # Exception will be caught by destroyDevice in XendDomainInfo.py
+ raise EnvironmentError
self.vm._removeVm("device/%s/%d" % (self.deviceClass, devid))
diff --git a/tools/xenfb/xenfb.c b/tools/xenfb/xenfb.c
index eb46de1c92..fcc83e6355 100644
--- a/tools/xenfb/xenfb.c
+++ b/tools/xenfb/xenfb.c
@@ -10,7 +10,6 @@
#include <xen/io/protocols.h>
#include <sys/select.h>
#include <stdbool.h>
-#include <xen/linux/evtchn.h>
#include <xen/event_channel.h>
#include <sys/mman.h>
#include <errno.h>
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index a848420aec..92d4eb217a 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -290,12 +290,24 @@ static void print(const char *fmt, ...)
}
}
+static void xentop_attron(int attr)
+{
+ if (!batch)
+ attron(attr);
+}
+
+static void xentop_attroff(int attr)
+{
+ if (!batch)
+ attroff(attr);
+}
+
/* Print a string with the given attributes set. */
static void attr_addstr(int attr, const char *str)
{
- attron(attr);
+ xentop_attron(attr);
addstr((curses_str_t)str);
- attroff(attr);
+ xentop_attroff(attr);
}
/* Handle setting the delay from the user-supplied value in prompt_val */
@@ -780,18 +792,18 @@ void do_header(void)
field_id i;
/* Turn on REVERSE highlight attribute for headings */
- attron(A_REVERSE);
+ xentop_attron(A_REVERSE);
for(i = 0; i < NUM_FIELDS; i++) {
- if(i != 0)
+ if (i != 0)
print(" ");
/* The BOLD attribute is turned on for the sort column */
- if(i == sort_field)
- attron(A_BOLD);
+ if (i == sort_field)
+ xentop_attron(A_BOLD);
print("%*s", fields[i].default_width, fields[i].header);
- if(i == sort_field)
- attroff(A_BOLD);
+ if (i == sort_field)
+ xentop_attroff(A_BOLD);
}
- attroff(A_REVERSE);
+ xentop_attroff(A_REVERSE);
print("\n");
}
@@ -838,14 +850,14 @@ void do_bottom_line(void)
void do_domain(xenstat_domain *domain)
{
unsigned int i;
- for(i = 0; i < NUM_FIELDS; i++) {
- if(i != 0)
+ for (i = 0; i < NUM_FIELDS; i++) {
+ if (i != 0)
print(" ");
- if(i == sort_field)
- attron(A_BOLD);
+ if (i == sort_field)
+ xentop_attron(A_BOLD);
fields[i].print(domain);
- if(i == sort_field)
- attroff(A_BOLD);
+ if (i == sort_field)
+ xentop_attroff(A_BOLD);
}
print("\n");
}
@@ -956,7 +968,8 @@ static void top(void)
fail("Failed to retrieve statistics from libxenstat\n");
/* dump summary top information */
- do_summary();
+ if (!batch)
+ do_summary();
/* Count the number of domains for which to report data */
num_domains = xenstat_node_num_domains(cur_node);
@@ -976,7 +989,7 @@ static void top(void)
first_domain_index = num_domains-1;
for (i = first_domain_index; i < num_domains; i++) {
- if(current_row() == lines()-1)
+ if(!batch && current_row() == lines()-1)
break;
if (i == first_domain_index || repeat_header)
do_header();
@@ -989,8 +1002,8 @@ static void top(void)
do_vbd(domains[i]);
}
- if(!batch)
- do_bottom_line();
+ if (!batch)
+ do_bottom_line();
free(domains);
}