Merge with xen-ia64-unstable.hg

This commit is contained in:
kfraser@localhost.localdomain committed 2007-05-22 06:43:05 +01:00
commit 09bf75fb8a
14 files changed
+352 -25

No files matched your search

+1
View File
@@ -17,3 +17,4 @@ af0573e9e5258db0a9d28aa954dd302ddd2c2d23 3.0.2-rc
d0d3fef37685be264a7f52201f8ef44c030daad3 3.0.2-branched
6ed4368b4a9e1924c983774c4b1a2b6baf8e98a6 3.0.3-branched
057f7c4dbed1c75a3fbe446d346cee04cff31497 3.0.4-branched
d2ef85c6bf84cc619ca2d42c2edfc6229e70a6ad 3.1.0-branched
@@ -161,7 +161,9 @@ int xentap_sysfs_addif(struct xenbus_device *dev)
void xentap_sysfs_delif(struct xenbus_device *dev)
{
struct backend_info *be = dev->dev.driver_data;
sysfs_remove_group(&dev->dev.kobj, &tapstat_group);
be->group_added = 0;
}
static int blktap_remove(struct xenbus_device *dev)
@@ -212,11 +214,13 @@ static void tap_update_blkif_status(blkif_t *blkif)
return;
}
err = xentap_sysfs_addif(blkif->be->dev);
if (err) {
xenbus_dev_fatal(blkif->be->dev, err,
"creating sysfs entries");
return;
if (!blkif->be->group_added) {
err = xentap_sysfs_addif(blkif->be->dev);
if (err) {
xenbus_dev_fatal(blkif->be->dev, err,
"creating sysfs entries");
return;
}
}
blkif->xenblkd = kthread_run(tap_blkif_schedule, blkif, name);
@@ -11,11 +11,11 @@
extern void machine_kexec_setup_load_arg(xen_kexec_image_t *xki,
struct kimage *image);
int xen_max_nr_phys_cpus;
struct resource xen_hypervisor_res;
struct resource *xen_phys_cpus;
static int __initdata xen_max_nr_phys_cpus;
static struct resource xen_hypervisor_res;
static struct resource *xen_phys_cpus;
void xen_machine_kexec_setup_resources(void)
void __init xen_machine_kexec_setup_resources(void)
{
xen_kexec_range_t range;
struct resource *res;
@@ -104,7 +104,7 @@ void xen_machine_kexec_setup_resources(void)
return;
}
void xen_machine_kexec_register_resources(struct resource *res)
void __init xen_machine_kexec_register_resources(struct resource *res)
{
int k;
+284
View File
@@ -0,0 +1,284 @@
#!/usr/bin/perl -w
#############################################################################################################
# #
# Developed by Ingard Mevåg @ Oslo University College, spring 2007 #
# ingard [at] mevaag [dot] no #
# #
# This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License. #
# To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter #
# to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. #
# #
#############################################################################################################
use strict;
# http://search.cpan.org/~rjray/RPC-XML-0.59/lib/RPC/XML/Client.pm
require RPC::XML;
require RPC::XML::Client;
# for debug purposes
#use Data::Dumper;
##### CONFIG ######
my %xenhosts = ("192.168.0.10" => {"port" => "9363"},
"192.168.0.11" => {"port" => "9363"},
"192.168.0.12" => {"port" => "9363"},
"192.168.0.13" => {"port" => "9363"});
##### CONFIG END ###
##### STATIC VARS #####
my %host_info;
#######################
sub apiconnect
{
foreach my $xenhost (keys %xenhosts)
{
my $xen = RPC::XML::Client->new("http://$xenhost:$xenhosts{$xenhost}{'port'}");
my $session = $xen->simple_request("session.login_with_password", "user","");
if (! $session)
{
print "Can't connect to $xenhost :(\n";
$xenhosts{$xenhost} = {'xen' => $xen, 'session' => ""};
}
else
{
$xenhosts{$xenhost} = {'xen' => $xen, 'session' => $session->{'Value'}};
print "Connected successfully to $xenhost..\n";
}
}
}
sub validate_response
{
my ($result_ref) = @_;
if ($result_ref->{'Status'} eq "Success")
{
return $result_ref->{'Value'};
}
else
{
# status = Failure !
# die ("xmlrpc failed! ErrorDescription: $result_ref->{'ErrorDescription'}[1] -> $result_ref->{'ErrorDescription'}[0]");
print "xmlrpc failed! ErrorDescription: $result_ref->{'ErrorDescription'}[1] -> $result_ref->{'ErrorDescription'}[0]\n";
}
}
sub get_host_cpu_utilisation
{
my ($xen, $session, $host_name, $host_ref) = @_;
my $host_cpu_ref = validate_response($xen->simple_request("host.get_host_CPUs", $session, $host_ref));
foreach (@$host_cpu_ref)
{
my $host_cpu_utilisation = validate_response($xen->simple_request("host_cpu.get_utilisation", $session, $_));
$host_info{$host_name}{'cpus'}{$_} = $host_cpu_utilisation;
print " CPUiNFO: $host_cpu_utilisation\n";
}
}
sub get_host_pif_utilisation
{
my ($xen, $session, $host_name, $host_ref) = @_;
# This method isnt implemented yet it seems so using PIF.get_all for now..
# This will break when xen is made cluster aware..
# my $host_pif_ref = validate_response($xen->simple_request("host.get_PIFs", $session, $host_ref));
my $host_pif_ref = validate_response($xen->simple_request("PIF.get_all", $session));
foreach (@$host_pif_ref)
{
my $host_pif_device = validate_response($xen->simple_request("PIF.get_device", $session, $_));
my $host_pif_metrics_ref = validate_response($xen->simple_request("PIF.get_metrics", $session, $_));
# Whats the best solution performancewise?
# Collecting stats from get_records, or pulling individually?
# my $host_pif_record = validate_response($xen->simple_request("PIF_metrics.get_record", $session, $host_pif_metrics_ref));
# my $host_pif_io_read = $host_pif_record->{'io_read_kbs'};
# my $host_pif_io_write = $host_pif_record->{'io_write_kbs'};
my $host_pif_io_read = validate_response($xen->simple_request("PIF_metrics.get_io_read_kbs", $session, $host_pif_metrics_ref));
my $host_pif_io_write = validate_response($xen->simple_request("PIF_metrics.get_io_write_kbs", $session, $host_pif_metrics_ref));
$host_info{$host_name}{'pifs'}{$host_pif_device} = {'read' => $host_pif_io_read, 'write' => $host_pif_io_write};
print " PiFiNFO: $host_pif_device READ: $host_pif_io_read - WRITE: $host_pif_io_write\n";
# $host_info{$host_name}{'pifs'}{$host_pif_device}{'read'} = $host_pif_io_read;
# $host_info{$host_name}{'pifs'}{$host_pif_device}{'write'} = $host_pif_io_write;
}
}
sub get_host_mem_utilisation
{
my ($xen, $session, $host_name, $host_ref) = @_;
my $host_metrics_ref = validate_response($xen->simple_request("host.get_metrics", $session, $host_ref));
my $host_mem_total = validate_response($xen->simple_request("host_metrics.get_memory_total", $session, $host_metrics_ref)) / 1024 / 1024;
my $host_mem_free = validate_response($xen->simple_request("host_metrics.get_memory_free", $session, $host_metrics_ref)) / 1024 / 1024;
$host_info{$host_name}{'memory'} = {'total' => $host_mem_total, 'free' => $host_mem_free};
print " MEMiNFO: Total: $host_mem_total MB - Free: $host_mem_free MB\n";
}
sub get_vm_mem_info
{
my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_;
my $vm_mem_stat_max = validate_response($xen->simple_request("VM.get_memory_static_max",$session,$vm_ref));
my $vm_mem_stat_min = validate_response($xen->simple_request("VM.get_memory_static_min",$session,$vm_ref));
my $vm_mem_dyn_max = validate_response($xen->simple_request("VM.get_memory_dynamic_max",$session,$vm_ref));
my $vm_mem_dyn_min = validate_response($xen->simple_request("VM.get_memory_dynamic_min",$session,$vm_ref));
# not implemented yet.. We'll do this at the same time as getting cpu utilisation
# in the get_vm_metrics sub instead..
#my $vm_metrics_ref = validate_response($xen->simple_request("VM.get_metrics",$session,$vm_ref));
#my $vm_mem_actual = validate_response($xen->simple_request("VM_metrics.get_memory_actual",$session,$vm_metrics_ref));
$host_info{$host_name}{'vms'}{$vm_name_label}{'memory'} = {'static_max' => $vm_mem_stat_max,
'static_min' => $vm_mem_stat_min,
'dynamic_max' => $vm_mem_dyn_max,
'dynamic_min' => $vm_mem_dyn_min};
# xm list uses the dynamic min var as far as i can tell.. or?
# Lets print the memactual info instead of this... I'll do that in the get_vm_metrics sub instead..
# print " |- MEMiNFO: Dynamic Min: $vm_mem_dyn_min - Actually in use: $vm_mem_actual\n";
}
sub get_vm_metrics
{
my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_;
my $vm_metrics_ref = validate_response($xen->simple_request("VM.get_metrics",$session,$vm_ref));
my %vm_vcpu_utilisation = %{validate_response($xen->simple_request("VM_metrics.get_vcpus_utilisation",$session,$vm_metrics_ref))};
for my $tempcpu (keys %vm_vcpu_utilisation)
{
print " |- CPUiNFO: $tempcpu - $vm_vcpu_utilisation{$tempcpu}\n";
$host_info{$host_name}{'vms'}{$vm_name_label}{'vcpus'} = {$tempcpu => $vm_vcpu_utilisation{$tempcpu}};
}
my $vm_mem_actual = validate_response($xen->simple_request("VM_metrics.get_memory_actual",$session,$vm_metrics_ref)) / 1024 / 1024;
$host_info{$host_name}{'vms'}{$vm_name_label}{'memory'}{'actual'} = "$vm_mem_actual";
print " |- MEMiNFO: Actually in use: $vm_mem_actual MB\n";
}
sub get_vm_vif_utilisation
{
my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_;
my $vm_vifs = validate_response($xen->simple_request("VM.get_VIFs",$session,$vm_ref));
foreach (@$vm_vifs)
{
my $vif_device = validate_response($xen->simple_request("VIF.get_device",$session,$_));
my $vif_io_read = validate_response($xen->simple_request("VIF_metrics.get_io_read_kbs", $session, $_));
my $vif_io_write = validate_response($xen->simple_request("VIF_metrics.get_io_write_kbs", $session, $_));
$host_info{$host_name}{'vms'}{$vm_name_label}{'vifs'}{$vif_device} = {'read' => $vif_io_read, 'write' => $vif_io_write};
print " |- ViFiNFO: $vif_device READ: $vif_io_read - WRITE: $vif_io_write\n";
}
}
sub get_vm_vbd_utilisation
{
my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_;
my $vm_vbds = validate_response($xen->simple_request("VM.get_VBDs",$session,$vm_ref));
foreach (@$vm_vbds)
{
my $vbd_device = validate_response($xen->simple_request("VBD.get_device",$session,$_));
my $vbd_io_read = validate_response($xen->simple_request("VBD_metrics.get_io_read_kbs", $session, $_));
my $vbd_io_write = validate_response($xen->simple_request("VBD_metrics.get_io_write_kbs", $session, $_));
$host_info{$host_name}{'vms'}{$vm_name_label}{'vbds'}{$vbd_device} = {'read' => $vbd_io_read, 'write' => $vbd_io_write};
print " |- VBDiNFO: $vbd_device READ: $vbd_io_read - WRITE: $vbd_io_write\n";
}
}
sub get_vm_type
{
my ($xen, $session, $host_name, $vm_ref, $vm_name_label) = @_;
# not running response through validate_response() here to stop it from crashing..
#
# api docs says if this (following) field is set, its a HVM domain.
my $vm_bootloader_results = $xen->simple_request("VM.get_HVM_boot_policy",$session,$vm_ref);
if ("$vm_bootloader_results->{'Status'}" eq "Success")
{
if ("$vm_bootloader_results->{'Value'}" ne "")
{
$host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "HVM";
}
else
{
$host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "PV";
}
}
else
{
# However, xen 3.0.4 doest support this part of the api, so afaik I can get the difference with:
my $vm_pv_kernel_results = $xen->simple_request("VM.get_PV_kernel",$session,$vm_ref);
# which is something like:
# 'PV_kernel': '/boot/vmlinuz-2.6.18-xen',
# or
# 'PV_kernel': '/usr/lib/xen/boot/hvmloader',
if ("$vm_pv_kernel_results->{'Value'}" =~ m/hvm/i)
{
$host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "HVM";
}
else
{
$host_info{$host_name}{'vms'}{$vm_name_label}{'type'} = "PV";
}
}
}
sub get_complete_info
{
my %all_vms;
foreach my $xenhost (sort keys %xenhosts)
{
next unless $xenhosts{$xenhost}{'session'};
my $xen = $xenhosts{$xenhost}{'xen'};
my $session = $xenhosts{$xenhost}{'session'};
print "_______________________\n## $xenhost ##\n-----------------------\n";
my $host_ref = validate_response($xen->simple_request("session.get_this_host", $session));
my $host_name = validate_response($xen->simple_request("host.get_name_label", $session, $host_ref));
$xenhosts{$xenhost}{'hostname'} = $host_name;
$host_info{$host_name}{'ip'} = $xenhost;
get_host_cpu_utilisation($xen, $session, $host_name, $host_ref);
get_host_mem_utilisation($xen, $session, $host_name, $host_ref);
get_host_pif_utilisation($xen, $session, $host_name, $host_ref);
my $all_vm_refs = validate_response($xen->simple_request("host.get_resident_VMs",$session, $host_ref));
foreach my $vm_ref (@$all_vm_refs)
{
my $vm_name_label = validate_response($xen->simple_request("VM.get_name_label",$session,$vm_ref));
get_vm_type($xen,$session,$host_name,$vm_ref,$vm_name_label);
my $vm_id = validate_response($xen->simple_request("VM.get_domid",$session,$vm_ref));
print "vm: $vm_id\t$vm_name_label\ttype: $host_info{$host_name}{'vms'}->{$vm_name_label}{'type'}\n";
# vm_metrics includes both mem_actual & cpu utilisation
# So we'll add all stats found in that class in one go..
get_vm_metrics($xen,$session,$host_name,$vm_ref,$vm_name_label);
# get_vm_cpu_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label);
# all other mem stats are added seperately..
# This might not be needed at all as xen doesnt have functionality to
# resize mem for a VM atm (afaik)
get_vm_mem_info($xen,$session,$host_name,$vm_ref,$vm_name_label);
get_vm_vif_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label);
get_vm_vbd_utilisation($xen,$session,$host_name,$vm_ref,$vm_name_label);
$all_vms{$vm_name_label} = "" unless ("$vm_name_label" eq "Domain-0");
}
print "\n";
}
# Debug: Uncomment to see the nested datastructure..
#print Dumper(%host_info);
}
apiconnect();
get_complete_info();
+1 -1
View File
@@ -115,7 +115,7 @@ struct tss {
#ifdef ENABLE_VME
unsigned long int_redir[8];
#endif
unsigned char iomap[8192];
unsigned char iomap[8193];
};
static inline void
+1
View File
@@ -127,6 +127,7 @@ setup_gdt(void)
tss.ss0 = DATA_SELECTOR;
tss.esp0 = (unsigned) stack_top;
tss.iomap_base = offsetof(struct tss, iomap);
tss.iomap[sizeof(tss.iomap)-1] = 0xff;
/* initialize gdt's tss selector */
gdt[TSS_SELECTOR / sizeof(gdt[0])] |=
+1
View File
@@ -136,6 +136,7 @@ struct xc_dom_arch {
int (*vcpu) (struct xc_dom_image * dom, void *vcpu_ctxt);
char *guest_type;
char *native_protocol;
int page_shift;
int sizeof_pfn;
+4
View File
@@ -19,6 +19,7 @@
#include <xen/foreign/x86_64.h>
#include <xen/hvm/hvm_info_table.h>
#include <xen/hvm/e820.h>
#include <xen/io/protocols.h>
#include "xg_private.h"
#include "xc_dom.h"
@@ -589,6 +590,7 @@ static int vcpu_x86_64(struct xc_dom_image *dom, void *ptr)
static struct xc_dom_arch xc_dom_32 = {
.guest_type = "xen-3.0-x86_32",
.native_protocol = XEN_IO_PROTO_ABI_X86_32,
.page_shift = PAGE_SHIFT_X86,
.sizeof_pfn = 4,
.alloc_magic_pages = alloc_magic_pages,
@@ -600,6 +602,7 @@ static struct xc_dom_arch xc_dom_32 = {
};
static struct xc_dom_arch xc_dom_32_pae = {
.guest_type = "xen-3.0-x86_32p",
.native_protocol = XEN_IO_PROTO_ABI_X86_32,
.page_shift = PAGE_SHIFT_X86,
.sizeof_pfn = 4,
.alloc_magic_pages = alloc_magic_pages,
@@ -612,6 +615,7 @@ static struct xc_dom_arch xc_dom_32_pae = {
static struct xc_dom_arch xc_dom_64 = {
.guest_type = "xen-3.0-x86_64",
.native_protocol = XEN_IO_PROTO_ABI_X86_64,
.page_shift = PAGE_SHIFT_X86,
.sizeof_pfn = 8,
.alloc_magic_pages = alloc_magic_pages,
+15 -4
View File
@@ -407,6 +407,7 @@ static PyObject *pyxc_linux_build(XcObject *self,
unsigned long console_mfn = 0;
PyObject* elfnote_dict;
PyObject* elfnote = NULL;
PyObject* ret;
int i;
static char *kwd_list[] = { "domid", "store_evtchn", "memsize",
@@ -455,12 +456,22 @@ static PyObject *pyxc_linux_build(XcObject *self,
Py_DECREF(elfnote);
}
ret = Py_BuildValue("{s:i,s:i,s:N}",
"store_mfn", store_mfn,
"console_mfn", console_mfn,
"notes", elfnote_dict);
if ( dom->arch_hooks->native_protocol )
{
PyObject *native_protocol =
Py_BuildValue("s", dom->arch_hooks->native_protocol);
PyDict_SetItemString(ret, "native_protocol", native_protocol);
Py_DECREF(native_protocol);
}
xc_dom_release(dom);
return Py_BuildValue("{s:i,s:i,s:N}",
"store_mfn", store_mfn,
"console_mfn", console_mfn,
"notes", elfnote_dict);
return ret;
out:
xc_dom_release(dom);
+20 -6
View File
@@ -882,7 +882,8 @@ class XendAPI(object):
host_attr_rw = ['name_label',
'name_description',
'other_config']
'other_config',
'logging']
host_methods = [('disable', None),
('enable', None),
@@ -957,7 +958,11 @@ class XendAPI(object):
return xen_api_success(XendNode.instance().get_vcpus_policy())
def host_get_cpu_configuration(self, _, host_ref):
return xen_api_success(XendNode.instance().get_cpu_configuration())
def host_set_logging(self, _, host_ref, logging):
return xen_api_todo()
def host_get_logging(self, _, host_ref):
return xen_api_todo()
# object methods
def host_disable(self, session, host_ref):
XendDomain.instance().set_allow_new_domains(False)
@@ -1010,7 +1015,10 @@ class XendAPI(object):
'metrics': node.host_metrics_uuid,
'capabilities': node.get_capabilities(),
'supported_bootloaders': ['pygrub'],
'sched_policy': node.get_vcpus_policy()}
'sched_policy': node.get_vcpus_policy(),
'logging': {},
'PIFs': XendPIF.get_all(),
'PBDs': XendPBD.get_all()}
return xen_api_success(record)
# class methods
@@ -1133,7 +1141,8 @@ class XendAPI(object):
'tools_version',
'domid',
'is_control_domain',
'metrics'
'metrics',
'crash_dumps',
]
VM_attr_rw = ['name_label',
@@ -1572,6 +1581,9 @@ class XendAPI(object):
else:
return xen_api_success_void()
def VM_get_crash_dumps(self, _, vm_ref):
return xen_api_todo()
# class methods
def VM_get_all(self, session):
refs = [d.get_uuid() for d in XendDomain.instance().list('all')]
@@ -1636,7 +1648,8 @@ class XendAPI(object):
'other_config': xeninfo.info.get('other_config', {}),
'domid': domid is None and -1 or domid,
'is_control_domain': xeninfo.info['is_control_domain'],
'metrics': xeninfo.get_metrics()
'metrics': xeninfo.get_metrics(),
'crash_dumps': []
}
return xen_api_success(record)
@@ -1767,6 +1780,7 @@ class XendAPI(object):
return_cfg[k] = cfg[k]
return_cfg['metrics'] = vbd_ref
return_cfg['runtime_properties'] = {} #todo
return xen_api_success(return_cfg)
@@ -1836,7 +1850,7 @@ class XendAPI(object):
try:
devid = int(device['id'])
device_sxps = dominfo.getDeviceSxprs('vbd')
device_dicts = [dict(device_sxp[1][1:]) for device_sxp in device_sxps]
device_dicts = [dict(device_sxp[1][0:]) for device_sxp in device_sxps]
device_dict = [device_dict
for device_dict in device_dicts
if int(device_dict['virtual-device']) == devid][0]
+4
View File
@@ -357,6 +357,8 @@ class XendDomainInfo:
self.console_port = None
self.console_mfn = None
self.native_protocol = None
self.vmWatch = None
self.shutdownWatch = None
self.shutdownStartTime = None
@@ -1520,6 +1522,8 @@ class XendDomainInfo:
self.console_mfn = channel_details['console_mfn']
if 'notes' in channel_details:
self.info.set_notes(channel_details['notes'])
if 'native_protocol' in channel_details:
self.native_protocol = channel_details['native_protocol'];
self._introduceDomain()
+4 -3
View File
@@ -195,7 +195,7 @@ class XendNode:
network_uuid, 'network')
if network.get_name_label() == bridge_name:
XendPIF.create_phy(network_uuid, name,
mtu, mac)
mac, mtu)
break
else:
log.debug("Cannot find network for bridge %s "
@@ -233,8 +233,9 @@ class XendNode:
## self.save_networks()
## def get_PIF_refs(self):
## return self.pifs[:]
def get_PIF_refs(self):
log.debug(XendPIF.get_all())
return XendPIF.get_all()
## def _PIF_create(self, name, mtu, vlan, mac, network, persist = True,
## pif_uuid = None, metrics_uuid = None):
+1 -1
View File
@@ -117,7 +117,7 @@ class XendVMMetrics(XendBase):
except Exception, err:
# ignore missing domain
log.trace("domain_getinfo(%d) failed, ignoring: %s", domid, str(err))
return ""
return []
def get_VCPUs_params(self):
domid = self.xend_domain_instance.getDomid()
@@ -459,6 +459,8 @@ class DevController:
'state' : str(xenbusState['Initialising'])
})
if self.vm.native_protocol:
frontDetails.update({'protocol' : self.vm.native_protocol})
backDetails.update({
'domain' : self.vm.getName(),
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.