[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] merge
# HG changeset patch # User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx> # Date 1170257104 0 # Node ID 9f83b07caabed347f82b9f5231ebc0092261cbeb # Parent b235a7acaf4a452c1e197665dec24af0b6a4e606 # Parent 3db881ef97c44dbe749c7b3e7679f97dd959262d merge --- tools/libxen/Makefile | 3 tools/libxen/include/xen_vdi.h | 1 tools/libxen/src/xen_vdi.c | 3 tools/libxen/test/test_bindings.c | 12 tools/libxen/test/test_hvm_bindings.c | 445 ++++++++++++++++++++++++++++++++ tools/python/scripts/test_hvm_create.py | 9 tools/python/scripts/test_vm_create.py | 11 tools/python/xen/xend/XendAPI.py | 10 tools/python/xen/xend/XendConfig.py | 19 - tools/python/xen/xend/XendDomainInfo.py | 6 tools/python/xen/xend/XendVDI.py | 15 - tools/python/xen/xend/image.py | 6 12 files changed, 498 insertions(+), 42 deletions(-) diff -r b235a7acaf4a -r 9f83b07caabe tools/libxen/Makefile --- a/tools/libxen/Makefile Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/libxen/Makefile Wed Jan 31 15:25:04 2007 +0000 @@ -51,6 +51,9 @@ test/test_bindings: test/test_bindings.o test/test_bindings: test/test_bindings.o libxenapi.so $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi +test/test_hvm_bindings: test/test_hvm_bindings.o libxenapi.so + $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi + .PHONY: install install: all diff -r b235a7acaf4a -r 9f83b07caabe tools/libxen/include/xen_vdi.h --- a/tools/libxen/include/xen_vdi.h Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/libxen/include/xen_vdi.h Wed Jan 31 15:25:04 2007 +0000 @@ -74,6 +74,7 @@ typedef struct xen_vdi_record int64_t virtual_size; int64_t physical_utilisation; int64_t sector_size; + char *location; enum xen_vdi_type type; bool sharable; bool read_only; diff -r b235a7acaf4a -r 9f83b07caabe tools/libxen/src/xen_vdi.c --- a/tools/libxen/src/xen_vdi.c Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/libxen/src/xen_vdi.c Wed Jan 31 15:25:04 2007 +0000 @@ -67,6 +67,9 @@ static const struct_member xen_vdi_recor { .key = "sector_size", .type = &abstract_type_int, .offset = offsetof(xen_vdi_record, sector_size) }, + { .key = "location", + .type = &abstract_type_string, + .offset = offsetof(xen_vdi_record, location) }, { .key = "type", .type = &xen_vdi_type_abstract_type_, .offset = offsetof(xen_vdi_record, type) }, diff -r b235a7acaf4a -r 9f83b07caabe tools/libxen/test/test_bindings.c --- a/tools/libxen/test/test_bindings.c Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/libxen/test/test_bindings.c Wed Jan 31 15:25:04 2007 +0000 @@ -295,10 +295,10 @@ static xen_vm create_new_vm(xen_session .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART, .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE, .hvm_boot = "", - .pv_bootloader = "pygrub", - .pv_kernel = "/boot/vmlinuz-2.6.16.33-xen", + //.pv_bootloader = "pygrub", + .pv_kernel = "/boot/vmlinuz-2.6.18-xenU", .pv_ramdisk = "", - .pv_args = "", + .pv_args = "root=/dev/sda1 ro", .pv_bootloader_args = "" }; @@ -338,6 +338,7 @@ static xen_vm create_new_vm(xen_session .sr = &sr_record, .virtual_size = (1 << 21), // 1GiB / 512 bytes/sector .sector_size = 512, + .location = "file:/root/gentoo.amd64.img", .type = XEN_VDI_TYPE_SYSTEM, .sharable = false, .read_only = false @@ -367,8 +368,9 @@ static xen_vm create_new_vm(xen_session { .vm = &vm_record_opt, .vdi = &vdi0_record_opt, - .device = "xvda1", - .mode = XEN_VBD_MODE_RW + .device = "sda1", + .mode = XEN_VBD_MODE_RW, + .bootable = 1, }; xen_vbd vbd0; diff -r b235a7acaf4a -r 9f83b07caabe tools/libxen/test/test_hvm_bindings.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/test/test_hvm_bindings.c Wed Jan 31 15:25:04 2007 +0000 @@ -0,0 +1,445 @@ +/* + * Copyright (c) 2006 XenSource, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _GNU_SOURCE +#include <inttypes.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <libxml/parser.h> +#include <curl/curl.h> + +#include "xen_host.h" +#include "xen_sr.h" +#include "xen_vbd.h" +#include "xen_vdi.h" +#include "xen_vm.h" + + +static void usage() +{ + fprintf(stderr, +"Usage:\n" +"\n" +" test_bindings <url> <username> <password>\n" +"\n" +"where\n" +" <url> is a fragment of the server's URL, e.g. localhost:8005/RPC2;\n" +" <username> is the username to use at the server; and\n" +" <password> is the password.\n"); + + exit(EXIT_FAILURE); +} + + +static char *url; + + +typedef struct +{ + xen_result_func func; + void *handle; +} xen_comms; + + +static xen_vm create_new_vm(xen_session *session); +static void print_vm_power_state(xen_session *session, xen_vm vm); + + +static size_t +write_func(void *ptr, size_t size, size_t nmemb, xen_comms *comms) +{ + size_t n = size * nmemb; + return comms->func(ptr, n, comms->handle) ? n : 0; +} + + +static int +call_func(const void *data, size_t len, void *user_handle, + void *result_handle, xen_result_func result_func) +{ + (void)user_handle; + + CURL *curl = curl_easy_init(); + if (!curl) { + return -1; + } + + xen_comms comms = { + .func = result_func, + .handle = result_handle + }; + + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); + curl_easy_setopt(curl, CURLOPT_MUTE, 1); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_func); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &comms); + curl_easy_setopt(curl, CURLOPT_POST, 1); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, len); + + CURLcode result = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + return result; +} + + +static void print_error(xen_session *session) +{ + fprintf(stderr, "Error: %d", session->error_description_count); + for (int i = 0; i < session->error_description_count; i++) + { + fprintf(stderr, "%s ", session->error_description[i]); + } + fprintf(stderr, "\n"); +} + + +int main(int argc, char **argv) +{ + if (argc != 4) + { + usage(); + } + + url = argv[1]; + char *username = argv[2]; + char *password = argv[3]; + + xmlInitParser(); + xen_init(); + curl_global_init(CURL_GLOBAL_ALL); + +#define CLEANUP \ + do { \ + xen_session_logout(session); \ + curl_global_cleanup(); \ + xen_fini(); \ + xmlCleanupParser(); \ + } while(0) \ + + + xen_session *session = + xen_session_login_with_password(call_func, NULL, username, password); + + xen_vm vm; + if (!xen_vm_get_by_uuid(session, &vm, + "00000000-0000-0000-0000-000000000000")) + { + print_error(session); + CLEANUP; + return 1; + } + + char *vm_uuid; + if (!xen_vm_get_uuid(session, &vm_uuid, vm)) + { + print_error(session); + xen_vm_free(vm); + CLEANUP; + return 1; + } + + char *vm_uuid_bytes; + if (!xen_uuid_string_to_bytes(vm_uuid, &vm_uuid_bytes)) + { + fprintf(stderr, "xen_uuid_string_to_bytes failed.\n"); + xen_uuid_free(vm_uuid); + xen_vm_free(vm); + CLEANUP; + return 1; + } + + xen_vm_record *vm_record; + if (!xen_vm_get_record(session, &vm_record, vm)) + { + print_error(session); + xen_uuid_bytes_free(vm_uuid_bytes); + xen_uuid_free(vm_uuid); + xen_vm_free(vm); + CLEANUP; + return 1; + } + + xen_host host; + if (!xen_session_get_this_host(session, &host)) + { + print_error(session); + xen_vm_record_free(vm_record); + xen_uuid_bytes_free(vm_uuid_bytes); + xen_uuid_free(vm_uuid); + xen_vm_free(vm); + CLEANUP; + return 1; + } + + xen_string_string_map *versions; + if (!xen_host_get_software_version(session, &versions, host)) + { + print_error(session); + xen_host_free(host); + xen_vm_record_free(vm_record); + xen_uuid_bytes_free(vm_uuid_bytes); + xen_uuid_free(vm_uuid); + xen_vm_free(vm); + CLEANUP; + return 1; + } + + printf("%s.\n", vm_uuid); + + fprintf(stderr, "In bytes, the VM UUID is "); + for (int i = 0; i < 15; i++) + { + fprintf(stderr, "%x, ", (unsigned int)vm_uuid_bytes[i]); + } + fprintf(stderr, "%x.\n", (unsigned int)vm_uuid_bytes[15]); + + printf("%zd.\n", versions->size); + + for (size_t i = 0; i < versions->size; i++) + { + printf("%s -> %s.\n", versions->contents[i].key, + versions->contents[i].val); + } + + printf("%s.\n", vm_record->uuid); + + printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle); + + printf("%s.\n", xen_vm_power_state_to_string(vm_record->power_state)); + + for (size_t i = 0; i < vm_record->vcpus_utilisation->size; i++) + { + printf("%"PRId64" -> %lf.\n", + vm_record->vcpus_utilisation->contents[i].key, + vm_record->vcpus_utilisation->contents[i].val); + } + + xen_uuid_bytes_free(vm_uuid_bytes); + xen_uuid_free(vm_uuid); + xen_vm_free(vm); + + xen_vm_record_free(vm_record); + + xen_host_free(host); + xen_string_string_map_free(versions); + + + xen_vm new_vm = create_new_vm(session); + if (!session->ok) + { + /* Error has been logged, just clean up. */ + CLEANUP; + return 1; + } + + print_vm_power_state(session, new_vm); + if (!session->ok) + { + /* Error has been logged, just clean up. */ + xen_vm_free(new_vm); + CLEANUP; + return 1; + } + + xen_vm_free(new_vm); + CLEANUP; + + return 0; +} + + +/** + * Creation of a new VM, using the Named Parameters idiom. Allocate the + * xen_vm_record here, but the sets through the library. Either + * allocation patterns can be used, as long as the allocation and free are + * paired correctly. + */ +static xen_vm create_new_vm(xen_session *session) +{ + xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1); + xen_vm_record vm_record = + { + .name_label = "NewHVM", + .name_description = "New HVM Description", + .user_version = 1, + .is_a_template = false, + .memory_static_max = 256, + .memory_dynamic_max = 256, + .memory_dynamic_min = 128, + .memory_static_min = 128, + .vcpus_policy = "credit", + .vcpus_params = vcpus_params, + .vcpus_number = 2, + .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY, + .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART, + .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE, + .hvm_boot = "cda", + }; + + + xen_vm vm; + xen_vm_create(session, &vm, &vm_record); + + if (!session->ok) + { + fprintf(stderr, "VM creation failed.\n"); + print_error(session); + return NULL; + } + + + /* + * Create a new disk for the new VM. + */ + xen_sr_set *srs; + if (!xen_sr_get_by_name_label(session, &srs, "Local") || + srs->size < 1) + { + fprintf(stderr, "SR lookup failed.\n"); + print_error(session); + xen_vm_free(vm); + return NULL; + } + + xen_sr_record_opt sr_record = + { + .u.handle = srs->contents[0] + }; + xen_vdi_record vdi0_record = + { + .name_label = "MyRootFS", + .name_description = "MyRootFS description", + .sr = &sr_record, + .virtual_size = (1 << 21), // 1GiB / 512 bytes/sector + .sector_size = 512, + .location = "file:/root/gentoo.amd64.hvm.img", + .type = XEN_VDI_TYPE_SYSTEM, + .sharable = false, + .read_only = false + }; + + xen_vdi vdi0; + if (!xen_vdi_create(session, &vdi0, &vdi0_record)) + { + fprintf(stderr, "VDI creation failed.\n"); + print_error(session); + + xen_sr_set_free(srs); + xen_vm_free(vm); + return NULL; + } + + + xen_vm_record_opt vm_record_opt = + { + .u.handle = vm + }; + xen_vdi_record_opt vdi0_record_opt = + { + .u.handle = vdi0 + }; + xen_vbd_record vbd0_record = + { + .vm = &vm_record_opt, + .vdi = &vdi0_record_opt, + .device = "xvda1", + .mode = XEN_VBD_MODE_RW + }; + + xen_vbd vbd0; + if (!xen_vbd_create(session, &vbd0, &vbd0_record)) + { + fprintf(stderr, "VBD creation failed.\n"); + print_error(session); + + xen_vdi_free(vdi0); + xen_sr_set_free(srs); + xen_vm_free(vm); + return NULL; + } + + char *vm_uuid; + char *vdi0_uuid; + char *vbd0_uuid; + + xen_vm_get_uuid(session, &vm_uuid, vm); + xen_vdi_get_uuid(session, &vdi0_uuid, vdi0); + xen_vbd_get_uuid(session, &vbd0_uuid, vbd0); + + if (!session->ok) + { + fprintf(stderr, "get_uuid call failed.\n"); + print_error(session); + + xen_uuid_free(vm_uuid); + xen_uuid_free(vdi0_uuid); + xen_uuid_free(vbd0_uuid); + xen_vbd_free(vbd0); + xen_vdi_free(vdi0); + xen_sr_set_free(srs); + xen_vm_free(vm); + return NULL; + } + + fprintf(stderr, + "Created a new VM, with UUID %s, VDI UUID %s, and VBD UUID %s.\n", + vm_uuid, vdi0_uuid, vbd0_uuid); + + xen_uuid_free(vm_uuid); + xen_uuid_free(vdi0_uuid); + xen_uuid_free(vbd0_uuid); + xen_vbd_free(vbd0); + xen_vdi_free(vdi0); + xen_sr_set_free(srs); + + return vm; +} + + +/** + * Print the power state for the given VM. + */ +static void print_vm_power_state(xen_session *session, xen_vm vm) +{ + char *vm_uuid; + enum xen_vm_power_state power_state; + + if (!xen_vm_get_uuid(session, &vm_uuid, vm)) + { + print_error(session); + return; + } + + if (!xen_vm_get_power_state(session, &power_state, vm)) + { + xen_uuid_free(vm_uuid); + print_error(session); + return; + } + + printf("VM %s power state is %s.\n", vm_uuid, + xen_vm_power_state_to_string(power_state)); + + xen_uuid_free(vm_uuid); +} diff -r b235a7acaf4a -r 9f83b07caabe tools/python/scripts/test_hvm_create.py --- a/tools/python/scripts/test_hvm_create.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/scripts/test_hvm_create.py Wed Jan 31 15:25:04 2007 +0000 @@ -13,16 +13,11 @@ vm_cfg = { 'VCPUs_policy': 'credit', - 'VCPUs_params': '', + 'VCPUs_params': {}, 'VCPUs_number': 2, - 'VCPUs_features_required': '', - 'VCPUs_features_can_use': '', - 'VCPUs_features_force_on': '', - 'VCPUs_features_force_off': '', 'actions_after_shutdown': 'destroy', 'actions_after_reboot': 'restart', - 'actions_after_suspend': 'destroy', 'actions_after_crash': 'destroy', 'PV_bootloader': '', @@ -44,7 +39,7 @@ local_vdi_cfg = { local_vdi_cfg = { 'name_label': 'gentoo.hvm', 'name_description': '', - 'uri': 'file:/root/gentoo.amd64.hvm.img', + 'location': 'file:/root/gentoo.amd64.hvm.img', 'virtual_size': 0, 'sector_size': 0, 'type': 'system', diff -r b235a7acaf4a -r 9f83b07caabe tools/python/scripts/test_vm_create.py --- a/tools/python/scripts/test_vm_create.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/scripts/test_vm_create.py Wed Jan 31 15:25:04 2007 +0000 @@ -15,14 +15,9 @@ vm_cfg = { 'VCPUs_policy': 'credit', 'VCPUs_params': '', 'VCPUs_number': 2, - 'VCPUs_features_required': '', - 'VCPUs_features_can_use': '', - 'VCPUs_features_force_on': '', - 'VCPUs_features_force_off': '', 'actions_after_shutdown': 'destroy', 'actions_after_reboot': 'restart', - 'actions_after_suspend': 'destroy', 'actions_after_crash': 'destroy', 'PV_bootloader': '', @@ -65,7 +60,7 @@ local_vdi_cfg = { local_vdi_cfg = { 'name_label': 'gentoo.amd64.img', 'name_description': '', - 'uri': 'file:/root/gentoo.amd64.img', + 'location': 'file:/root/gentoo.amd64.img', 'virtual_size': 0, 'sector_size': 0, 'type': 'system', @@ -183,13 +178,13 @@ def test_vm_create(): execute(server, 'VM.resume', (session, vm_uuid, False)) print 'Resumed VM.' + finally: # Wait for user to say we're good to shut it down while True: destroy = raw_input('destroy VM? ') if destroy[0] in ('y', 'Y'): break - - finally: + # Clean up if vif_uuid: execute(server, 'VIF.destroy', (session, vif_uuid)) diff -r b235a7acaf4a -r 9f83b07caabe tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/xen/xend/XendAPI.py Wed Jan 31 15:25:04 2007 +0000 @@ -1121,11 +1121,11 @@ class XendAPI(object): def VM_get_VCPUs_policy(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) - return dom.get_vcpus_policy() + return xen_api_success(dom.get_vcpus_policy()) def VM_get_VCPUs_params(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) - return xen_api_todo() # need access to scheduler + return xen_api_success(dom.get_vcpus_params()) def VM_get_actions_after_shutdown(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) @@ -1186,7 +1186,7 @@ class XendAPI(object): return xen_api_success(dom.get_platform_keymap()) def VM_get_other_config(self, session, vm_ref): - return self.VM_get('otherconfig', session, vm_ref) + return self.VM_get('other_config', session, vm_ref) def VM_get_is_control_domain(self, session, vm_ref): xd = XendDomain.instance() @@ -1363,7 +1363,7 @@ class XendAPI(object): 'platform_keymap': xeninfo.get_platform_keymap(), 'PCI_bus': xeninfo.get_pci_bus(), 'tools_version': xeninfo.get_tools_version(), - 'other_config': xeninfo.info.get('otherconfig'), + 'other_config': xeninfo.info.get('other_config', {}), 'is_control_domain': xeninfo == xendom.privilegedDomain(), } return xen_api_success(record) @@ -1469,7 +1469,7 @@ class XendAPI(object): vdi = XendNode.instance().get_vdi_by_uuid(vdi_ref) if not vdi: return xen_api_error(['VDI_HANDLE_INVALID', vdi_ref]) - vdi_image = vdi.get_image_uri() + vdi_image = vdi.get_location() vbd_ref = XendTask.log_progress(0, 100, dom.create_vbd, vbd_struct, vdi_image) diff -r b235a7acaf4a -r 9f83b07caabe tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/xen/xend/XendConfig.py Wed Jan 31 15:25:04 2007 +0000 @@ -905,7 +905,7 @@ class XendConfig(dict): # store as part of the device config. dev_uuid = sxp.child_value(config, 'uuid') dev_type, dev_cfg = self['devices'][dev_uuid] - is_bootable = dev_cfg.get('bootable', False) + is_bootable = dev_cfg.get('bootable', 0) config.append(['bootable', int(is_bootable)]) sxpr.append(['device', config]) @@ -978,7 +978,7 @@ class XendConfig(dict): pass if dev_type == 'vbd': - dev_info['bootable'] = False + dev_info['bootable'] = 0 if dev_info.get('dev', '').startswith('ioemu:'): dev_info['driver'] = 'ioemu' else: @@ -998,7 +998,7 @@ class XendConfig(dict): if dev_type == 'vbd' and not target[param]: # Compat hack -- this is the first disk, so mark it # bootable. - dev_info['bootable'] = True + dev_info['bootable'] = 1 target[param].append(dev_uuid) elif dev_type == 'tap': if 'vbd_refs' not in target: @@ -1007,7 +1007,7 @@ class XendConfig(dict): if not target['vbd_refs']: # Compat hack -- this is the first disk, so mark it # bootable. - dev_info['bootable'] = True + dev_info['bootable'] = 1 target['vbd_refs'].append(dev_uuid) elif dev_type == 'vfb': @@ -1070,8 +1070,8 @@ class XendConfig(dict): dev_info['uname'] = cfg_xenapi.get('image', '') dev_info['dev'] = '%s:%s' % (cfg_xenapi.get('device'), old_vbd_type) - dev_info['bootable'] = cfg_xenapi.get('bootable', False) - dev_info['driver'] = cfg_xenapi.get('driver') + dev_info['bootable'] = int(cfg_xenapi.get('bootable', 0)) + dev_info['driver'] = cfg_xenapi.get('driver', '') dev_info['VDI'] = cfg_xenapi.get('VDI', '') if cfg_xenapi.get('mode') == 'RW': @@ -1223,7 +1223,12 @@ class XendConfig(dict): "configuration dictionary.") sxpr.append(dev_type) - config = [(opt, val) for opt, val in dev_info.items()] + if dev_type in ('console', 'vfb'): + config = [(opt, val) for opt, val in dev_info.items() + if opt != 'other_config'] + else: + config = [(opt, val) for opt, val in dev_info.items()] + sxpr += config return sxpr diff -r b235a7acaf4a -r 9f83b07caabe tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Jan 31 15:25:04 2007 +0000 @@ -1976,7 +1976,11 @@ class XendDomainInfo: else: return 'unknown' def get_vcpus_params(self): - return '' # TODO + if self.getDomid() is None: + return {} + + retval = xc.sched_credit_domain_get(self.getDomid()) + return retval def get_power_state(self): return XEN_API_VM_POWER_STATE[self.state] def get_platform_std_vga(self): diff -r b235a7acaf4a -r 9f83b07caabe tools/python/xen/xend/XendVDI.py --- a/tools/python/xen/xend/XendVDI.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/xen/xend/XendVDI.py Wed Jan 31 15:25:04 2007 +0000 @@ -73,6 +73,7 @@ class XendVDI(AutoSaveObject): self.sharable = False self.read_only = False self.type = "system" + self.location = '' def load_config_dict(self, cfg): """Loads configuration into the object from a dict. @@ -147,9 +148,10 @@ class XendVDI(AutoSaveObject): 'sharable': False, 'readonly': False, 'SR': self.sr_uuid, + 'location': self.get_location(), 'VBDs': []} - def get_image_uri(self): + def get_location(self): raise NotImplementedError() @@ -163,9 +165,10 @@ class XendQCoWVDI(XendVDI): self.virtual_size = vsize self.sector_size = 512 self.auto_save = True + self.location = 'tap:qcow:%s' % self.qcow_path - def get_image_uri(self): - return 'tap:qcow:%s' % self.qcow_path + def get_location(self): + return self.location class XendLocalVDI(XendVDI): def __init__(self, vdi_struct): @@ -183,7 +186,7 @@ class XendLocalVDI(XendVDI): self.type = vdi_struct.get('type', '') self.sharable = vdi_struct.get('sharable', False) self.read_only = vdi_struct.get('read_only', False) - self.image_uri = vdi_struct.get('uri', 'file:/dev/null') + self.location = vdi_struct.get('location', 'file:/dev/null') - def get_image_uri(self): - return self.image_uri + def get_location(self): + return self.location diff -r b235a7acaf4a -r 9f83b07caabe tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed Jan 31 15:23:51 2007 +0000 +++ b/tools/python/xen/xend/image.py Wed Jan 31 15:25:04 2007 +0000 @@ -450,10 +450,10 @@ class HVMImageHandler(ImageHandler): vnc_config = {} has_vfb = False - has_vnc = int(vmConfig['image'].get('vnc')) != 0 + has_vnc = int(vmConfig['image'].get('vnc', 0)) != 0 for dev_uuid in vmConfig['console_refs']: - dev_type, dev_info = vmConfig['devices'][devuuid] - if dev_type == 'rfb': + dev_type, dev_info = vmConfig['devices'][dev_uuid] + if dev_type == 'vfb': vnc_config = dev_info.get('other_config', {}) has_vfb = True break _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |