Commit 1e1eb830 authored by Benziane Chakib's avatar Benziane Chakib
Browse files

doc update wit examples

parent bf4ec3d7
Loading
Loading
Loading
Loading
+63 −16
Original line number Diff line number Diff line
@@ -37,22 +37,6 @@ ________________

.. autofunction:: ccnode.find_process_id

Examples
________

A basic usage of a kvm hypervisor object looks like this::

    #import the library
    import cchypervisor

    #create a handle on the hypervisor
    kvm_h = cchypervisor.KvmHypervisor()

    #list defined vms
    kvm_h.list_vms()

    #this will output

Node Managment
______________

@@ -60,3 +44,66 @@ ______________
   :members:
.. automodule:: ccnode.ccnodehandlers
   :members:


Examples
________

A basic usage of the node library looks like this::

    >>> #import the library
    >>> import ccnode

    >>> kvm = ccnode.KvmHypervisor()

    >>> hand = ccnode.ccnodehandlers.NodeHandler(kvm)

    # We can list all vms with None parameter
    >>> hand.list_vm(None)
    
    [{'cpu': 88,
      'status': 'Running',
      'vcpus': 1,
      'vm': 'squeeze',
      'vmem_avail': 0L,
      'vmem_total': 512L,
      'vmem_used': 512L},
     {'cpu': 47,
      'status': 'Running',
      'vcpus': 1,
      'vm': 'ldap',
      'vmem_avail': 0L,
      'vmem_total': 512L,
      'vmem_used': 512L},
     {'cpu': 0,
      'status': 'Running',
      'vcpus': 1,
      'vm': 'lenny',
      'vmem_avail': 0L,
      'vmem_total': 512L,
      'vmem_used': 512L}]

    We can give a list of vms to list
    >>> hand.list_vm(['squeeze', 'lenny'])

    [{'cpu': 51,
      'status': 'Running',
      'vcpus': 1,
      'vm': 'squeeze',
      'vmem_avail': 0L,
      'vmem_total': 512L,
      'vmem_used': 512L},
     {'cpu': 0,
      'status': 'Running',
      'vcpus': 1,
      'vm': 'lenny',
      'vmem_avail': 0L,
      'vmem_total': 512L,
      'vmem_used': 512L}]
    
    # And a tags list too
    >>> hand.list_vm(['squeeze', 'lenny'], tags=['vmem_used', 'vcpus'])
    
    [{'vcpus': 1, 'vm': 'squeeze', 'vmem_used': 512L},
     {'vcpus': 1, 'vm': 'lenny', 'vmem_used': 512L}]
   
+8 −2
Original line number Diff line number Diff line
@@ -17,12 +17,16 @@ import sys, os
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('../../cc-server'))
sys.path.append(os.path.abspath('../../sjrpc'))

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.graphviz']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig',
'sphinx.ext.graphviz', 'sphinx.ext.doctest']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -96,7 +100,9 @@ html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
html_theme_options = {
    'stickysidebar' : 'true'
    }

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []