Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 827681 Details for
Bug 1033540
Guest call trace after hotplug 60 vcpus then reboot guest
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
hotplug vcpu script
hotplugnic.py (text/x-python), 4.27 KB, created by
langfang
on 2013-11-22 10:51:56 UTC
(
hide
)
Description:
hotplug vcpu script
Filename:
MIME Type:
Creator:
langfang
Created:
2013-11-22 10:51:56 UTC
Size:
4.27 KB
patch
obsolete
># QEMU Monitor Protocol Python class ># ># Copyright (C) 2009 Red Hat Inc. ># ># Authors: ># Luiz Capitulino <lcapitulino@redhat.com> ># ># Change Log: ># Yang Feng <fyang@redhat.com> ># Add support for tcp protocol. ># Add read() function. ># ># ># This work is licensed under the terms of the GNU GPL, version 2. See ># the COPYING file in the top-level directory. > >import socket, json, time, commands >from optparse import OptionParser > >class QMPError(Exception): > pass > >class QMPConnectError(QMPError): > pass > >class QEMUMonitorProtocol: > def connect(self): > self.sock.connect(self.filename) > data = self.__json_read() > if data == None: > raise QMPConnectError > if not data.has_key('QMP'): > raise QMPConnectError > return data['QMP']['capabilities'] > > def close(self): > self.sock.close() > > def send_raw(self, line): > self.sock.send(str(line)) > return self.__json_read() > > def send(self, cmdline, timeout=30): > end_time = time.time() + timeout > cmd = self.__build_cmd(cmdline) > print cmd > self.__json_send(cmd) > while time.time() < end_time: > resp = self.__json_read() > if resp == None: > return (False, None) > elif resp.has_key('error'): > return (False, resp['error']) > elif resp.has_key('return'): > return (True, resp['return']) > > > def read(self, timeout=30): > o = "" > end_time = time.time() + timeout > while time.time() < end_time: > try: > o += self.sock.recv(1024) > if len(o) > 0: > break > except: > time.sleep(0.01) > if len(o) > 0: > return json.loads(o) > else: > return None > > def __build_cmd(self, cmdline): > cmdargs = cmdline.split() > qmpcmd = { 'execute': cmdargs[0], 'arguments': {} } > for arg in cmdargs[1:]: > opt = arg.split('=') > try: > value = int(opt[1]) > except ValueError: > value = opt[1] > qmpcmd['arguments'][opt[0]] = value > return qmpcmd > > def __json_send(self, cmd): > # XXX: We have to send any additional char, otherwise > # the Server won't read our input > self.sock.send(json.dumps(cmd) + ' ') > > def __json_read(self): > try: > return json.loads(self.sock.recv(1024)) > except ValueError: > return > > def __init__(self, filename, protocol="tcp"): > if protocol == "tcp": > self.filename = ("localhost", int(filename)) > self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > elif protocol == "unix": > self.filename = filename > print self.filename > self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) > #self.sock.setblocking(0) > self.sock.settimeout(5) > >if __name__ == "__main__": > parser = OptionParser() > parser.add_option('-n', '--num', dest='num', default='10', help='Times want to try') > parser.add_option('-f', '--file', dest='port', default='8000', help='QMP port/filename') > parser.add_option('-p', '--protocol', dest='protocol',default='tcp', help='QMP protocol') > def usage(): > parser.print_help() > sys.exit(1) > > options, args = parser.parse_args() > > print options > if len(args) > 0: > usage() > > num = int(options.num) > qmp_filename = options.port > qmp_protocol = options.protocol > qmp_socket = QEMUMonitorProtocol(qmp_filename,qmp_protocol) > qmp_socket.connect() > qmp_socket.send("qmp_capabilities") > for i in range(num): > #cmd = "device_add driver=pci-assign host=09:10.0 id=hostnet1" > #qmp_socket.send("__com.redhat_drive_add file=/usr/tools/rhel6-2.raw format=raw id=disk300") > #cmd = "device_add driver=pci-assign host=09:10.1 id=hostnet2" > #qmp_socket.send("device_add driver=virtio-net-pci id=nic300") > # qmp_socket.send("cpu-add id=1") > qmp_socket.send("cpu-add id=%s" %i) > time.sleep(2) > #cmd = "device_del id=hostnet1" > #qmp_socket.send("device_del id=nic300") > #cmd = "netdev_del id=hostnet2" > #qmp_socket.send("device_del id=disk300") > time.sleep(2) > qmp_socket.close() >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1033540
: 827681 |
827682