Meta tags:
description= Open Virtualization;
Headings (most frequently used words):
hello, libvirt, the, qemu, guest, add, setup, of, for, create, command, support, api, your, recent, adam, litke, use, agent, with, memory, overcommitment, manager, host, what, is, ip, address, my, enable, python, bindings, virsh, remote, transport, implement, version, to, public, define, function, and, data, types, world, in, howto, testing, it, out, virtual, networks, own, network, modify, domains, posts, comments, archives, categories, meta,
Text of the page (most frequently used words):
the (326), src (110), null (87), and (84), qemu (81), this (76), libvirt (67), char (64), params (62), #command (60), return (58), for (57), name (52), hello (47), int (44), lang (43), static (43), remote (41), diff (40), git (40), index (40), mon (39), 100644 (38), domain (38), that (36), python (34), exclaim (34), response (34), const (33), api (32), will (31), you (30), your (30), function (30), monitor (30), dom (30), ret (30), guest (29), network (29), struct (28), with (27), driver (27), are (25), daemon (25), xdr (25), cmd (24), bool_t (24), string (23), qemumonitorptr (22), add (21), support (21), posted (20), domainhello (20), extern (20), next (19), args (19), virdomainhello (18), reply (18), remote_protocol (17), 2011 (16), commands (16), arguments (16), here (16), patch (16), qemudomainmonitorcommand (16), type (16), conn (16), create (15), agent (15), first (15), define (15), json (15), can (15), virdriver (15), domainsnapshotdelete (15), domainopenconsole (15), structure (15), generator (15), not (15), address (14), virsh (14), pointer (14), virhelloparams (14), host (14), virtual (14), use (13), new (13), our (13), virhelloparamsptr (13), mom (12), aglitke (12), one (12), types (12), qmp (12), when (12), should (12), server (12), xml (12), how (11), hmp (11), greeting (11), qdict (11), else (11), implementation (11), must (11), remote_driver (11), virdomainptr (11), call (11), make (11), cleanup (11), have (10), but (10), goto (10), from (10), typedef (10), using (10), remote_domain_hello_args (10), remote_domain_hello_ret (10), xdrs (10), comment (9), april (9), local (9), series (9), code (9), version (9), error (9), client (9), objp (9), adam (8), litke (8), uncategorized (8), need (8), howto (8), help (8), above (8), line (8), these (8), qemu_driver (8), entry (8), into (8), which (8), caller (8), qemu_monitor_text (8), file (8), qemu_monitor_json (8), qemu_monitor (8), remote_domain_hello_params (8), false (8), override (8), start (8), dhcp (8), serial (8), com (7), now (7), bindings (7), leave (7), data (7), handler (7), language (7), void (7), out (7), implement (7), part (7), used (7), post (7), point (7), protocol (7), build (7), sure (7), done (7), files (7), source (7), pyobject (7), pyobj (7), info (7), virdomainsnapshotptr (7), like (6), comments (6), process (6), number (6), more (6), say (6), english (6), returns (6), object (6), free (6), very (6), flags (6), parameters (6), value (6), then (6), include (6), let (6), about (6), functions (6), returned (6), there (6), work (6), find (6), just (6), qemureporterror (6), domains (6), priv (6), xdrproc_t (6), remote_domain_open_console_args (6), remote_procedure (6), attribute_unused (6), automatically (6), mac (6), 192 (6), 168 (6), 123 (6), virtio (6), channel (6), get (5), wordpress (5), what (5), enable (5), want (5), tools (5), found (5), through (5), both (5), spanish (5), via (5), all (5), where (5), resp (5), xen (5), enum (5), defines (5), pointers (5), _virhelloparams (5), step (5), passed (5), structures (5), down (5), some (5), uuid (5), generated (5), remote_dispatch_args (5), remote_dispatch_prototypes (5), qemud_server (5), remote_dispatch_ret (5), remote_dispatch_table (5), xdr_remote_domain_hello_args (5), xdr_remote_domain_hello_ret (5), rpc (5), following (5), ctl (5), c_retval (5), virdomainsnapshot (5), configuration (5), default (5), vms (5), addresses (5), started (4), log (4), copy (4), transport (4), manager (4), posts (4), due (4), actual (4), same (4), args_type (4), do_hello (4), optional (4), execute (4), result (4), qobject (4), implemented (4), its (4), world (4), list (4), simple (4), either (4), esx (4), esx_driver (4), lxc (4), lxc_driver (4), opennebula (4), one_driver (4), openvz (4), openvz_driver (4), phyp (4), phyp_driver (4), virnetworkdriver (4), test (4), test_driver (4), uml (4), uml_driver (4), vbox (4), vbox_tmpl (4), vmware (4), vmware_driver (4), xen_driver (4), unsigned (4), 166 (4), yet (4), top (4), level (4), once (4), each (4), follow (4), libvirt_public (4), syms (4), libvirt_0 (4), look (4), does (4), perform (4), only (4), reference (4), vir_free (4), own (4), obj (4), another (4), qemumonitorhello (4), xdr_remote_domain_hello_params (4), true (4), remote_string (4), remote_proc_domain_hello (4), etc (4), after (4), rerr (4), ret_str (4), virdomainfree (4), adding (4), format (4), change (4), modify (4), pyobj_params (4), meth_varargs (4), 255 (4), mynetwork (4), networks (4), tag (4), configure (4), services (4), required (3), kvm (3), memory (3), overcommitment (3), time (3), similar (3), synopsis (3), documentation (3), notice (3), select (3), note (3), argument (3), example (3), buf (3), size (3), cur_mon (3), printf (3), debugging (3), standard (3), cmdline (3), print (3), itself (3), virtualization (3), bit (3), set (3), text (3), results (3), may (3), specified (3), public (3), 7191 (3), qemudriver (3), 11202 (3), virdrvdomainhello (3), requires (3), finally (3), skip (3), being (3), think (3), parameter (3), show (3), valid (3), connection (3), virconnectptr (3), virlibdomainerror (3), __function__ (3), last (3), qemumonitortexthello (3), useful (3), order (3), because (3), freed (3), qemumonitorjsonmakecommand (3), qemumonitorjsonhello (3), virjsonvalueptr (3), wrapper (3), functionality (3), thing (3), locking (3), existing (3), examples (3), privatedata (3), uuidstr (3), provide (3), see (3), any (3), remote_error (3), remotedispatchdomainhello (3), qemud_client (3), 208 (3), xdr_remote_domain_open_console_args (3), xdr_remote_procedure (3), remote_proc_domain_migrate_set_max_speed (3), 207 (3), side (3), previously (3), place (3), specific (3), changes (3), provides (3), provided (3), made (3), net (3), opts_domhello (3), info_domhello (3), tutorial (3), dictionary (3), pyobj_domain (3), document (3), arg (3), tells (3), ssh (3), restart (3), machines (3), networking (3), config (3), nat (3), has (3), isa (3), port (3), site (2), write (2), view (2), content (2), sign (2), subscribed (2), subscribe (2), already (2), account (2), blog (2), feed (2), entries (2), june (2), august (2), hack (2), recent (2), older (2), task (2), also (2), did (2), quite (2), begin (2), block (2), declares (2), definition (2), specification (2), details (2), responses (2), eqmp (2), mhandler (2), cmd_new (2), containing (2), hola (2), mundo (2), quit (2), received (2), echoed (2), opaque (2), causes (2), shown (2), takes (2), human (2), most (2), something (2), interesting (2), parses (2), based (2), them (2), endif (2), monitor_print_hello (2), ret_data (2), strcmp (2), asprintf (2), qerror_report (2), helpful (2), 360 (2), qstring_get_str (2), contains (2), called (2), agl (2), ibm (2), stexi (2), etexi (2), walk (2), explain (2), every (2), 4675 (2), 2904 (2), virstatedriver (2), 832 (2), 1654 (2), 4055 (2), 40bb4c0 (2), qemudomainsnapshotdelete (2), qemudomainopenconsole (2), 87a68a6 (2), remotedomainsnapshotdelete (2), remoteqemudomainmonitorcommand (2), remotedomainopenconsole (2), network_driver (2), 5447 (2), 2249 (2), 8647 (2), 1007 (2), 2141 (2), 515 (2), virstreamptr (2), _virdriver (2), tell (2), compile (2), fix (2), later (2), 569f4a8 (2), 100755 (2), def (2), functions_failed (2), functions_skipped (2), virconnectlistdomains (2), skipped_modules (2), 180 (2), 181 (2), skipped_types (2), virconnectdomaineventioerrorcallback (2), virconnectdomaineventgraphicscallback (2), vireventaddhandlefunc (2), 2507 (2), defined (2), including (2), issuing (2), convention (2), could (2), integer (2), symbols (2), script (2), section (2), corresponding (2), available (2), 434 (2), mostly (2), checks (2), allowed (2), dispatches (2), 13355 (2), virdispatcherror (2), vir_err_invalid_arg (2), program (2), two (2), check (2), errors (2), successful (2), contain (2), further (2), don (2), duplicate (2), case (2), qemumonitorhmpcommand (2), 2607 (2), virasprintf (2), failed (2), qemumonitortextarbitrarycommand (2), 195 (2), monitors (2), objects (2), going (2), careful (2), virjsonvalueobjectget (2), 2470 (2), vir_err_internal_error (2), virjsonvaluefree (2), qemumonitorjsonarbitrarycommand (2), cmd_str (2), reply_str (2), 199 (2), supports (2), active (2), 2189 (2), qemumonitordeletesnapshot (2), qemumonitorarbitrarycommand (2), 418 (2), many (2), right (2), job (2), context (2), other (2), 7079 (2), qemudomainhello (2), running (2), actually (2), rest (2), auto (2), therefore (2), rpcgen (2), 176 (2), 338 (2), err (2), remote_message_header (2), hdr (2), 140 (2), 1042 (2), args_filter (2), ret_filter (2), 3872 (2), xdr_remote_string (2), 2184 (2), remote_nonnull_domain (2), remote_proc_domain_set_blkio_parameters (2), 205 (2), remote_proc_domain_get_blkio_parameters (2), 206 (2), xdr_remote_domain_snapshot_current_ret (2), xdr_remote_domain_revert_to_snapshot_args (2), xdr_remote_domain_snapshot_delete_args (2), xdr_remote_message_type (2), xdr_remote_message_status (2), taken (2), prepared (2), encoded (2), helper (2), their (2), unpack (2), 9632 (2), remotedomainhello (2), passes (2), allocate (2), behalf (2), packed (2), calls (2), regardless (2), success (2), 6995 (2), remotedispatchconnerror (2), figure (2), wire (2), explicit (2), enough (2), 1926 (2), sets (2), manually (2), stubs (2), several (2), doesn (2), come (2), familiar (2), much (2), always (2), uses (2), looking (2), testing (2), present (2), message (2), displayed (2), cmddomhello (2), autostart (2), vshcmdinfo (2), 3987 (2), vsh_ot_data (2), end (2), seem (2), well (2), today (2), supply (2), keys (2), 2350 (2), libvirt_virdomaingetjobinfo (2), self (2), libvirt_virdomainhello (2), pydict_getitemstring (2), virdomainreverttosnapshot (2), 308 (2), hand (2), read (2), lines (2), able (2), map (2), reconfigure (2), were (2), dns (2), allows (2), reserve (2), localdomain (2), produce (2), bridge (2), access (2), internet (2), addressing (2), 254 (2), possible (2), subnet (2), customize (2), hostname (2), range (2), connectivity (2), boot (2), solution (2), ready (2), guests (2), statistics (2), binary (2), download (2), setup (2), channels (2), unix (2), mode (2), bind (2), path (2), var (2), lib (2), sock (2), target (2), collectors (2), remove (2), hardware (2), open (2), design, website, email, loading, collapse, bar, manage, subscriptions, reader, report, privacy, meta, categories, february, march, archives, henrik, uggla, cooldharma06, search, continue, reading, developer, inevitably, usable, such, virt, daunting, abstraction, layers, guide, supporting, fictitious, concludes, walkthrough, installment, extending, specifies, good, df40a3d, e60aec8, refer, sqmp, greet, enthusiasm, bool, defaults, debug, statememt, 5024, 5068, monitor_control_read, uint8_t, json_message_parser_feed, parser, old_mon, 4396, 4438, handle_user_command, qdict_new, got, monitor_parse_command, emits, readable, related, simply, builds, 1004, 1005, do_info_trace_events, qobject_to_qdict, qdict_haskey, monitor_printf, qdict_get_str, sample, qdict_get_try_bool, qdict_get_try_str, qerr_invalid_parameter, qerr_undefined_error, qobject_from_jsonf, do_quit, execution, included, convenience, echo, interactions, 7fc311d, 957ea01, monitor_json_emitter, qstring_append_chr, monitor_puts, qdecref, hmp_commands, declarations, commit, 468da14f29552f415413864ea848310c9ad6efe9, author, date, thu, apr, 0500, signed, off, 372bef4, dd2ad7d, user_print, item, findex, ommitted, punctuated, exclamation, marks, shows, merely, printing, punctuation, requested, looks, second, tedious, initialization, placeholder, deda372, 28cc0e4, esxdriver, esxdomainsnapshotdelete, 3159e1b, 1b3408f, lxcdriver, lxcdomainopenconsole, lxcstatedriver, 3146589, 6e1867f, onedriver, onestatedriver, fb30c37, 0b9c270, openvzdriver, openvzregister, 51f9ff6, dcb848e, phypdriver, qemumonitorcommand, virstoragedriver, phypstoragedriver, af897ad, b05bbcb, 17f5ad9, 57edda0, testdriver, testnetworkdriver, 5514487, 99d2f7a, umldriver, umldomainopenconsole, 8bd27dd, f532923, vboxdomainsnapshotdelete, networkdriver, b5e416b, 3c14fbb, vmwaredriver, bf422e6, ff2b172, xenunifieddriver, xenunifieddomainopenconsole, 286130a, b2fc0e5, 639, 641, virdrvdomainsnapshotdelete, virdrvqemudomainmonitorcommand, virdrvdomainopenconsole, ignore, 4fa4f65, wrap, coding, style, typedefs, 1cf9273, 9fe724f, virdomainopenconsole, ifdef, __cplusplus, breaks, compilation, fail, telling, individual, hypervisors, register, statically, initialized, hypervisor, updates, drivers, field, designing, establish, calling, conventions, interacts, instance, individually, chose, pass, handled, third, declared, release, symbol, became, 5caab4c, 379ee6c, vireventrundefaultimpl, global, predicted, lot, boiler, plate, obvious, problems, they, associated, operation, suitable, e46c18b, 774ab3c, pleasant, vir_domain_debug, virresetlasterror, vir_is_connected_domain, vir_err_invalid_domain, vir_err_no_support, although, basic, sanity, checking, real, visible, updating, fourth, least, hopefully, day, parsing, why, allocates, transfers, control, thus, safe, directly, 75b2995, 452c43f, virreportoomerror, vir_err_operation_failed, 0838a2b, 6c5f4f2, qemumonitortextcreatesnapshot, qemumonitortextloadsnapshot, qemumonitortextdeletesnapshot, manipulating, proper, send, receive, family, extract, returning, supposed, transfer, ownership, eventually, longer, needed, 6bd03d6, 5f18cfa, qemumonitorjsoncommand, qemumonitorjsoncheckerror, vir_json_type_object, virjsonvalueobjectgetstring, malformed, freeing, below, strdup, 086f0e1, e0cf5bd, qemumonitorjsoncreatesnapshot, qemumonitorjsonloadsnapshot, qemumonitorjsondeletesnapshot, around, protocols, selects, appropriate, depending, 800f744, 46b89ae, vir_debug, c90219b, c1ecd10, qemumonitorcreatesnapshot, qemumonitorloadsnapshot, performing, lookup, rules, issue, enter, form, executed, synchronously, again, correct, usage, de6c719, qemud_driver, virdomainobjptr, qemudriverlock, virdomainfindbyuuid, qemudriverunlock, vir_uuid_string_buflen, viruuidformat, vir_err_no_domain, matching, qemudomainobjbeginjob, virdomainobjisactive, qemudomainobjprivateptr, qemudomainobjentermonitor, qemudomainobjexitmonitor, vir_err_operation_invalid, qemudomainobjendjob, virdomainobjunlock, vir_drv_qemu, 7235, begins, fun, interact, locates, targetting, issues, fifth, discuss, 15fa1a0, cb6091a, remote_domain_set_blkio_parameters_args, val_remote_domain_set_blkio_parameters_args, remote_domain_get_blkio_parameters_args, val_remote_domain_get_blkio_parameters_args, remote_domain_migrate_set_max_speed_args, val_remote_domain_migrate_set_max_speed_args, val_remote_domain_hello_args, 3fcf87c, 5f2264f, remotedispatchdomainhasmanagedsaveimage, remote_domain_has_managed_save_image_args, remote_domain_has_managed_save_image_ret, remotedispatchdomaininterfacestats, 114e832, cdc9c89, remote_domain_is_updated_ret, val_remote_domain_is_updated_ret, remote_get_sysinfo_ret, val_remote_get_sysinfo_ret, remote_domain_get_blkio_parameters_ret, val_remote_domain_get_blkio_parameters_ret, val_remote_domain_hello_ret, c5f6653, fb2c074, xdr_remote_domain_migrate_set_max_speed_args, xdr_void, dispatch_fn, 7ecea9d, ba31d50, xdr_int, xdr_remote_nonnull_domain, 87de0da, 318fa34, u_int, remote_program, 0x20008086, remote_protocol_version, 2395, 2412, 2776, 2794, remote_domain_snap, remote_domain_revert_to_snapshot_args, remote_domain_snapshot_delete_args, remote_message_type, remote_message_status, 3131, 3152, organized, followed, handle, care, stated, character, refers, along, wih, clean, 75c655a, private_data, remotedriverlock, make_nonnull_domain, memset, sizeof, frees, remotedriverunlock, 11229, convert, confusing, lack, strings, explains, strange, way, accessing, likewise, implements, runs, within, representing, store, indicate, failure, libvirtd, d49e0d8, 9be77ad, remotedispatchdomaineventsderegisterany, attribute_u, get_nonnull_domain, vir_alloc, remotedispatchoomerror, remotedispatchnwfilterlookupbyname, defining, definitions, strict, express, various, 7310689, 54346cd, procedure, numbers, 2159, 2173, remote_proc_domain_set_memory_flags, 204, grouped, onward, upward, necessary, three, others, during, submitting, patches, additional, regarding, generation, regenerate, whenever, tree, generate, additionally, unadultered, great, ability, hosts, easily, system, installed, course, feature, transmit, over, would, regard, difficult, unless, even, operations, sixth, starts, validity, extracted, built, vshcontrol, vshcmd, vshconnectionusability, vshcommandoptdomain, vshcommandoptbool, vshcommandoptstring, vshprint, info_network_autostart, 10504, 10557, vshcmddef, dommonitoringcmds, dommemstat, cmddommemstat, opts_dommemstat, info_dommemstat, domstate, cmddomstate, opts_domstate, info_domstate, cmdlist, opts_list, info_list, domhello, options, option, whether, 50ca50f, 254a2bd, desc, demonstration, nothing, vshcmdoptdef, vsh_oflag_req, gettext_noop, vsh_ot_bool, excited, vsh_oflag_none, desired, phew, getting, near, contrast, easy, metadata, makes, outputs, user, seventh, thanks, welcome, anything, especially, opinion, hasn, room, simplification, lies, meat, exercise, according, oft, repeated, formula, package, representation, supplied, boolean, 4a9b432, 20df116, py_retval, pyarg_parsetuple, pyvirdomain_get, pyint_as_long, pystring_asstring, vir_py_none, pystring_fromstring, avoid, importing, modules, 3585, 3621, pymethoddef, libvirtmethods, virdomaingetjobinfo, virdomainsnapshotlistnames, libvirt_virdomainsnapshotlistnames, libvirt_virdomainreverttosnapshot, 54deeb5, 4d1ea7d, curently, unused, hallo, str, coded, 343, 342, skip_impl, virnodedevicelistcaps, virconnectbaselinecpu, treat, 257, py_types, py_return_types, undo, fixes, removing, anymore, 5b830bc, while, tricky, documented, learn, eighth, final, efforts, bear, fruit, enjoy, remember, matches, making, shut, decided, inside, custom, created, save, symlink, typed, carefully, indicating, was, successfully, immediately, per, assignments, identify, agree, named, handy, recommend, appended, fully, qualified, since, device, choose, virbr0, reserved, things, gateway, router, beginning, conflict, enables, gives, opportunity, assignment, assign, virbr1, forward, netmask, describe, concept, among, lan, translation, tftp, bootp, creating, interface, ideal, problem, article, works, pretty, box, connected, outbound, itch, needs, scratching, answer, attained, connecting, vnc, logging, ifconfig, output, ips, elegant, assuming, gone, messages, guestmonitor, appear, usual, distribution, recommendations, guestd, autostarting, supported, versions, rc0, 413, g957f1f9, replace, redefine, ensure, take, effect, require, collector, connect, whichever, specifying, standardized, underlying, org, guest_agent, controller, bus, stanza, devices, communication, guestqemuagent, guestnetworkdaemon, setting, conf, latest, install, github, update, configuring, involves, few, steps, fast, secure, names, collection, key, advantages, official, programs, talk, emulated, mechanism, reliably, power, filesystem, snapshotting, information, home,
Text of the page (random words):
sion of hello posted on april 15 2011 by aglitke this is the fifth post in the series howto add libvirt support for a qemu command now begins the fun part where we can actually interact with qemu to implement the command in this patch we first create a virdrvdomainhello function in the qemu driver this function locates the domain we are targetting issues a monitor command and returns the result we provide support for issuing the command using the qmp and hmp monitors find the patch here diff git a src qemu qemu_driver c b src qemu qemu_driver c index 40bb4c0 de6c719 100644 a src qemu qemu_driver c b src qemu qemu_driver c 7079 6 7079 50 cleanup return ret static char qemudomainhello virdomainptr dom virhelloparamsptr params struct qemud_driver driver dom conn privatedata virdomainobjptr vm null char greeting null qemudriverlock driver vm virdomainfindbyuuid driver domains dom uuid qemudriverunlock driver if vm char uuidstr vir_uuid_string_buflen viruuidformat dom uuid uuidstr qemureporterror vir_err_no_domain _ no domain with matching uuid s uuidstr goto cleanup if qemudomainobjbeginjob vm 0 goto cleanup if virdomainobjisactive vm qemudomainobjprivateptr priv vm privatedata qemudomainobjentermonitor vm greeting qemumonitorhello priv mon params if greeting qemureporterror vir_err_internal_error s _ monitor command failed qemudomainobjexitmonitor vm else qemureporterror vir_err_operation_invalid s _ domain is not running if qemudomainobjendjob vm 0 vm null cleanup if vm virdomainobjunlock vm return greeting static virdriver qemudriver vir_drv_qemu 7191 7 7235 7 static virdriver qemudriver qemudomainsnapshotdelete domainsnapshotdelete qemudomainmonitorcommand qemudomainmonitorcommand qemudomainopenconsole domainopenconsole null domainhello qemudomainhello domainhello above is the top level implementation for the qemu driver the first thing we do is find the vm object corresponding to the domain passed in by performing a uuid lookup be careful to follow driver locking rules just follow the many existing examples in order to get this right in order to issue commands to a qemu monitor you must enter a job context this is another form of locking to make sure that commands are executed synchronously again look to other commands for examples of correct usage once in job context we call into the monitor code to perform the monitor command let s look at that part next diff git a src qemu qemu_monitor c b src qemu qemu_monitor c index 800f744 46b89ae 100644 a src qemu qemu_monitor c b src qemu qemu_monitor c 2189 6 2189 24 int qemumonitordeletesnapshot qemumonitorptr mon const char name return ret char qemumonitorhello qemumonitorptr mon virhelloparams params char ret vir_debug mon p params p mon params if mon qemureporterror vir_err_invalid_arg s _ monitor must not be null return null if mon json ret qemumonitorjsonhello mon params else ret qemumonitortexthello mon params return ret int qemumonitorarbitrarycommand qemumonitorptr mon const char cmd char reply diff git a src qemu qemu_monitor h b src qemu qemu_monitor h index c90219b c1ecd10 100644 a src qemu qemu_monitor h b src qemu qemu_monitor h 418 6 418 8 int qemumonitorcreatesnapshot qemumonitorptr mon const char name int qemumonitorloadsnapshot qemumonitorptr mon const char name int qemumonitordeletesnapshot qemumonitorptr mon const char name char qemumonitorhello qemumonitorptr mon virhelloparams params int qemumonitorarbitrarycommand qemumonitorptr mon const char cmd char reply the function qemumonitorhello is yet another wrapper around actual functionality libvirt supports the qmp and hmp monitor protocols this function selects the appropriate function depending on the protocol being used by the active monitor diff git a src qemu qemu_monitor_json c b src qemu qemu_monitor_json c index 6bd03d6 5f18cfa 100644 a src qemu qemu_monitor_json c b src qemu qemu_monitor_json c 2470 6 2470 49 cleanup return ret char qemumonitorjsonhello qemumonitorptr mon virhelloparams params const char response char ret null virjsonvalueptr cmd virjsonvalueptr reply null virjsonvalueptr obj if params lang null cmd qemumonitorjsonmakecommand hello b exclaim params exclaim 0 null else cmd qemumonitorjsonmakecommand hello b exclaim params exclaim 0 s lang params lang null if cmd return null if qemumonitorjsoncommand mon cmd reply 0 qemumonitorjsoncheckerror cmd reply 0 goto cleanup if obj virjsonvalueobjectget reply return obj type vir_json_type_object goto cleanup response virjsonvalueobjectgetstring obj response if response null qemureporterror vir_err_internal_error s _ malformed response to hello command goto cleanup return a copy because we will be freeing reply below ret strdup response cleanup virjsonvaluefree cmd virjsonvaluefree reply return ret int qemumonitorjsonarbitrarycommand qemumonitorptr mon const char cmd_str char reply_str diff git a src qemu qemu_monitor_json h b src qemu qemu_monitor_json h index 086f0e1 e0cf5bd 100644 a src qemu qemu_monitor_json h b src qemu qemu_monitor_json h 199 6 199 8 int qemumonitorjsoncreatesnapshot qemumonitorptr mon const char name int qemumonitorjsonloadsnapshot qemumonitorptr mon const char name int qemumonitorjsondeletesnapshot qemumonitorptr mon const char name char qemumonitorjsonhello qemumonitorptr mon virhelloparams params int qemumonitorjsonarbitrarycommand qemumonitorptr mon const char cmd_str char reply_str next implement the json version of the hello command for qmp monitors this file contains very useful functions for manipulating json objects qemumonitorjsonmakecommand is used to build the proper json command string next we send the command receive the response and check for errors we then use the virjsonvalueobjectget family of functions to extract the returned string from the response be careful when returning pointers and be sure to think about how the api is supposed to work we want to return a new string to the caller and transfer ownership of that string to the caller in order to do this we must make a copy because the json response is going to be freed next the string we return will eventually be freed by the caller when it is no longer needed diff git a src qemu qemu_monitor_text c b src qemu qemu_monitor_text c index 75b2995 452c43f 100644 a src qemu qemu_monitor_text c b src qemu qemu_monitor_text c 2607 6 2607 36 cleanup return ret char qemumonitortexthello qemumonitorptr mon virhelloparams params char cmd char reply null int rc if params exclaim 0 rc virasprintf cmd hello e s params lang params lang else rc virasprintf cmd hello s params lang params lang if rc 1 virreportoomerror return null if qemumonitorhmpcommand mon cmd reply qemureporterror vir_err_operation_failed _ failed to perform command s cmd vir_free reply vir_free cmd we own the reference to reply return it and let the caller free it return reply int qemumonitortextarbitrarycommand qemumonitorptr mon const char cmd char reply diff git a src qemu qemu_monitor_text h b src qemu qemu_monitor_text h index 0838a2b 6c5f4f2 100644 a src qemu qemu_monitor_text h b src qemu qemu_monitor_text h 195 6 195 8 int qemumonitortextcreatesnapshot qemumonitorptr mon const char name int qemumonitortextloadsnapshot qemumonitorptr mon const char name int qemumonitortextdeletesnapshot qemumonitorptr mon const char name char qemumonitortexthello qemumonitorptr mon virhelloparams params int qemumonitortextarbitrarycommand qemumonitorptr mon const char cmd char reply last but not least we have the hmp implementation of the command hopefully some day we will only need to program one monitor protocol but for now there are two first build a command string based on the parameters then execute the command and check for errors if successful reply will contain the hmp reply no further parsing of this string is required so we just return it why don t we duplicate the string as we did for the json monitor implementation in this case qemumonitorhmpcommand allocates the reply string and transfers control of the reference to its caller thus it is safe to return the pointer directly and let the caller free it up next add hello remote transport support posted in uncategorized leave a comment add hello to the public libvirt api posted on april 14 2011 by aglitke this is the fourth post in the series howto add libvirt support for a qemu command although we have defined a top level libvirt api as yet there is no entry point implemented in this patch we create the entry point which does some basic sanity checking and dispatches the call down to a driver to perform the real work make this entry point visible by updating the libvirt so version script find the patch here diff git a src libvirt c b src libvirt c index e46c18b 774ab3c 100644 a src libvirt c b src libvirt c 13355 3 13355 46 error virdispatcherror conn return 1 virdomainhello dom pointer to the domain object params pointer to a virhelloparams object returns a pleasant greeting char virdomainhello virdomainptr dom virhelloparamsptr params virconnectptr conn char ret null vir_domain_debug dom params p params if params null virlibdomainerror vir_err_invalid_arg __function__ goto error virresetlasterror if vir_is_connected_domain dom virlibdomainerror vir_err_invalid_domain __function__ goto error conn dom conn if conn driver domainhello ret conn driver domainhello dom params if ret null goto error return ret else virlibdomainerror vir_err_no_support __function__ error virdispatcherror dom conn return null shown above is the entry point if you look at src libvirt c you will notice a lot of functions that look similar to this one this is mostly boiler plate code that checks for obvious problems with parameters like null pointers where they are not allowed checks for a valid connection and valid domain and dispatches the call down to the driver associated with this connection if the driver does not support the operation a suitable error is returned diff git a src libvirt_public syms b src libvirt_public syms index 5caab4c 379ee6c 100644 a src libvirt_public syms b src libvirt_public syms 434 4 434 9 libvirt_0 9 0 vireventrundefaultimpl libvirt_0 8 8 libvirt_0 8 7 global virdomainhello libvirt_0 8 6 define new api here using predicted next version number all public symbols in libvirt must be declared in the version script in the section corresponding to the release in which the symbol first became available up next implement the qemu version of hello posted in uncategorized 1 comment define hello api function and data types posted on april 13 2011 by aglitke this is the third post in the series howto add libvirt support for a qemu command when designing an api for libvirt the first step is to think about how your api will be used and establish its calling conventions our new api interacts with a domain by issuing a monitor command so we will follow libvirt convention and name it virdomainhello the hello qemu monitor command returns a string so let s do the same in libvirt the first parameter should be a pointer to the domain qemu instance the exclaim and language parameters could be passed individually as an integer and string i chose to pass them in a structure to show how structures are handled by libvirt once the api is defined we add an entry into the driver structure so that individual hypervisors including qemu can register an implementation of it the driver structure is statically initialized by each hypervisor driver so this patch updates all drivers to set the new field to null finally virdomainhello breaks the python bindings generator and causes compilation to fail we can fix this by telling the generator to skip our function for the time being let s walk through the patch diff git a include libvirt libvirt h in b include libvirt libvirt h in index 1cf9273 9fe724f 100644 a include libvirt libvirt h in b include libvirt libvirt h in 2507 6 2507 15 int virdomainopenconsole virdomainptr dom virstreamptr st unsigned int flags typedef struct _virhelloparams virhelloparams struct _virhelloparams char lang int exclaim typedef virhelloparams virhelloparamsptr char virdomainhello virdomainptr dom virhelloparamsptr params ifdef __cplusplus endif this first part of the patch defines the top level data types we create a new structure type virhelloparams to wrap the arguments libvirt coding style requires typedefs for the structure and structure pointers then we define the api function itself it takes a domain pointer and a pointer to our new parameters structure as arguments and returns a string diff git a python generator py b python generator py index 4fa4f65 569f4a8 100755 a python generator py b python generator py 166 6 166 7 def enum type name value functions_failed functions_skipped virconnectlistdomains virdomainhello skipped_modules 180 6 181 7 skipped_types virconnectdomaineventioerrorcallback no function types in python virconnectdomaineventgraphicscallback no function types in python vireventaddhandlefunc no function types in python virhelloparamsptr not implemented yet here we tell the python api generator to ignore our function and parameters structure this is a compile fix we ll implement the python bindings in a later patch diff git a src driver h b src driver h index 286130a b2fc0e5 100644 a src driver h b src driver h 515 6 515 8 typedef int virstreamptr st unsigned int flags typedef char virdrvdomainhello virdomainptr dom virhelloparamsptr params _virdriver 639 6 641 7 struct _virdriver virdrvdomainsnapshotdelete domainsnapshotdelete virdrvqemudomainmonitorcommand qemudomainmonitorcommand virdrvdomainopenconsole domainopenconsole virdrvdomainhello domainhello typedef int add our new api to the driver structure diff git a src esx esx_driver c b src esx esx_driver c index deda372 28cc0e4 100644 a src esx esx_driver c b src esx esx_driver c 4675 6 4675 7 static virdriver esxdriver esxdomainsnapshotdelete domainsnapshotdelete null qemudomainmonitorcommand null domainopenconsole null domainhello diff git a src lxc lxc_driver c b src lxc lxc_driver c index 3159e1b 1b3408f 100644 a src lxc lxc_driver c b src lxc lxc_driver c 2904 6 2904 7 static virdriver lxcdriver null domainsnapshotdelete null qemudomainmonitorcommand lxcdomainopenconsole domainopenconsole null domainhello static virstatedriver lxcstatedriver diff git a src opennebula one_driver c b src opennebula one_driver c index 3146589 6e1867f 100644 a src opennebula one_driver c b src opennebula one_driver c 832 6 832 7 static virdriver onedriver null domainsnapshotdelete null qemudomainmonitorcommand null domainopenconsole null domainhello static virstatedriver onestatedriver diff git a src openvz openvz_driver c b src openvz openvz_driver c index fb30c37 0b9c270 100644 a src openvz openvz_driver c b src openvz openvz_driver c 1654 6 1654 7 static virdriver openvzdriver null domainsnapshotdelete null qemudomainmonitorcommand null domainopenconsole null domainhello int openvzregister void diff git a src phyp phyp_driver c b src phyp phyp_driver c index 51f9ff6 dcb848e 10064...
|