Mercurial > hg > Applications > virsh-wrapper
changeset 44:546504699402
Generate xml which enabled kernel debug. but needs reload in virsh
author | atton |
---|---|
date | Wed, 13 Jan 2016 21:15:15 +0900 |
parents | 3eb0b5edad30 |
children | 7f6c5d7355bc |
files | ie-virsh.c newvm.py |
diffstat | 2 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ie-virsh.c Wed Jan 13 20:33:55 2016 +0900 +++ b/ie-virsh.c Wed Jan 13 21:15:15 2016 +0900 @@ -232,7 +232,7 @@ } void -create_new_vm(const char const *name, const char const *vm_name, char* xml_name, int debug_kernel){ +create_new_vm(const char const *name, const char const *vm_name, char* xml_name, bool debug_kernel){ if (check_name(name)) { fprintf(stderr, bad_name); exit(0); @@ -242,7 +242,7 @@ change_delimiter_to_slash(vm_path); char exec[1024]; if (debug_kernel) { - snprintf(exec, 1024, "%s %s -d", newvm_command, vm_path); + snprintf(exec, 1024, "%s %s -d true", newvm_command, vm_path); } else { snprintf(exec, 1024, "%s %s", newvm_command, vm_path); } @@ -331,7 +331,7 @@ if (execl(command, command, console_command, vm_name, NULL) < 0) { perror("Execl:"); } - } else if (strncmp(argv[1], define_command, 6) == 0 ) { + } else if (strcmp(argv[1], define_command) == 0 ) { if (argc<3) {usage(); exit(1);} char xml_name[1024]; xml_name[0] = 0;
--- a/newvm.py Wed Jan 13 20:33:55 2016 +0900 +++ b/newvm.py Wed Jan 13 21:15:15 2016 +0900 @@ -120,11 +120,12 @@ disk.attrib['file'] = disk_image if (options.debug): # http://wiki.libvirt.org/page/QEMUSwitchToLibvirt - domain_attr = config.getroot().attrib - domain_attr['xmlns:qemu'] = "'http://libvirt.org/schemas/domain/qemu/1.0'" - qemu_elem = ET.Element('qemu:commandline') - ET.SubElement(qemu_elem, 'qemu', {'value' => '-S'}) - ET.SubElement(qemu_elem, 'qemu', {'value' => ('-s %d' % gen_debug_port())}) + domain = config.getroot() + domain.attrib['xmlns:qemu'] = "'http://libvirt.org/schemas/domain/qemu/1.0'" + qemu_elem = ET.Element('qemu:commandline') + ET.SubElement(qemu_elem, 'qemu', {'value' : '-S'}) + ET.SubElement(qemu_elem, 'qemu', {'value' : ('-s %d' % gen_debug_port())}) + domain.append(qemu_elem) if os.path.exists(vm_name + '.xml'): print "File %s.xml exists, abort" % vm_name