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):
name domain type virdomainptr info pointer to the domain arg name params type virhelloparamsptr info a dictionary of parameters return type str info a greeting from the domain function symbols api manually document the api diff git a python libvirt override c b python libvirt override c index 4a9b432 20df116 100644 a python libvirt override c b python libvirt override c 2350 6 2350 42 libvirt_virdomaingetjobinfo pyobject self attribute_unused pyobject args return py_retval static pyobject libvirt_virdomainhello pyobject self attribute_unused pyobject args virdomainptr domain struct _virhelloparams params pyobject pyobj_domain pyobj_params pyobj char c_retval pyobject ret if pyarg_parsetuple args char oo virdomainhello pyobj_domain pyobj_params return null domain virdomainptr pyvirdomain_get pyobj_domain pyobj pydict_getitemstring pyobj_params exclaim if pyobj params exclaim 0 else params exclaim int pyint_as_long pyobj pyobj pydict_getitemstring pyobj_params lang if pyobj params lang null else params lang pystring_asstring pyobj c_retval virdomainhello domain params if c_retval null return vir_py_none ret pystring_fromstring c_retval free c_retval return ret helper functions to avoid importing modules 3585 6 3621 7 static pymethoddef libvirtmethods char virdomaingetjobinfo libvirt_virdomaingetjobinfo meth_varargs null char virdomainsnapshotlistnames libvirt_virdomainsnapshotlistnames meth_varargs null char virdomainreverttosnapshot libvirt_virdomainreverttosnapshot meth_varargs null char virdomainhello libvirt_virdomainhello meth_varargs null null null 0 null here lies the meat of today s exercise above we supply a python to c wrapper function according to our oft repeated formula we unpack arguments make the c api call and package the return value the python representation of virhelloparams is a dictionary containing the keys lang and exclaim both keys are optional if supplied lang is a string and exclaim is a boolean well that s it you re done with hello world for libvirt thanks for following my tutorial i welcome your comments on anything the tutorial itself but especially the process for adding new functionality to libvirt if my opinion hasn t come through in the tutorial i think there is room for simplification posted in uncategorized leave a comment create hello virsh command posted on april 17 2011 by aglitke this is the seventh post in the series howto add libvirt support for a qemu command phew we are getting near the end in contrast to the remote support this part will seem easy we have only one file to change in that file we define the command and some metadata then we provide an api wrapper function that parses virsh command line arguments makes the api call and outputs the result to the user find the patch here diff git a tools virsh c b tools virsh c index 50ca50f 254a2bd 100644 a tools virsh c b tools virsh c 3987 6 3987 59 done hello command static const vshcmdinfo info_domhello help n_ say hello to a domain desc n_ qemu demonstration command does nothing useful null null static const vshcmdoptdef opts_domhello domain vsh_ot_data vsh_oflag_req gettext_noop domain name id or uuid exclaim vsh_ot_bool 0 n_ get a more excited greeting lang vsh_ot_data vsh_oflag_none n_ select desired language english or spanish null 0 0 null first create two structures that define the virsh command info_domhello defines some help text that will get displayed by the help command opts_domhello defines the virsh options for our command each entry sets the option name the type is whether the parameter is optional and the help text static int cmddomhello vshcontrol ctl const vshcmd cmd virdomainptr dom const char name struct _virhelloparams params int exclaim 0 const char lang char response if vshconnectionusability ctl ctl conn return false if dom vshcommandoptdomain ctl cmd name return false if vshcommandoptbool cmd exclaim exclaim 1 if vshcommandoptstring cmd lang lang 0 lang null params lang char lang params exclaim exclaim response virdomainhello dom params if response vshprint ctl s response vir_free response else virdomainfree dom return false virdomainfree dom return true net autostart command static const vshcmdinfo info_network_autostart 10504 6 10557 7 static const vshcmddef dommonitoringcmds dommemstat cmddommemstat opts_dommemstat info_dommemstat domstate cmddomstate opts_domstate info_domstate list cmdlist opts_list info_list domhello cmddomhello opts_domhello info_domhello null null null null by now for structure of this function should be looking very familiar it starts by testing the connection and domain for validity next the exclaim and lang arguments are extracted if present and the params structure is built next the api call is made either the response or error message is displayed and cleanup is done up next enable python bindings for hello the last one posted in uncategorized leave a comment add hello remote transport support posted on april 16 2011 by aglitke this is the sixth post in the series howto add libvirt support for a qemu command one great thing about libvirt is its ability to work with remote hosts just as easily as the local system on which it is installed of course this feature doesn t come for free every new libvirt api requires an xdr implementation to transmit function calls and their results over the wire note virsh always uses the remote driver to execute commands so this functionality must be in place for virsh to work even for local operations i would regard this part to be the most difficult task when adding a new api to libvirt unless you are familiar with xdr there is quite a bit going on and not much documentation to explain it this patch provides an xdr protocol specification which is used to generate several xdr specific stubs additionally a client and server implementation are provided see the unadultered patch here hello add hello remote transport support src remote remote_protocol x provide defines for the new entry point src remote remote_driver c daemon remote c implement the client and server side generated stubs daemon remote_dispatch_args h daemon remote_dispatch_prototypes h daemon remote_dispatch_ret h daemon remote_dispatch_table h src remote remote_protocol c src remote remote_protocol h when adding remote support for an api it is only necessary to change three files the others are generated automatically from remote_protocol x during the build process when submitting patches include the changes to the generated files i will make one additional point regarding xdr generation i have found it helpful to manually regenerate the files whenever i modify remote_protocol x to do this execute the following command from the top of the libvirt source tree make c src rpcgen onward and upward diff git a src remote remote_protocol x b src remote remote_protocol x index 7310689 54346cd 100644 a src remote remote_protocol x b src remote remote_protocol x 1926 6 1926 20 struct remote_domain_open_console_args unsigned int flags struct remote_domain_hello_params remote_string lang int exclaim struct remote_domain_hello_args remote_nonnull_domain domain remote_domain_hello_params params struct remote_domain_hello_ret remote_string response protocol define the program number protocol version and procedure numbers here 2159 7 2173 8 enum remote_procedure remote_proc_domain_set_memory_flags 204 remote_proc_domain_set_blkio_parameters 205 remote_proc_domain_get_blkio_parameters 206 remote_proc_domain_migrate_set_max_speed 207 remote_proc_domain_migrate_set_max_speed 207 remote_proc_domain_hello 208 notice how the entries are grouped in sets of 10 the first step when adding remote support should be to define the wire protocol for your api you must define the format of the arguments and return value including explicit format definitions for any structures that are to be passed or returned for virdomainhello the arguments include a domain and a structure the return is a string that can be null the format of this file is c like but not strict c there should be enough examples in the file to figure out how to express the various c types after defining the types allocate the next available rpc number for this api the rpc number is used to figure out if both the client and server support a specific function diff git a daemon remote c b daemon remote c index d49e0d8 9be77ad 100644 a daemon remote c b daemon remote c 6995 6 6995 51 remotedispatchdomaineventsderegisterany struct qemud_server server attribute_u static int remotedispatchdomainhello struct qemud_server server attribute_unused struct qemud_client client attribute_unused virconnectptr conn remote_message_header hdr attribute_unused remote_error rerr remote_domain_hello_args args remote_domain_hello_ret ret virdomainptr dom struct _virhelloparams params char response ret_str int rc 0 dom get_nonnull_domain conn args domain if dom null remotedispatchconnerror rerr conn return 1 xdr passes lang as a pointer to a pointer params lang args params lang null null args params lang params exclaim args params exclaim 0 and the same thing for the return string if vir_alloc response 0 remotedispatchoomerror rerr virdomainfree dom return 1 ret_str virdomainhello dom params if ret_str remotedispatchconnerror rerr conn vir_free response rc 1 else response ret_str ret response response virdomainfree dom return rc static int remotedispatchnwfilterlookupbyname struct qemud_server server attribute_unused the function above implements the server side of the remote function call this code runs within libvirtd on the remote host and calls down into the qemu driver on behalf of a client that may be running on another host the pointer arguments args and ret contain encoded data representing the arguments to virdomainhello and a place to store the return value regardless of the api being called this function returns an integer to indicate success or failure at the rpc level the first step is to convert args dom into a valid local domain pointer next we build a local virhelloparams structure from the rest of the arguments something i found very confusing mostly due to lack of documentation is that xdr passes strings as char pointers that explains the strange way of accessing args params lang likewise to return a string we must allocate response a char pointer once this is done we can make the actual api call on behalf of the client if successful the returned string is packed into response and then packed into the xdr return parameter finally the domain pointer must be freed diff git a src remote remote_driver c b src remote remote_driver c index 87a68a6 75c655a 100644 a src remote remote_driver c b src remote remote_driver c 9632 6 9632 33 done static char remotedomainhello virdomainptr dom virhelloparamsptr params char rv null remote_domain_hello_args args remote_domain_hello_ret ret struct private_data priv dom conn privatedata remotedriverlock priv make_nonnull_domain args domain dom args params lang params lang null null char params lang args params exclaim params exclaim memset ret 0 sizeof ret if call dom conn priv 0 remote_proc_domain_hello xdrproc_t xdr_remote_domain_hello_args char args xdrproc_t xdr_remote_domain_hello_ret char ret 1 goto done caller frees this rv ret response null null ret response done remotedriverunlock priv return rv 11202 7 11229 7 static virdriver remote_driver remotedomainsnapshotdelete domainsnapshotdelete remoteqemudomainmonitorcommand qemudomainmonitorcommand remotedomainopenconsole domainopenconsole null domainhello remotedomainhello domainhello static virnetworkdriver network_driver here is the implementation of the client side which is organized as a driver just like qemu xen etc i followed the example set by other functions in the remote driver to handle driver locking with that taken care of the structures for xdr arguments and return value are prepared the domain pointer is encoded using a helper function as stated previously xdr requires character pointers to be passed by reference next we make the actual rpc call remote_proc_domain_hello refers to the rpc number that we specified in the protocol definition the prepared args and ret structures are passed along wih their types after the call we unpack the returned string clean up and then return our result string by convention we own the reference on the returned string so we do not need to duplicate it the caller will free it diff git a daemon remote_dispatch_args h b daemon remote_dispatch_args h index 15fa1a0 cb6091a 100644 a daemon remote_dispatch_args h b daemon remote_dispatch_args h 176 3 176 4 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 remote_domain_hello_args val_remote_domain_hello_args diff git a daemon remote_dispatch_prototypes h b daemon remote_dispatch_prototypes h index 3fcf87c 5f2264f 100644 a daemon remote_dispatch_prototypes h b daemon remote_dispatch_prototypes h 338 6 338 14 static int remotedispatchdomainhasmanagedsaveimage remote_error err remote_domain_has_managed_save_image_args args remote_domain_has_managed_save_image_ret ret static int remotedispatchdomainhello struct qemud_server server struct qemud_client client virconnectptr conn remote_message_header hdr remote_error err remote_domain_hello_args args remote_domain_hello_ret ret static int remotedispatchdomaininterfacestats struct qemud_server server struct qemud_client client diff git a daemon remote_dispatch_ret h b daemon remote_dispatch_ret h index 114e832 cdc9c89 100644 a daemon remote_dispatch_ret h b daemon remote_dispatch_ret h 140 3 140 4 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 remote_domain_hello_ret val_remote_domain_hello_ret diff git a daemon remote_dispatch_table h b daemon remote_dispatch_table h index c5f6653 fb2c074 100644 a daemon remote_dispatch_table h b daemon remote_dispatch_table h 1042 3 1042 8 args_filter xdrproc_t xdr_remote_domain_migrate_set_max_speed_args ret_filter xdrproc_t xdr_void domainhello 208 fn dispatch_fn remotedispatchdomainhello args_filter xdrproc_t xdr_remote_domain_hello_args ret_filter xdrproc_t xdr_remote_domain_hello_ret diff git a src remote remote_protocol c b src remote remote_protocol c index 7ecea9d ba31d50 100644 a src remote remote_protocol c b src remote remote_protocol c 3872 6 3872 37 xdr_remote_domain_open_console_args xdr xdrs remote_domain_open_console_args bool_t xdr_remote_domain_hello_params xdr xdrs remote_domain_hello_params objp if xdr_remote_string xdrs objp lang return false if xdr_int xdrs objp exclaim return false return true bool_t xdr_remote_domain_hello_args xdr xdrs remote_domain_hello_args objp if xdr_remote_nonnull_domain xdrs objp domain return false ...
|