Commit Graph

5 Commits

Author SHA1 Message Date
John Ferlan
0776809659 hellolibvirt: Resolve Coverity issues
Recent changes uncovered a NEGATIVE_RETURNS when processing 'numNames'
in 'showDomains' in the for loop after a possible -1 return.
2013-07-11 14:18:11 -04:00
Daniel P. Berrange
75825494c7 Convert 'int i' to 'size_t i' in examples/ files
Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-10 17:55:17 +01:00
Daniel P. Berrange
0902f696a9 Update hellolibvirt to demo virGetLastErrorMessage()
Update the hellolibvirt example program to demonstrate use of
the virGetLastErrorMessage() API for quick error reporting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
John Ferlan
b421c35c98 hellolibvirt: Adjust code to use new APIs
Change the order of some conditions and use the AllDomains API to get
a list of all the active and defined domains, then use the Active and
Name API's in order to print.

This changes here adjust the output from:

Attempting to connect to hypervisor
Connected to hypervisor at "qemu:///system"
Hypervisor: "QEMU" version: 0.32.656
There are 0 active and 2 inactive domains
Inactive domains:
  foo
  bar
Disconnected from hypervisor

to

Attempting to connect to hypervisor
Connected to hypervisor at "qemu:///system"
Hypervisor: "QEMU" version: 0.32.656
There are 0 active and 2 inactive domains
       foo (non-active)
       bar (non-active)
Disconnected from hypervisor
2013-03-04 17:36:03 -05:00
Daniel Veillard
66780313c2 New example program
* Makefile.am configure.in examples/hellolibvirt/Makefile.am
  examples/hellolibvirt/hellolibvirt.c: new trivial example program
  by David Allan
Daniel
2009-02-26 16:14:50 +00:00