[libvirt] building error

2012-04-20 Thread Wen Congyang
When I build libvirt, I meet the following error message
sometimes:

make[4]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.11/docs'
  GENlibvirt-api.xml
  GENlibvirt-qemu-api.xml
  GENhtml/index.html
./libvirt-api.xml:2450: parser error : AttValue: ' expected
function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : attributes construct error
function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Couldn't find end of Start Tag function 
line 2450
function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Premature end of data in tag symbols 
line 1129
function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Premature end of data in tag api line 2
function name='virConnectDomainEventDeregister' file='libvi
^
unable to parse ./libvirt-api.xml
make[4]: *** [html/index.html] Error 6
make[4]: *** Waiting for unfinished jobs

If I rebuild it without anything change, the building will success.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 00/17] Reorgnize/refactoring round 4

2012-04-20 Thread Osier Yang
Perhaps this set shouldn't be called reorgnize/refactoring,
but to keep the same title in the series, it's still used.

The mainly work this set do is to use the TERM domain
instead of guest in codes.

Osier Yang (17):
  Destroy src/dist and move env_inspect.py back
  Substitute guest_names with domain_names
  Rename src/env_parser.py as src/global_parser.py
  Substitute guest_ with domain_
  Substitue guestobj with domobj
  Substitute guestxml with domxml
  Substitute _guest with _domain
  Substitute 'guest ' with 'domain '
  Substitute guestos with os_type
  Substitute guestarch with os_arch
  Substitute 'guestip' with 'domip'
  Substitute 'guest' with 'domain'
  Substitute '\gname\' with 'domname'
  Change the section name 'guest' into 'domain' in global.cfg
  Substitute 'guestinstxml' with 'domxml'
  Substitute '\guest\' with 'domain'
  Substitute 'guestname' with 'domain_name'

 cases/consumption_cpu_topology.conf|   14 +-
 cases/consumption_domain_nfs_start.conf|8 +-
 cases/consumption_eventhandler.conf|   12 +-
 cases/consumption_libvirtd.conf|   10 +-
 cases/consumption_ownership_test.conf  |8 +-
 cases/domain_linux_net_inst.conf   |   12 +-
 cases/linux_domain.conf|   52 +++---
 cases/migration/ssh_persistent_paused_no_dst.conf  |   74 
 .../migration/ssh_persistent_paused_with_dst.conf  |   98 ++--
 cases/migration/ssh_persistent_running_no_dst.conf |   74 
 .../migration/ssh_persistent_running_with_dst.conf |   98 ++--
 cases/migration/ssh_transient_paused_no_dst.conf   |   48 +++---
 cases/migration/ssh_transient_paused_with_dst.conf |   74 
 cases/migration/ssh_transient_running_no_dst.conf  |   50 +++---
 .../migration/ssh_transient_running_with_dst.conf  |   74 
 cases/migration/tcp_persistent_paused_no_dst.conf  |   74 
 .../migration/tcp_persistent_paused_with_dst.conf  |   98 ++--
 cases/migration/tcp_persistent_running_no_dst.conf |   74 
 .../migration/tcp_persistent_running_with_dst.conf |   98 ++--
 .../tcp_sasl_persistent_paused_no_dst.conf |   26 ++--
 .../tcp_sasl_persistent_paused_with_dst.conf   |   34 ++--
 .../tcp_sasl_persistent_running_no_dst.conf|   26 ++--
 .../tcp_sasl_persistent_running_with_dst.conf  |   34 ++--
 .../tcp_sasl_transient_paused_no_dst.conf  |   18 +-
 .../tcp_sasl_transient_paused_with_dst.conf|   26 ++--
 .../tcp_sasl_transient_running_no_dst.conf |   18 +-
 .../tcp_sasl_transient_running_with_dst.conf   |   26 ++--
 cases/migration/tcp_transient_paused_no_dst.conf   |   48 +++---
 cases/migration/tcp_transient_paused_with_dst.conf |   74 
 cases/migration/tcp_transient_running_no_dst.conf  |   50 +++---
 .../migration/tcp_transient_running_with_dst.conf  |   74 
 cases/migration/tls_persistent_paused_no_dst.conf  |   74 
 .../migration/tls_persistent_paused_with_dst.conf  |   98 ++--
 cases/migration/tls_persistent_running_no_dst.conf |   74 
 .../migration/tls_persistent_running_with_dst.conf |   98 ++--
 .../tls_sasl_persistent_paused_no_dst.conf |   26 ++--
 .../tls_sasl_persistent_paused_with_dst.conf   |   34 ++--
 .../tls_sasl_persistent_running_no_dst.conf|   26 ++--
 .../tls_sasl_persistent_running_with_dst.conf  |   34 ++--
 .../tls_sasl_transient_paused_no_dst.conf  |   18 +-
 .../tls_sasl_transient_paused_with_dst.conf|   26 ++--
 .../tls_sasl_transient_running_no_dst.conf |   18 +-
 .../tls_sasl_transient_running_with_dst.conf   |   26 ++--
 cases/migration/tls_transient_paused_no_dst.conf   |   48 +++---
 cases/migration/tls_transient_paused_with_dst.conf |   74 
 cases/migration/tls_transient_running_no_dst.conf  |   50 +++---
 .../migration/tls_transient_running_with_dst.conf  |   74 
 cases/snapshot.conf|   30 ++--
 cases/windows_domain.conf  |   50 +++---
 .../en-US/Creating_a_configuration_file.xml|  116 ++--
 .../en-US/Understanding_libvirt-test-API.xml   |8 +-
 .../en-US/Writing_a_test_case.xml  |   74 
 .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 +-
 global.cfg |   34 ++--
 repos/domain/attach_disk.py|   20 +-
 repos/domain/attach_interface.py   |   20 +-
 repos/domain/autostart.py  |   24 ++--
 repos/domain/balloon_memory.py |   64 
 repos/domain/blkstats.py   |   12 +-
 repos/domain/console_io.py |   12 +-
 repos/domain/console_mutex.py  |8 +-
 repos/domain/cpu_affinity.py   |   44 +++---
 repos/domain/cpu_topology.py  

[libvirt] [test-API 02/17] Substitute guest_names with domain_names

2012-04-20 Thread Osier Yang
Same as commit af470a72, let's use the same TERM 'domain' instead
of 'guest' in test-API, this patch just substitute guest_names
with domain_names, there will be follow up patches to change
others, because it will be really large patch if do all the
changing together.
---
 repos/domain/cpu_affinity.py  |6 +++---
 repos/domain/cpu_topology.py  |4 ++--
 repos/domain/destroy.py   |6 +++---
 repos/domain/domain_blkinfo.py|8 
 repos/domain/domain_id.py |6 +++---
 repos/domain/domain_uuid.py   |8 
 repos/domain/domblkinfo.py|8 
 repos/domain/eventhandler.py  |6 +++---
 repos/domain/install_linux_cdrom.py   |6 +++---
 repos/domain/install_linux_net.py |6 +++---
 repos/domain/install_windows_cdrom.py |6 +++---
 repos/domain/migrate.py   |   12 ++--
 repos/domain/ownership_test.py|6 +++---
 repos/libvirtd/qemu_hang.py   |6 +++---
 repos/libvirtd/restart.py |6 +++---
 repos/snapshot/delete.py  |4 ++--
 repos/snapshot/file_flag.py   |6 +++---
 repos/snapshot/flag_check.py  |6 +++---
 repos/snapshot/internal_create.py |4 ++--
 repos/snapshot/revert.py  |4 ++--
 20 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
index afc0f9b..fc99664 100644
--- a/repos/domain/cpu_affinity.py
+++ b/repos/domain/cpu_affinity.py
@@ -206,13 +206,13 @@ def cpu_affinity(params):
 hypervisor = uri.split(':')[0]
 
 # Get cpu affinity
-guest_names = []
+domain_names = []
 ids = conn.listDomainsID()
 for id in ids:
 obj = conn.lookupByID(id)
-guest_names.append(obj.name())
+domain_names.append(obj.name())
 
-if domain_name not in guest_names:
+if domain_name not in domain_names:
 logger.error(guest %s doesn't exist or not be running. %
   domain_name)
 return 1
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
index 5dbe27b..c3cc553 100644
--- a/repos/domain/cpu_topology.py
+++ b/repos/domain/cpu_topology.py
@@ -23,9 +23,9 @@ optional_params = ()
 
 def check_domain_running(conn, guestname, logger):
 check if the domain exists
-defined_guest_names = conn.listDefinedDomains()
+defined_domain_names = conn.listDefinedDomains()
 
-if guestname not in defined_guest_names:
+if guestname not in defined_domain_names:
 logger.error(%s doesn't exist or still in running % guestname)
 return 1
 else:
diff --git a/repos/domain/destroy.py b/repos/domain/destroy.py
index 89de3e2..6359274 100644
--- a/repos/domain/destroy.py
+++ b/repos/domain/destroy.py
@@ -39,13 +39,13 @@ def destroy(params):
 conn = sharedmod.libvirtobj['conn']
 
 # Get running domain by name
-guest_names = []
+domain_names = []
 ids = conn.listDomainsID()
 for id in ids:
 obj = conn.lookupByID(id)
-guest_names.append(obj.name())
+domain_names.append(obj.name())
 
-if guestname not in guest_names:
+if guestname not in domain_names:
 logger.error(guest %s doesn't exist or isn't running. % guestname)
 return 1
 
diff --git a/repos/domain/domain_blkinfo.py b/repos/domain/domain_blkinfo.py
index 9aaecb2..ec7f14c 100644
--- a/repos/domain/domain_blkinfo.py
+++ b/repos/domain/domain_blkinfo.py
@@ -30,15 +30,15 @@ def get_output(command, logger):
 
 def check_domain_exists(conn, guestname, logger):
  check if the domain exists, may or may not be active 
-guest_names = []
+domain_names = []
 ids = conn.listDomainsID()
 for id in ids:
 obj = conn.lookupByID(id)
-guest_names.append(obj.name())
+domain_names.append(obj.name())
 
-guest_names += conn.listDefinedDomains()
+domain_names += conn.listDefinedDomains()
 
-if guestname not in guest_names:
+if guestname not in domain_names:
 logger.error(%s doesn't exist % guestname)
 return False
 else:
diff --git a/repos/domain/domain_id.py b/repos/domain/domain_id.py
index ff246ad..384bcf3 100644
--- a/repos/domain/domain_id.py
+++ b/repos/domain/domain_id.py
@@ -27,13 +27,13 @@ def get_output(logger, command):
 
 def check_domain_exists(conn, guestname, logger):
  check if the domain exists, may or may not be active 
-guest_names = []
+domain_names = []
 ids = conn.listDomainsID()
 for id in ids:
 obj = conn.lookupByID(id)
-guest_names.append(obj.name())
+domain_names.append(obj.name())
 
-if guestname not in guest_names:
+if guestname not in domain_names:
 logger.error(%s is not running or does not exist % guestname)
 return False
 else:
diff --git a/repos/domain/domain_uuid.py b/repos/domain/domain_uuid.py
index e66c3ee..0d3996c 100644
--- 

[libvirt] [test-API 05/17] Substitue guestobj with domobj

2012-04-20 Thread Osier Yang
---
 repos/domain/update_devflag.py |   10 +-
 .../multiple_thread_block_on_domain_create.py  |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
index 6c75fd6..48efd72 100644
--- a/repos/domain/update_devflag.py
+++ b/repos/domain/update_devflag.py
@@ -189,17 +189,17 @@ def update_devflag(params):
 return 1
 
 guestxml = domobj.XMLDesc(0)
-guestobj = minidom.parseString(guestxml)
+domobj = minidom.parseString(guestxml)
 
 # Generat device XML for original use
 origxmlobj = xml_builder.XmlBuilder()
 
 if devtype == 'cdrom':
-origxmlobj.add_cdrom(xmlargs, guestobj)
-guestxml = origxmlobj.build_domain(guestobj)
+origxmlobj.add_cdrom(xmlargs, domobj)
+guestxml = origxmlobj.build_domain(domobj)
 elif devtype == 'floppy':
-origxmlobj.add_floppy(xmlargs, guestobj)
-guestxml = origxmlobj.build_domain(guestobj)
+origxmlobj.add_floppy(xmlargs, domobj)
+guestxml = origxmlobj.build_domain(domobj)
 
 try:
 domobj.undefine()
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py 
b/repos/regression/multiple_thread_block_on_domain_create.py
index 08a9190..4224510 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -81,8 +81,8 @@ class domain_install(Thread):
 self.logger.debug(guestxml is %s % guestxml)
 self.logger.info('create guest %sfrom xml description' % self.name)
 try:
-guestobj = self.conn.createXML(guestxml, 0)
-self.logger.info('guest %s API createXML returned successfuly' % 
guestobj.name())
+domobj = self.conn.createXML(guestxml, 0)
+self.logger.info('guest %s API createXML returned successfuly' % 
domobj.name())
 except libvirtError, e:
 logger.error(API error message: %s, error code is %s \
  % (e.message, e.get_error_code()))
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 01/17] Destroy src/dist and move env_inspect.py back

2012-04-20 Thread Osier Yang
As env_inspect.py is rewrote, and has good portability now.
---
 src/{dist/redhat = }/env_inspect.py |0
 src/generator.py |9 +
 2 files changed, 1 insertions(+), 8 deletions(-)
 delete mode 100644 src/dist/__init__.py
 delete mode 100644 src/dist/redhat/__init__.py
 rename src/{dist/redhat = }/env_inspect.py (100%)

diff --git a/src/dist/__init__.py b/src/dist/__init__.py
deleted file mode 100644
index e69de29..000
diff --git a/src/dist/redhat/__init__.py b/src/dist/redhat/__init__.py
deleted file mode 100644
index e69de29..000
diff --git a/src/dist/redhat/env_inspect.py b/src/env_inspect.py
similarity index 100%
rename from src/dist/redhat/env_inspect.py
rename to src/env_inspect.py
diff --git a/src/generator.py b/src/generator.py
index 4247fda..fc6cec3 100644
--- a/src/generator.py
+++ b/src/generator.py
@@ -26,17 +26,10 @@ import traceback
 
 from src import mapper
 from src import env_parser
+from src import env_inspect
 from utils import log
 from utils import format
 
-# Import of distribution-specific code.  If this is needed somewhere
-# else in the future, please don't copy-paste this, but create some
-# sensible distribution-specific package
-for dist in os.listdir('src/dist'):
-if os.path.exists('/etc/%s-release' % dist):
-exec('from src.dist.%s import env_inspect' % dist)
-break
-
 class FuncGen(object):
  To generate a callable testcase
 def __init__(self, cases_func_ref_dict,
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 06/17] Substitute guestxml with domxml

2012-04-20 Thread Osier Yang
---
 repos/domain/balloon_memory.py |   12 ++--
 repos/domain/cpu_affinity.py   |   12 ++--
 repos/domain/cpu_topology.py   |6 +++---
 repos/domain/install_image.py  |6 +++---
 repos/domain/install_linux_cdrom.py|   14 +++---
 repos/domain/install_linux_net.py  |   14 +++---
 repos/domain/install_windows_cdrom.py  |   14 +++---
 repos/domain/update_devflag.py |   10 +-
 .../multiple_thread_block_on_domain_create.py  |6 +++---
 utils/xml_builder.py   |2 +-
 10 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
index 642c1fa..11d4565 100644
--- a/repos/domain/balloon_memory.py
+++ b/repos/domain/balloon_memory.py
@@ -42,10 +42,10 @@ def redefine_memory_size(domobj, domname, memsize):
  dump domain xml description to change the memory size,
 then, define the domain again
 
-guestxml = domobj.XMLDesc(0)
-logger.debug('''original guest %s xml :\n%s''' % (domname, guestxml))
+domxml = domobj.XMLDesc(0)
+logger.debug('''original guest %s xml :\n%s''' % (domname, domxml))
 
-doc = minidom.parseString(guestxml)
+doc = minidom.parseString(domxml)
 
 newmem = doc.createElement('memory')
 newmemval = doc.createTextNode(str(memsize))
@@ -166,8 +166,8 @@ def balloon_memory(params):
 return 1
 
 # Redefine domain with specified memory size
-newguestxml = redefine_memory_size(domobj, domname, maxmem)
-logger.debug('''new guest %s xml :\n%s''' %(domname, newguestxml))
+newdomxml = redefine_memory_size(domobj, domname, maxmem)
+logger.debug('''new guest %s xml :\n%s''' %(domname, newdomxml))
 
 logger.info(undefine the original guest)
 try:
@@ -180,7 +180,7 @@ def balloon_memory(params):
 
 logger.info(define guest with new xml)
 try:
-conn.defineXML(newguestxml)
+conn.defineXML(newdomxml)
 except libvirtError, e:
 logger.error(API error message: %s, error code is %s \
  % (e.message, e.get_error_code()))
diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
index fc99664..1b300dc 100644
--- a/repos/domain/cpu_affinity.py
+++ b/repos/domain/cpu_affinity.py
@@ -22,10 +22,10 @@ def redefine_vcpu_number(domobj, domain_name, vcpu):
 dump domain xml description to change the vcpu number,
then, define the domain again
 
-guestxml = domobj.XMLDesc(0)
-logger.debug('''original guest %s xml :\n%s''' %(domain_name, guestxml))
+domxml = domobj.XMLDesc(0)
+logger.debug('''original guest %s xml :\n%s''' %(domain_name, domxml))
 
-doc = minidom.parseString(guestxml)
+doc = minidom.parseString(domxml)
 
 newvcpu = doc.createElement('vcpu')
 newvcpuval = doc.createTextNode(vcpu)
@@ -78,8 +78,8 @@ def set_vcpus(util, domobj, domain_name, vcpu):
 logger.error(the domain couldn't be destroied within 60 secs.)
 return 1
 
-newguestxml = redefine_vcpu_number(domobj, domain_name, vcpu)
-logger.debug('''new guest %s xml :\n%s''' %(domain_name, newguestxml))
+newdomxml = redefine_vcpu_number(domobj, domain_name, vcpu)
+logger.debug('''new guest %s xml :\n%s''' %(domain_name, newdomxml))
 
 logger.info(undefine the original guest)
 try:
@@ -93,7 +93,7 @@ def set_vcpus(util, domobj, domain_name, vcpu):
 logger.info(define guest with new xml)
 try:
 conn = domobj._conn
-conn.defineXML(newguestxml)
+conn.defineXML(newdomxml)
 except libvirtError, e:
 logger.error(API error message: %s, error code is %s \
  % (e.message, e.get_error_code()))
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
index a463668..ccde97f 100644
--- a/repos/domain/cpu_topology.py
+++ b/repos/domain/cpu_topology.py
@@ -34,10 +34,10 @@ def check_domain_running(conn, guestname, logger):
 def add_cpu_xml(domobj, guestname, sockets, cores, threads, logger):
 edit domain xml description and insert cpu element
 
-guestxml = domobj.XMLDesc(0)
-logger.debug('''original guest %s xml :\n%s''' %(guestname, guestxml))
+domxml = domobj.XMLDesc(0)
+logger.debug('''original guest %s xml :\n%s''' %(guestname, domxml))
 
-doc = minidom.parseString(guestxml)
+doc = minidom.parseString(domxml)
 cpu = doc.createElement('cpu')
 topology = doc.createElement('topology')
 topology.setAttribute('sockets', sockets)
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index 84df56d..fe05ca8 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -77,10 +77,10 @@ def install_image(params):
 
 xmlobj.add_disk(params, domain)
 xmlobj.add_interface(params, domain)
-

[libvirt] [test-API 04/17] Substitute guest_ with domain_

2012-04-20 Thread Osier Yang
---
 repos/domain/attach_disk.py|4 ++--
 repos/domain/attach_interface.py   |2 +-
 repos/domain/autostart.py  |4 ++--
 repos/domain/balloon_memory.py |8 
 repos/domain/blkstats.py   |4 ++--
 repos/domain/cpu_topology.py   |   12 ++--
 repos/domain/detach_disk.py|4 ++--
 repos/domain/detach_interface.py   |4 ++--
 repos/domain/dump.py   |   10 +-
 repos/domain/ifstats.py|4 ++--
 repos/domain/install_linux_cdrom.py|6 +++---
 repos/domain/install_linux_net.py  |6 +++---
 repos/domain/restore.py|   14 +++---
 repos/domain/save.py   |   16 
 repos/domain/sched_params.py   |4 ++--
 .../multiple_thread_block_on_domain_create.py  |   16 
 repos/snapshot/delete.py   |4 ++--
 repos/snapshot/snapshot_list.py|   16 
 18 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/repos/domain/attach_disk.py b/repos/domain/attach_disk.py
index 4711ad1..f07b5bb 100644
--- a/repos/domain/attach_disk.py
+++ b/repos/domain/attach_disk.py
@@ -32,7 +32,7 @@ def create_image(name, size, logger):
 else:
 return False
 
-def check_guest_status(domobj):
+def check_domain_status(domobj):
 Check guest current status
 state = domobj.info()[0]
 if state == libvirt.VIR_DOMAIN_SHUTOFF or state == 
libvirt.VIR_DOMAIN_SHUTDOWN:
@@ -76,7 +76,7 @@ def attach_disk(params):
 logger.debug(original disk number: %s %disk_num1)
 
 if disktype == virtio:
-if check_guest_status(domobj):
+if check_domain_status(domobj):
 pass
 else:
 domobj.create()
diff --git a/repos/domain/attach_interface.py b/repos/domain/attach_interface.py
index 4d605f9..ce4282a 100644
--- a/repos/domain/attach_interface.py
+++ b/repos/domain/attach_interface.py
@@ -15,7 +15,7 @@ from utils import xml_builder
 required_params = ('guestname', 'ifacetype', 'source',)
 optional_params = ('hdmodel',)
 
-def check_guest_status(guestname, domobj):
+def check_domain_status(guestname, domobj):
 Check guest current status
 state = domobj.get_state(guestname)
 if state == shutoff or state == shutdown:
diff --git a/repos/domain/autostart.py b/repos/domain/autostart.py
index da428c2..0b11022 100644
--- a/repos/domain/autostart.py
+++ b/repos/domain/autostart.py
@@ -13,7 +13,7 @@ from src import sharedmod
 required_params = ('guestname', 'autostart',)
 optional_params = ()
 
-def check_guest_autostart(*args):
+def check_domain_autostart(*args):
 Check domain start automatically result, if setting domain is
successful, guestname.xml will exist under
/etc/libvirt/{hypervisor}/autostart/
@@ -59,7 +59,7 @@ def autostart(params):
 
 try:
 domobj.setAutostart(flag)
-if check_guest_autostart(guestname, uri.split(:)[0], flag, logger):
+if check_domain_autostart(guestname, uri.split(:)[0], flag, logger):
 logger.info(current %s autostart: %s %
 (guestname, domobj.autostart()))
 logger.info(executing autostart operation is successful)
diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
index fc7383c..642c1fa 100644
--- a/repos/domain/balloon_memory.py
+++ b/repos/domain/balloon_memory.py
@@ -64,7 +64,7 @@ def redefine_memory_size(domobj, domname, memsize):
 
 return doc.toxml()
 
-def guest_power_on(domobj, domname, mac):
+def domain_power_on(domobj, domname, mac):
  power on guest virtual machine
 
 try:
@@ -96,7 +96,7 @@ def guest_power_on(domobj, domname, mac):
 
 return 0
 
-def guest_power_off(domobj, domname):
+def domain_power_off(domobj, domname):
  power off guest virtual machine
 
 state = domobj.info()[0]
@@ -161,7 +161,7 @@ def balloon_memory(params):
  power off it to set memory to maximum memory %
  domname)
 domobj = conn.lookupByName(domname)
-ret = guest_power_off(domobj, domname)
+ret = domain_power_off(domobj, domname)
 if ret:
 return 1
 
@@ -188,7 +188,7 @@ def balloon_memory(params):
 return 1
 
 logger.info(memory set is finished, boot up the guest %s  % domname)
-ret = guest_power_on(domobj, domname, mac)
+ret = domain_power_on(domobj, domname, mac)
 if ret:
 return 1
 
diff --git a/repos/domain/blkstats.py b/repos/domain/blkstats.py
index 31bd37f..24c4b85 100644
--- a/repos/domain/blkstats.py
+++ b/repos/domain/blkstats.py
@@ -14,7 +14,7 @@ from src import sharedmod
 required_params = ('guestname',)
 optional_params = ()
 

[libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Osier Yang
---
 .../en-US/Creating_a_configuration_file.xml|   82 ++--
 .../en-US/Writing_a_test_case.xml  |   24 +++---
 .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
 repos/domain/domain_list.py|   12 ++--
 repos/domain/install_linux_cdrom.py|   18 ++--
 repos/domain/install_linux_net.py  |8 +-
 repos/domain/install_windows_cdrom.py  |6 +-
 repos/domain/update_devflag.py |6 +-
 8 files changed, 87 insertions(+), 87 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
index 80ebdb1..ffac187 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
@@ -90,7 +90,7 @@ module:test_case
example
  titleConfiguration file/title
 programlisting
-Domain:install_guest
+Domain:install_domain
 guestname
 rhel5u4
 memory
@@ -105,7 +105,7 @@ Domain:install_guest
  titleList data structure/title
 programlisting
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
'vcpu': '1'}}]
 ]
 /programlisting
   /example
@@ -119,7 +119,7 @@ Domain:install_guest
example
  titleConfiguration file/title
 programlisting
-Domain:install_guest
+Domain:install_domain
 guestname
 rhel5u4
 rhel5u3
@@ -136,9 +136,9 @@ Domain:install_guest
  titleList data structure/title
 programlisting
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': 
'1'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': 
'1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
'vcpu': '1'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 
'vcpu': '1'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 
'vcpu': '1'}}]
 ]
 /programlisting
   /example
@@ -152,7 +152,7 @@ Domain:install_guest
example
  titleConfiguration file/title
 programlisting
-domain:install_guest
+domain:install_domain
 guestname
 rhel5u4
 memory
@@ -171,7 +171,7 @@ storage:initialize_storage
  titleList data structure/title
 programlisting
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
 ]
 /programlisting
   /example
@@ -185,7 +185,7 @@ storage:initialize_storage
example
  titleConfiguration file/title
 programlisting
-domain:install_guest
+domain:install_domain
 guestname
 rhel5u4
 rhel5u3
@@ -206,9 +206,9 @@ storage:initialize_storage
  titleList data structure/title
 programlisting
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u3', 'memory': '1024', 'vcpu': 
'1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 'rhel5u2', 'memory': '1024', 'vcpu': 
'1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u3', 'memory': '1024', 
'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}],
+  [{'domain:install_domain': {'guestname': 'rhel5u2', 'memory': '1024', 
'vcpu': '1'}}, {'storage:initialize_storage': {'storagename': 'rhel5u4'}}]
 ]
 /programlisting
   /example
@@ -222,7 +222,7 @@ storage:initialize_storage
example
  titleConfiguration file/title
 programlisting
-domain:install_guest
+domain:install_domain
 guestname
 rhel5u4
 rhel5u3
@@ -232,7 +232,7 @@ domain:install_guest
 vcpu
 1
 
-domain:shutdown_guest
+domain:shutdown_domain
 guestname
  rhel5u4 only rhel5u4
  rhel5u3 only rhel5u3
@@ -245,9 +245,9 @@ domain:shutdown_guest
  titleList data structure/title
 programlisting
 [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}, {'domain:shutdown_guest': {'guestname': 'rhel5u4'}}],
-  [{'domain:install_guest': {'guestname': 

[libvirt] [test-API 03/17] Rename src/env_parser.py as src/global_parser.py

2012-04-20 Thread Osier Yang
And:

% for i in $(grep 'envparser' * -r | awk -F':' '{print $1}' | uniq); do \
sed -i -e 's/envparser/global_parser/g' $i; \
  done

% for i in $(grep 'Envparser' * -r | awk -F':' '{print $1}' | uniq); do \
sed -i -e 's/Envparser/GlobalParser/g' $i; \
  done

% for i in $(grep 'env_parser' * -r | awk -F':' '{print $1}' | uniq); do \
sed -i -e 's/envparser/GlobalParser/g' $i; \
  done

Typo fixes:

% for i in $(grep 'Envpaser' * -r | awk -F':' '{print $1}' | uniq); do \
sed -i -e 's/Envpaser/GlobalParser/g' $i; \
  done
---
 .../en-US/Understanding_libvirt-test-API.xml   |2 +-
 .../en-US/Writing_a_test_case.xml  |   16 
 repos/domain/install_image.py  |6 +++---
 repos/domain/install_linux_cdrom.py|8 
 repos/domain/install_linux_check.py|6 +++---
 repos/domain/install_linux_net.py  |   12 ++--
 repos/domain/install_windows_cdrom.py  |   12 ++--
 .../multiple_thread_block_on_domain_create.py  |8 
 src/env_inspect.py |   14 +++---
 src/generator.py   |4 ++--
 src/{env_parser.py = global_parser.py}|4 ++--
 src/parser.py  |4 ++--
 12 files changed, 48 insertions(+), 48 deletions(-)
 rename src/{env_parser.py = global_parser.py} (97%)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
index 88c1b76..a563953 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
@@ -206,7 +206,7 @@ repos
   paraRandom MAC address generator. Useful when installing a guest 
machine./para
 /listitem
 listitem
-  parafilenameenv_parser.py/filename is the parser component of 
the environment INI file./para
+  parafilenameglobal_parser.py/filename is the parser component 
of the environment INI file./para
 /listitem
 listitem
   parafilenamecheck.py/filename verifies if a hypervisor is 
running./para
diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 2a74518..b36c660 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -141,7 +141,7 @@ sys.path.append(rootdir)
 import exception
 from lib import connectAPI
 from lib import storageAPI
-from utils import env_parser
+from utils import global_parser
 from utils import xml_builder
 
 envfile = 'env.ini'
@@ -149,9 +149,9 @@ envfile = 'env.ini'
 def initialize_storage(dict):
 logger = dict['logger']
 dict['hypertype'] = 'xen'
-envparser = env_parser.Envpaser(envfile)
-dict['sourcename'] = envparser.get_value('storage', 'sourcename')
-dict['sourcepath'] = envparser.get_value('storage', 'sourcepath')
+global_parser = global_parser.GlobalParser(envfile)
+dict['sourcename'] = global_parser.get_value('storage', 'sourcename')
+dict['sourcepath'] = global_parser.get_value('storage', 'sourcepath')
 
 logger.info('prepare create storage pool')
 xmlobj = xml_builder.XmlBuilder()
@@ -200,7 +200,7 @@ sys.path.append(rootdir)
 import exception
 from lib import connectAPI
 from lib import domainAPI
-from utils import env_parser
+from utils import global_parser
 from utils import xml_builder
 
 envfile = 'env.ini'
@@ -237,9 +237,9 @@ def install_guest(dict):
 dict['bootcd'] = '/tmp/%s/custom.iso' %gname
 
 logger.info('get system environment information')
-envparser = env_parser.Envpaser(envfile)
-url = envparser.get_value(guest, gname + src)
-dict['kickstart'] = envparser.get_value(guest, gname + ks)
+global_parser = global_parser.GlobalParser(envfile)
+url = global_parser.get_value(guest, gname + src)
+dict['kickstart'] = global_parser.get_value(guest, gname + ks)
 logger.debug('install source: \n%s' %url)
 logger.debug('kisckstart file: \n%s' %dict['kickstart'])
 
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index e94ebc7..84df56d 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -11,7 +11,7 @@ import libvirt
 from libvirt import libvirtError
 
 from src import sharedmod
-from src import env_parser
+from src import global_parser
 from utils import utils
 from utils import xml_builder
 
@@ -63,8 +63,8 @@ def install_image(params):
 envfile = os.path.join(HOME_PATH, 'global.cfg')
 logger.info(the environment file is %s % envfile)
 
-envparser = env_parser.Envparser(envfile)
-image_url = 

[libvirt] [test-API 10/17] Substitute guestarch with os_arch

2012-04-20 Thread Osier Yang
An example of the libvirt XML will tell why os_arch is better.

  os
type arch='x86_64'exe/type
init/bin/systemd/init
initarg--unit/initarg
initargemergency.service/initarg
  /os
---
 cases/consumption_cpu_topology.conf|2 +-
 cases/consumption_domain_nfs_start.conf|2 +-
 cases/consumption_eventhandler.conf|2 +-
 cases/consumption_libvirtd.conf|2 +-
 cases/consumption_ownership_test.conf  |2 +-
 cases/domain_linux_net_inst.conf   |2 +-
 cases/linux_domain.conf|2 +-
 cases/snapshot.conf|2 +-
 cases/windows_domain.conf  |2 +-
 repos/domain/install_image.py  |8 
 repos/domain/install_linux_cdrom.py|8 
 repos/domain/install_linux_net.py  |   12 ++--
 repos/domain/install_windows_cdrom.py  |   20 ++--
 .../multiple_thread_block_on_domain_create.py  |4 ++--
 14 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/cases/consumption_cpu_topology.conf 
b/cases/consumption_cpu_topology.conf
index 429f856..1fdb1e2 100644
--- a/cases/consumption_cpu_topology.conf
+++ b/cases/consumption_cpu_topology.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/consumption_domain_nfs_start.conf 
b/cases/consumption_domain_nfs_start.conf
index acc7f9e..f213b2a 100644
--- a/cases/consumption_domain_nfs_start.conf
+++ b/cases/consumption_domain_nfs_start.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/consumption_eventhandler.conf 
b/cases/consumption_eventhandler.conf
index 0fc4509..47de579 100644
--- a/cases/consumption_eventhandler.conf
+++ b/cases/consumption_eventhandler.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
index 330d7fc..6cf070e 100644
--- a/cases/consumption_libvirtd.conf
+++ b/cases/consumption_libvirtd.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/consumption_ownership_test.conf 
b/cases/consumption_ownership_test.conf
index dc0d7ab..e588b54 100644
--- a/cases/consumption_ownership_test.conf
+++ b/cases/consumption_ownership_test.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/domain_linux_net_inst.conf b/cases/domain_linux_net_inst.conf
index 76bb6ba..5e30434 100644
--- a/cases/domain_linux_net_inst.conf
+++ b/cases/domain_linux_net_inst.conf
@@ -5,7 +5,7 @@ domain:install_linux_net
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 netmethod
http
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index bae93e6..73ef9f3 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/snapshot.conf b/cases/snapshot.conf
index 924ef61..bceabe2 100644
--- a/cases/snapshot.conf
+++ b/cases/snapshot.conf
@@ -5,7 +5,7 @@ domain:install_linux_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
index 917f3ec..073009c 100644
--- a/cases/windows_domain.conf
+++ b/cases/windows_domain.conf
@@ -5,7 +5,7 @@ domain:install_windows_cdrom
 $defaulthv
 os_type
 $defaultos
-guestarch
+os_arch
 $defaultarch
 vcpu
 $defaultvcpu
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index 12c638e..64d4d91 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -17,7 +17,7 @@ from utils import xml_builder
 
 HOME_PATH = os.getcwd()
 
-required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
+required_params = ('guestname', 'virt_type', 'os_type', 'os_arch',)
 optional_params = ('uuid',
'memory',
'vcpu',
@@ -36,12 +36,12 @@ def install_image(params):
 guestname = params.get('guestname')
 

[libvirt] [test-API 11/17] Substitute 'guestip' with 'domip'

2012-04-20 Thread Osier Yang
---
 repos/domain/update_devflag.py |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
index f1ecf32..e87b1e5 100644
--- a/repos/domain/update_devflag.py
+++ b/repos/domain/update_devflag.py
@@ -77,7 +77,7 @@ def create_image(params, util, img_name):
 
 return True
 
-def check_device_in_domain(params, util, guestip):
+def check_device_in_domain(params, util, domip):
 Check updated device in guest
 logger = params['logger']
 
@@ -89,7 +89,7 @@ def check_device_in_domain(params, util, guestip):
 logger.error(it's not a cdrom or floppy device.)
 return False, None
 
-ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
+ret, output = utils.remote_exec_pexpect(domip, params['username'], \
params['password'], cmd)
 logger.debug(output)
 if ret:
@@ -98,7 +98,7 @@ def check_device_in_domain(params, util, guestip):
 
 time.sleep(5)
 
-ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
+ret, output = utils.remote_exec_pexpect(domip, params['username'], \
params['password'], umount /media)
 logger.debug(output)
 if ret:
@@ -107,7 +107,7 @@ def check_device_in_domain(params, util, guestip):
 
 time.sleep(5)
 
-ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
+ret, output = utils.remote_exec_pexpect(domip, params['username'], \
params['password'], ls /media)
 logger.debug(output)
 if ret:
@@ -117,7 +117,7 @@ def check_device_in_domain(params, util, guestip):
 
 return True, output
 
-def check_updated_device(params, output, util, guestip, domobj, srcfile):
+def check_updated_device(params, output, util, domip, domobj, srcfile):
 Check if the device is updated
 logger = params['logger']
 xmlobj = domobj.XMLDesc(0)
@@ -129,7 +129,7 @@ def check_updated_device(params, output, util, guestip, 
domobj, srcfile):
 elif diskTag.parentNode.getAttribute('device') == 'floppy':
 upfile = diskTag.getAttribute(file)
 
-res = check_device_in_domain(params, util, guestip)
+res = check_device_in_domain(params, util, domip)
 if res[0] and cmp(res[1], output):
 if upfile == srcfile:
 logger.debug(checking fail.)
@@ -172,8 +172,8 @@ def update_devflag(params):
 flag = libvirt.VIR_DOMAIN_AFFECT_CONFIG
 
 mac = utils.get_dom_mac_addr(guestname)
-guestip = utils.mac_to_ip(mac, 180)
-logger.debug(ip address: %s % guestip)
+domip = utils.mac_to_ip(mac, 180)
+logger.debug(ip address: %s % domip)
 
 conn = sharedmod.libvirtobj['conn']
 
@@ -211,7 +211,7 @@ def update_devflag(params):
 return 1
 
 time.sleep(60)
-ret, output = check_device_in_domain(params, util, guestip)
+ret, output = check_device_in_domain(params, util, domip)
 logger.debug(output)
 if not ret:
 return 1
@@ -249,7 +249,7 @@ def update_devflag(params):
 return 1
 
 result = check_updated_device(params, output, util, \
-   guestip, domobj, srcfile)
+   domip, domobj, srcfile)
 if result[0]:
 logger.error(fail to update '%s' device: %s\n % (devtype, result[1]))
 return 1
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 09/17] Substitute guestos with os_type

2012-04-20 Thread Osier Yang
---
 cases/consumption_cpu_topology.conf|2 +-
 cases/consumption_domain_nfs_start.conf|2 +-
 cases/consumption_eventhandler.conf|2 +-
 cases/consumption_libvirtd.conf|2 +-
 cases/consumption_ownership_test.conf  |2 +-
 cases/domain_linux_net_inst.conf   |2 +-
 cases/linux_domain.conf|2 +-
 cases/snapshot.conf|2 +-
 cases/windows_domain.conf  |2 +-
 repos/domain/install_image.py  |8 +++---
 repos/domain/install_linux_cdrom.py|8 +++---
 repos/domain/install_linux_net.py  |   14 +-
 repos/domain/install_windows_cdrom.py  |   24 ++--
 .../multiple_thread_block_on_domain_create.py  |   12 +-
 14 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/cases/consumption_cpu_topology.conf 
b/cases/consumption_cpu_topology.conf
index 1d76256..429f856 100644
--- a/cases/consumption_cpu_topology.conf
+++ b/cases/consumption_cpu_topology.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/consumption_domain_nfs_start.conf 
b/cases/consumption_domain_nfs_start.conf
index f97cda0..acc7f9e 100644
--- a/cases/consumption_domain_nfs_start.conf
+++ b/cases/consumption_domain_nfs_start.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/consumption_eventhandler.conf 
b/cases/consumption_eventhandler.conf
index 768d616..0fc4509 100644
--- a/cases/consumption_eventhandler.conf
+++ b/cases/consumption_eventhandler.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
index 4eb8f86..330d7fc 100644
--- a/cases/consumption_libvirtd.conf
+++ b/cases/consumption_libvirtd.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/consumption_ownership_test.conf 
b/cases/consumption_ownership_test.conf
index 58468fd..dc0d7ab 100644
--- a/cases/consumption_ownership_test.conf
+++ b/cases/consumption_ownership_test.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/domain_linux_net_inst.conf b/cases/domain_linux_net_inst.conf
index 4c8ab5d..76bb6ba 100644
--- a/cases/domain_linux_net_inst.conf
+++ b/cases/domain_linux_net_inst.conf
@@ -3,7 +3,7 @@ domain:install_linux_net
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index 5059c0d..bae93e6 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/snapshot.conf b/cases/snapshot.conf
index 0557c86..924ef61 100644
--- a/cases/snapshot.conf
+++ b/cases/snapshot.conf
@@ -3,7 +3,7 @@ domain:install_linux_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
index 6eed3f5..917f3ec 100644
--- a/cases/windows_domain.conf
+++ b/cases/windows_domain.conf
@@ -3,7 +3,7 @@ domain:install_windows_cdrom
 $defaultname
 virt_type
 $defaulthv
-guestos
+os_type
 $defaultos
 guestarch
 $defaultarch
diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
index 80dcf1a..12c638e 100644
--- a/repos/domain/install_image.py
+++ b/repos/domain/install_image.py
@@ -17,7 +17,7 @@ from utils import xml_builder
 
 HOME_PATH = os.getcwd()
 
-required_params = ('guestname', 'virt_type', 'guestos', 'guestarch',)
+required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
 optional_params = ('uuid',
'memory',
'vcpu',
@@ -35,12 +35,12 @@ def install_image(params):
 
 guestname = params.get('guestname')
 virt_type = params.get('virt_type')
-guestos = params.get('guestos')
+os_type = params.get('os_type')
 guestarch = 

[libvirt] [test-API 12/17] Substitute 'guest' with 'domain'

2012-04-20 Thread Osier Yang
% for i in $(grep 'guest' * -r | awk -F':' '{print $1}'| uniq); do \
sed -i -e 's/guest/domain/g' $i; \
  done

This also affects the codes like:

-url = global_parser.get_value(guest, gname + src)
-dict['kickstart'] = global_parser.get_value(guest, gname + ks)
+url = global_parser.get_value(domain, gname + src)
+dict['kickstart'] = global_parser.get_value(domain, gname + ks)

A follow up patch will change the property 'guest' into 'domain'
---
 .../en-US/Writing_a_test_case.xml  |4 ++--
 repos/domain/balloon_memory.py |2 +-
 repos/domain/cpu_affinity.py   |2 +-
 repos/domain/cpu_topology.py   |   10 +-
 repos/domain/domain_blkinfo.py |2 +-
 repos/domain/domain_uuid.py|2 +-
 repos/domain/domblkinfo.py |2 +-
 repos/domain/install_linux_cdrom.py|6 +++---
 repos/domain/install_linux_check.py|6 +++---
 repos/domain/install_linux_net.py  |8 
 repos/domain/install_windows_cdrom.py  |6 +++---
 repos/domain/restore.py|2 +-
 repos/domain/save.py   |2 +-
 repos/domain/update_devflag.py |2 +-
 .../multiple_thread_block_on_domain_create.py  |6 +++---
 repos/snapshot/file_flag.py|2 +-
 repos/snapshot/flag_check.py   |2 +-
 utils/utils.py |2 +-
 18 files changed, 34 insertions(+), 34 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index dec8bd7..5502cc3 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -238,8 +238,8 @@ def install_domain(dict):
 
 logger.info('get system environment information')
 global_parser = global_parser.GlobalParser(envfile)
-url = global_parser.get_value(guest, gname + src)
-dict['kickstart'] = global_parser.get_value(guest, gname + ks)
+url = global_parser.get_value(domain, gname + src)
+dict['kickstart'] = global_parser.get_value(domain, gname + ks)
 logger.debug('install source: \n%s' %url)
 logger.debug('kisckstart file: \n%s' %dict['kickstart'])
 
diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
index d48ea3b..dd3eafc 100644
--- a/repos/domain/balloon_memory.py
+++ b/repos/domain/balloon_memory.py
@@ -169,7 +169,7 @@ def balloon_memory(params):
 newdomxml = redefine_memory_size(domobj, domname, maxmem)
 logger.debug('''new domain %s xml :\n%s''' %(domname, newdomxml))
 
-logger.info(undefine the original guest)
+logger.info(undefine the original domain)
 try:
 domobj.undefine()
 except libvirtError, e:
diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
index 38ab5e3..47cd30a 100644
--- a/repos/domain/cpu_affinity.py
+++ b/repos/domain/cpu_affinity.py
@@ -81,7 +81,7 @@ def set_vcpus(util, domobj, domain_name, vcpu):
 newdomxml = redefine_vcpu_number(domobj, domain_name, vcpu)
 logger.debug('''new domain %s xml :\n%s''' %(domain_name, newdomxml))
 
-logger.info(undefine the original guest)
+logger.info(undefine the original domain)
 try:
 domobj.undefine()
 except libvirtError, e:
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
index 5e95057..50876da 100644
--- a/repos/domain/cpu_topology.py
+++ b/repos/domain/cpu_topology.py
@@ -58,9 +58,9 @@ def add_cpu_xml(domobj, guestname, sockets, cores, threads, 
logger):
 return doc.toxml()
 
 def domain_undefine(domobj, logger):
-undefine original guest
+undefine original domain
 try:
-logger.info(undefine guest)
+logger.info(undefine domain)
 domobj.undefine()
 logger.info(undefine the domain is successful)
 except libvirtError, e:
@@ -74,7 +74,7 @@ def domain_undefine(domobj, logger):
 def domain_define(domobj, domxml, logger):
 define new domain xml
 try:
-logger.info(define guest)
+logger.info(define domain)
 conn = domobj._conn;
 conn.defineXML(domxml)
 logger.info(success to define new domain xml description)
@@ -87,13 +87,13 @@ def domain_define(domobj, domxml, logger):
 return 0
 
 def domain_start(domobj, guestname, util, logger):
-start guest
+start domain
 timeout = 600
 ip = ''
 mac = utils.get_dom_mac_addr(guestname)
 
 try:
-logger.info(start guest)
+logger.info(start domain)
 domobj.create()
 except libvirtError, e:
 logger.error(API error message: %s, error code is %s \
diff --git 

Re: [libvirt] [PATCH] vbox: avoid provoking assertions in VBoxSVC

2012-04-20 Thread Matthias Bolte
Am 20. April 2012 01:07 schrieb Eric Blake ebl...@redhat.com:
 On 04/17/2012 10:50 AM, Eric Blake wrote:
 On 04/13/2012 07:04 AM, Jean-Baptiste Rouault wrote:
 Passing a NULL pointer to IMachine::delete virtualbox API
 causes VBoxSVC to raise an assertion. This patch passes
 an empty array instead.
 ---
  src/vbox/vbox_tmpl.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
 index 68e3b05..be25828 100644
 --- a/src/vbox/vbox_tmpl.c
 +++ b/src/vbox/vbox_tmpl.c
 @@ -5294,7 +5294,8 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned 
 int flags)

          ((IMachine_Delete)machine-vtbl-Delete)(machine, safeArray, 
 progress);
  # else
 -        machine-vtbl-Delete(machine, 0, NULL, progress);
 +        vboxArray array = VBOX_ARRAY_INITIALIZER;
 +        machine-vtbl-Delete(machine, 0, (IMedium**)array, progress);
  # endif

 ACK and Pushed.

Actually, this is not how vboxArray is supposed to be used. vboxArray
is a wrapper with specific implementations for MSCOM and XPCOM. You
cannot just cast it to a VirtualBox API type.

 Phooey.  Now I'm getting compile failure:

 cc1: warnings being treated as errors
 In file included from vbox/vbox_V4_0.c:13:
 vbox/vbox_tmpl.c: In function 'vboxDomainUndefineFlags':
 vbox/vbox_tmpl.c:5298: warning: dereferencing type-punned pointer will
 break strict-aliasing rules [-Wstrict-aliasing]

I think we need a new vboxArrayPass/Set function to get this right. I
might have time to take care of this tomorrow, if nobody fixed it
before then.

-- 
Matthias Bolte
http://photron.blogspot.com

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [test-API 14/17] Change the section name 'guest' into 'domain' in global.cfg

2012-04-20 Thread Osier Yang
---
 global.cfg |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/global.cfg b/global.cfg
index 825e14a..1346988 100644
--- a/global.cfg
+++ b/global.cfg
@@ -29,7 +29,7 @@ win7_x86_64 = http://
 #  - URL to iso installation images for Windows domain installations
 #  - installation keys for Windows domain installations
 #
-[guest]
+[domain]
 rhel3u9_i386 = http://
 rhel3u9_x86_64 = http://
 rhel4u8_i386 = http://
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 15/17] Substitute 'guestinstxml' with 'domxml'

2012-04-20 Thread Osier Yang
---
 .../en-US/Writing_a_test_case.xml  |6 +++---
 utils/xml_builder.py   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index e16fb33..40e365a 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -247,13 +247,13 @@ def install_domain(dict):
 prepare_cdrom(url, dict['kickstart'], domname, logger)
 
 xmlobj = xml_builder.XmlBuilder()
-guestinstxml = xmlobj.build_domain_install(dict)
-logger.debug('dump installation domain xml:\n%s' %guestinstxml)
+domxml = xmlobj.build_domain_install(dict)
+logger.debug('dump installation domain xml:\n%s' %domxml)
 
 conn = connectAPI.ConnectAPI.open(xen:///)
 domobj = domainAPI.DomainAPI(conn)
 logger.info('define domain from xml description')
-domobj.define_domain(guestinstxml)
+domobj.define_domain(domxml)
 
 logger.info('start installation domain ...')
 domobj.start_domain(domname)
diff --git a/utils/xml_builder.py b/utils/xml_builder.py
index c11b430..a41ab72 100644
--- a/utils/xml_builder.py
+++ b/utils/xml_builder.py
@@ -331,7 +331,7 @@ if __name__ == __main__:
 params['fullimagepath'] = '/tmp/netfs/rhel5u5'
 params['bootcd'] = '/tmp/custom.iso'
 
-guestinstxml = xmlobj.build_domain_install(params)
+domxml = xmlobj.build_domain_install(params)
 
 
 #
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 13/17] Substitute '\gname\' with 'domname'

2012-04-20 Thread Osier Yang
% for i in $(grep '\gname\' * -r | awk -F':' '{print $1}'); do \
sed -i -e 's/\gname\/domname/g' $i; \
  done
---
 .../en-US/Writing_a_test_case.xml  |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 5502cc3..e16fb33 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -206,10 +206,10 @@ from utils import xml_builder
 envfile = 'env.ini'
 
 def prepare_cdrom(*args):
-url, ks, gname, logger = args
+url, ks, domname, logger = args
 ks_name = os.path.basename(ks)
 
-new_dir = os.path.join('/tmp', gname)
+new_dir = os.path.join('/tmp', domname)
 os.makedirs(new_dir)
 
 boot_path = os.path.join(url, 'images/boot.iso')
@@ -231,20 +231,20 @@ def prepare_cdrom(*args):
 
 def install_domain(dict):
 logger = dict['logger']
-gname = dict['guestname']
+domname = dict['guestname']
 dict['ifacetype'] = 'bridge'
 dict['bridge'] = 'xenbr0'
-dict['bootcd'] = '/tmp/%s/custom.iso' %gname
+dict['bootcd'] = '/tmp/%s/custom.iso' %domname
 
 logger.info('get system environment information')
 global_parser = global_parser.GlobalParser(envfile)
-url = global_parser.get_value(domain, gname + src)
-dict['kickstart'] = global_parser.get_value(domain, gname + ks)
+url = global_parser.get_value(domain, domname + src)
+dict['kickstart'] = global_parser.get_value(domain, domname + ks)
 logger.debug('install source: \n%s' %url)
 logger.debug('kisckstart file: \n%s' %dict['kickstart'])
 
 logger.info('prepare installation booting cdrom')
-prepare_cdrom(url, dict['kickstart'], gname, logger)
+prepare_cdrom(url, dict['kickstart'], domname, logger)
 
 xmlobj = xml_builder.XmlBuilder()
 guestinstxml = xmlobj.build_domain_install(dict)
@@ -256,9 +256,9 @@ def install_domain(dict):
 domobj.define_domain(guestinstxml)
 
 logger.info('start installation domain ...')
-domobj.start_domain(gname)
+domobj.start_domain(domname)
 
-state = domobj.get_domain_state(gname)
+state = domobj.get_domain_state(domname)
 logger.debug('current domain state: %s' %state)
 /programlisting
 /example
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API 16/17] Substitute '\guest\' with 'domain'

2012-04-20 Thread Osier Yang
% for i in $(grep '\guest\' * -r | awk -F':' '{print $1}' | uniq); do \
sed -i -e 's/\guest\/domain/g' $i; \
  done
---
 .../en-US/Understanding_libvirt-test-API.xml   |4 ++--
 .../en-US/Writing_a_test_case.xml  |2 +-
 global.cfg |   20 ++--
 repos/domain/attach_disk.py|2 +-
 repos/domain/attach_interface.py   |2 +-
 repos/domain/console_io.py |6 +++---
 repos/domain/console_mutex.py  |4 ++--
 repos/domain/cpu_affinity.py   |2 +-
 repos/domain/cpu_topology.py   |2 +-
 repos/domain/destroy.py|2 +-
 repos/domain/detach_disk.py|2 +-
 repos/domain/detach_interface.py   |2 +-
 repos/domain/domain_list.py|6 +++---
 repos/domain/eventhandler.py   |8 
 repos/domain/ifstats.py|4 ++--
 repos/domain/install_linux_check.py|   12 ++--
 repos/domain/resume.py |4 ++--
 repos/domain/save.py   |2 +-
 repos/domain/shutdown.py   |2 +-
 repos/domain/start.py  |4 ++--
 repos/domain/suspend.py|2 +-
 .../multiple_thread_block_on_domain_create.py  |2 +-
 repos/snapshot/delete.py   |2 +-
 repos/snapshot/file_flag.py|2 +-
 repos/snapshot/internal_create.py  |2 +-
 repos/snapshot/revert.py   |2 +-
 utils/utils.py |   12 ++--
 27 files changed, 58 insertions(+), 58 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
index b065cb1..9f5b93a 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
@@ -62,8 +62,8 @@
   row
 entryapplicationTest object/application/entry
 entryCompatibility between libvirt and hypervisor./entry
-entryCompatibility and functionality of the guest./entry
-entryFunctionality testing of the guest./entry
+entryCompatibility and functionality of the domain./entry
+entryFunctionality testing of the domain./entry
   /row
   row
 entryapplicationTest purpose/application/entry
diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 40e365a..0280341 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -267,7 +267,7 @@ def install_domain(dict):
 example
   titleEnvironment configuration file 
filenameenv.ini/filename/title
 programlisting
-[guest]
+[domain]
 rhel5u4src = 
http://redhat.com/pub/rhel/rel-eng/RHEL5.4-Server-latest/tree-x86_64
 rhel5u4ks = http://10.00.00.01/ks-rhel-5.4-x86_64-noxen-smp-minimal.cfg
 
diff --git a/global.cfg b/global.cfg
index 1346988..20ce390 100644
--- a/global.cfg
+++ b/global.cfg
@@ -93,7 +93,7 @@ sourcepath = /media/share
 # Test URL file used for checking wget proper functionning within
 # a linux guests, i.e. that network is functionning properly within
 # Using a IP dotted server name as in http://192.168.1.10/wget_test_file
-# will avoid testing DNS resolution in the guest, while a FQDN will
+# will avoid testing DNS resolution in the domain, while a FQDN will
 # also exercise DNS resolution
 #
 [other]
@@ -123,22 +123,22 @@ password =
 
 # default hypervisor used
 defaulthv = kvm
-# default domain name for defining or installing a new guest
+# default domain name for defining or installing a new domain
 defaultname = libvirt_test_api
-# default os version to use for installing a new guest
-# the value of it is the first part of 'rhel6u2_x86_64' in [guest] section 
above
+# default os version to use for installing a new domain
+# the value of it is the first part of 'rhel6u2_x86_64' in [domain] section 
above
 defaultos = rhel6u2
-# default architecture to use for installing a new guest
+# default architecture to use for installing a new domain
 defaultarch = x86_64
-# default the number of vcpu to use for defining or installing a guest
+# default the number of vcpu to use for defining or installing a domain
 defaultvcpu = 1
-# default the memory size(kilobytes) to use for defining or installing a guest
+# default the memory size(kilobytes) to use for defining or 

Re: [libvirt] [PATCH] build: avoid type-punning in vbox

2012-04-20 Thread Matthias Bolte
Am 20. April 2012 01:36 schrieb Eric Blake ebl...@redhat.com:
 Commit 78345c68 makes at least gcc 4.1.2 on RHEL 5 complain:

 cc1: warnings being treated as errors
 In file included from vbox/vbox_V4_0.c:13:
 vbox/vbox_tmpl.c: In function 'vboxDomainUndefineFlags':
 vbox/vbox_tmpl.c:5298: warning: dereferencing type-punned pointer will break 
 strict-aliasing rules [-Wstrict-aliasing]

 * src/vbox/vbox_tmpl.c (vboxDomainUndefineFlags): Use union to
 avoid compiler warning.
 ---

 Pushing this under the build-breaker rule.

  src/vbox/vbox_tmpl.c |    7 +--
  1 files changed, 5 insertions(+), 2 deletions(-)

 diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
 index be25828..57c18a4 100644
 --- a/src/vbox/vbox_tmpl.c
 +++ b/src/vbox/vbox_tmpl.c
 @@ -5294,8 +5294,11 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int 
 flags)

         ((IMachine_Delete)machine-vtbl-Delete)(machine, safeArray, 
 progress);
  # else
 -        vboxArray array = VBOX_ARRAY_INITIALIZER;
 -        machine-vtbl-Delete(machine, 0, (IMedium**)array, progress);
 +        union {
 +            vboxArray array;
 +            IMedium *medium;
 +        } u = { .array = VBOX_ARRAY_INITIALIZER };
 +        machine-vtbl-Delete(machine, 0, u.medium, progress);
  # endif
         if (progress != NULL) {
             progress-vtbl-WaitForCompletion(progress, -1);

Actually, NACK. As stated in the other mail, vboxArray is not castable
to IMedium*. True, it silences the compiler any might even work by
accident on XPCOM because VirtualBox might not touch the pointer
beyond checking it for being non-NULL because the 0 tells it that it's
an empty array. But still this is wrong and might crash on MSCOM.

I might come up with a proper solution tomorrow.

-- 
Matthias Bolte
http://photron.blogspot.com

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [test-API 01/17] Destroy src/dist and move env_inspect.py back

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 As env_inspect.py is rewrote, and has good portability now.
 ---
  src/{dist/redhat = }/env_inspect.py |0
  src/generator.py |9 +
  2 files changed, 1 insertions(+), 8 deletions(-)
  delete mode 100644 src/dist/__init__.py
  delete mode 100644 src/dist/redhat/__init__.py
  rename src/{dist/redhat = }/env_inspect.py (100%)
 
 diff --git a/src/dist/__init__.py b/src/dist/__init__.py
 deleted file mode 100644
 index e69de29..000
 diff --git a/src/dist/redhat/__init__.py b/src/dist/redhat/__init__.py
 deleted file mode 100644
 index e69de29..000
 diff --git a/src/dist/redhat/env_inspect.py b/src/env_inspect.py
 similarity index 100%
 rename from src/dist/redhat/env_inspect.py
 rename to src/env_inspect.py
 diff --git a/src/generator.py b/src/generator.py
 index 4247fda..fc6cec3 100644
 --- a/src/generator.py
 +++ b/src/generator.py
 @@ -26,17 +26,10 @@ import traceback
  
  from src import mapper
  from src import env_parser
 +from src import env_inspect
  from utils import log
  from utils import format
  
 -# Import of distribution-specific code.  If this is needed somewhere
 -# else in the future, please don't copy-paste this, but create some
 -# sensible distribution-specific package
 -for dist in os.listdir('src/dist'):
 -if os.path.exists('/etc/%s-release' % dist):
 -exec('from src.dist.%s import env_inspect' % dist)
 -break
 -
  class FuncGen(object):
   To generate a callable testcase
  def __init__(self, cases_func_ref_dict,

ACK, thanks for clearing it up ;-)

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/3 v4] use qemu's dump-guest-meory when vm uses host device

2012-04-20 Thread Wen Congyang
Currently, we use migrate to dump guest's memory. There is one
restriction in migrate command: the device's status should be
stored in qemu because the device's status should be passed to
target machine.

If we passthrough a host device to guest, the device's status
is stored in the real device. So migrate command will fail.

We usually use dump when guest is panicked. So there is no need
to store device's status in the vmcore.

qemu will have a new monitor command dump-guest-memory to dump
guest memory, but it doesn't support async now(it will support
later when the common async API is implemented).

So I use dump-guest-memory only when the guest uses host device
in this patchset.

Note: the patchset for qemu is still queued. Luiz has acked,
but he said he does not wait an ACK from Jan and/or Anthony.

Changes from v3 to v4:
1. allow the user to specify the core file's format

Changes from v2 to v3:
1. qemu supports the fd that is associated with a pipe, socket, or FIFO.
   So pass a pipe fd to qemu and O_DIRECT can work now.

Change from v1 to v2:
1. remove the implemention for text mode.

Wen Congyang (3):
  qemu: implement qemu's dump-guest-memory
  qemu: allow the client to choose the vmcore's format
  virsh: allow the user to specify vmcore's format

 include/libvirt/libvirt.h.in |1 +
 src/qemu/qemu_domain.c   |1 +
 src/qemu/qemu_domain.h   |1 +
 src/qemu/qemu_driver.c   |   54 +++--
 src/qemu/qemu_monitor.c  |   38 +
 src/qemu/qemu_monitor.h  |   12 +
 src/qemu/qemu_monitor_json.c |   35 +++
 src/qemu/qemu_monitor_json.h |6 
 tools/virsh.c|3 ++
 tools/virsh.pod  |5 +++-
 10 files changed, 142 insertions(+), 14 deletions(-)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 02/17] Substitute guest_names with domain_names

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 Same as commit af470a72, let's use the same TERM 'domain' instead
 of 'guest' in test-API, this patch just substitute guest_names
 with domain_names, there will be follow up patches to change
 others, because it will be really large patch if do all the
 changing together.
 ---
  repos/domain/cpu_affinity.py  |6 +++---
  repos/domain/cpu_topology.py  |4 ++--
  repos/domain/destroy.py   |6 +++---
  repos/domain/domain_blkinfo.py|8 
  repos/domain/domain_id.py |6 +++---
  repos/domain/domain_uuid.py   |8 
  repos/domain/domblkinfo.py|8 
  repos/domain/eventhandler.py  |6 +++---
  repos/domain/install_linux_cdrom.py   |6 +++---
  repos/domain/install_linux_net.py |6 +++---
  repos/domain/install_windows_cdrom.py |6 +++---
  repos/domain/migrate.py   |   12 ++--
  repos/domain/ownership_test.py|6 +++---
  repos/libvirtd/qemu_hang.py   |6 +++---
  repos/libvirtd/restart.py |6 +++---
  repos/snapshot/delete.py  |4 ++--
  repos/snapshot/file_flag.py   |6 +++---
  repos/snapshot/flag_check.py  |6 +++---
  repos/snapshot/internal_create.py |4 ++--
  repos/snapshot/revert.py  |4 ++--
  20 files changed, 62 insertions(+), 62 deletions(-)
 
 diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
 index afc0f9b..fc99664 100644
 --- a/repos/domain/cpu_affinity.py
 +++ b/repos/domain/cpu_affinity.py
 @@ -206,13 +206,13 @@ def cpu_affinity(params):
  hypervisor = uri.split(':')[0]
  
  # Get cpu affinity
 -guest_names = []
 +domain_names = []
  ids = conn.listDomainsID()
  for id in ids:
  obj = conn.lookupByID(id)
 -guest_names.append(obj.name())
 +domain_names.append(obj.name())
  
 -if domain_name not in guest_names:
 +if domain_name not in domain_names:

This has nothing to do with this particular patch, but it's more like a
hint for future refactoring.
Why do we lookup all the IDs, then get their names and then check if the
name is in the list, then do lookup by name? Not commenting that all
that is commented with Get cpu affinity? =)
My opinion is we could do lookup by name in try-except block or even
without it (the error usually means failed test anyway).

  logger.error(guest %s doesn't exist or not be running. %
domain_name)
  return 1
 diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
 index 5dbe27b..c3cc553 100644
 --- a/repos/domain/cpu_topology.py
 +++ b/repos/domain/cpu_topology.py
 @@ -23,9 +23,9 @@ optional_params = ()
  
  def check_domain_running(conn, guestname, logger):
  check if the domain exists
 -defined_guest_names = conn.listDefinedDomains()
 +defined_domain_names = conn.listDefinedDomains()
  
 -if guestname not in defined_guest_names:
 +if guestname not in defined_domain_names:
  logger.error(%s doesn't exist or still in running % guestname)
  return 1
  else:
 diff --git a/repos/domain/destroy.py b/repos/domain/destroy.py
 index 89de3e2..6359274 100644
 --- a/repos/domain/destroy.py
 +++ b/repos/domain/destroy.py
 @@ -39,13 +39,13 @@ def destroy(params):
  conn = sharedmod.libvirtobj['conn']
  
  # Get running domain by name
 -guest_names = []
 +domain_names = []
  ids = conn.listDomainsID()
  for id in ids:
  obj = conn.lookupByID(id)
 -guest_names.append(obj.name())
 +domain_names.append(obj.name())
  
 -if guestname not in guest_names:
 +if guestname not in domain_names:
  logger.error(guest %s doesn't exist or isn't running. % guestname)
  return 1
  
 diff --git a/repos/domain/domain_blkinfo.py b/repos/domain/domain_blkinfo.py
 index 9aaecb2..ec7f14c 100644
 --- a/repos/domain/domain_blkinfo.py
 +++ b/repos/domain/domain_blkinfo.py
 @@ -30,15 +30,15 @@ def get_output(command, logger):
  
  def check_domain_exists(conn, guestname, logger):
   check if the domain exists, may or may not be active 
 -guest_names = []
 +domain_names = []
  ids = conn.listDomainsID()
  for id in ids:
  obj = conn.lookupByID(id)
 -guest_names.append(obj.name())
 +domain_names.append(obj.name())
  
 -guest_names += conn.listDefinedDomains()
 +domain_names += conn.listDefinedDomains()
  
 -if guestname not in guest_names:
 +if guestname not in domain_names:
  logger.error(%s doesn't exist % guestname)
  return False
  else:
 diff --git a/repos/domain/domain_id.py b/repos/domain/domain_id.py
 index ff246ad..384bcf3 100644
 --- a/repos/domain/domain_id.py
 +++ b/repos/domain/domain_id.py
 @@ -27,13 +27,13 @@ def get_output(logger, command):
  
  def check_domain_exists(conn, 

[libvirt] [PATCH 2/3 v4] qemu: allow the client to choose the vmcore's format

2012-04-20 Thread Wen Congyang
This patch updates qemu driver to allow the client to choose the
vmcore's format: memory only or including device state.

---
 include/libvirt/libvirt.h.in |1 +
 src/qemu/qemu_domain.c   |1 +
 src/qemu/qemu_domain.h   |1 +
 src/qemu/qemu_driver.c   |   54 +++--
 4 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 97ad99d..5f03043 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -927,6 +927,7 @@ typedef enum {
 VIR_DUMP_LIVE = (1  1), /* live dump */
 VIR_DUMP_BYPASS_CACHE = (1  2), /* avoid file system cache pollution */
 VIR_DUMP_RESET= (1  3), /* reset domain after dump finishes */
+VIR_DUMP_MEMORY_ONLY  = (1  4), /* use dump-guest-memory */
 } virDomainCoreDumpFlags;
 
 /* Domain migration flags. */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4dda2e0..e81f439 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -160,6 +160,7 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
 job-phase = 0;
 job-mask = DEFAULT_JOB_MASK;
 job-start = 0;
+job-dump_memory_only = false;
 memset(job-info, 0, sizeof(job-info));
 }
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index ce52569..098349b 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -104,6 +104,7 @@ struct qemuDomainJobObj {
 int phase;  /* Job phase (mainly for migrations) */
 unsigned long long mask;/* Jobs allowed during async job */
 unsigned long long start;   /* When the async job started */
+bool dump_memory_only;  /* use dump-guest-memory to do dump */
 virDomainJobInfo info;  /* Async job progress data */
 };
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c3555ca..779304f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2967,12 +2967,33 @@ cleanup:
 return ret;
 }
 
+static int qemuDumpToFd(struct qemud_driver *driver, virDomainObjPtr vm,
+int fd, enum qemuDomainAsyncJob asyncJob)
+{
+qemuDomainObjPrivatePtr priv = vm-privateData;
+int ret = -1;
+
+if (virSecurityManagerSetImageFDLabel(driver-securityManager, vm-def,
+  fd)  0)
+return -1;
+
+priv-job.dump_memory_only = true;
+
+if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)  0)
+return -1;
+
+ret = qemuMonitorDumpToFd(priv-mon, 0, fd, 0, 0);
+qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+return ret;
+}
+
 static int
 doCoreDump(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *path,
enum qemud_save_formats compress,
-   bool bypass_cache)
+   unsigned int dump_flags)
 {
 int fd = -1;
 int ret = -1;
@@ -2981,7 +3002,7 @@ doCoreDump(struct qemud_driver *driver,
 unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING;
 
 /* Create an empty file with appropriate ownership.  */
-if (bypass_cache) {
+if (dump_flags  VIR_DUMP_BYPASS_CACHE) {
 flags |= VIR_FILE_WRAPPER_BYPASS_CACHE;
 directFlag = virFileDirectFdFlag();
 if (directFlag  0) {
@@ -3001,14 +3022,20 @@ doCoreDump(struct qemud_driver *driver,
 if (!(wrapperFd = virFileWrapperFdNew(fd, path, flags)))
 goto cleanup;
 
-if (qemuMigrationToFile(driver, vm, fd, 0, path,
-qemuCompressProgramName(compress), false,
-QEMU_ASYNC_JOB_DUMP)  0)
+if (dump_flags  VIR_DUMP_MEMORY_ONLY) {
+ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP);
+} else {
+ret = qemuMigrationToFile(driver, vm, fd, 0, path,
+  qemuCompressProgramName(compress), false,
+  QEMU_ASYNC_JOB_DUMP);
+}
+
+if (ret  0)
 goto cleanup;
 
 if (VIR_CLOSE(fd)  0) {
 virReportSystemError(errno,
- _(unable to save file %s),
+ _(unable to close file %s),
  path);
 goto cleanup;
 }
@@ -3066,7 +3093,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
 virDomainEventPtr event = NULL;
 
 virCheckFlags(VIR_DUMP_LIVE | VIR_DUMP_CRASH |
-  VIR_DUMP_BYPASS_CACHE | VIR_DUMP_RESET, -1);
+  VIR_DUMP_BYPASS_CACHE | VIR_DUMP_RESET |
+  VIR_DUMP_MEMORY_ONLY, -1);
 
 qemuDriverLock(driver);
 vm = virDomainFindByUUID(driver-domains, dom-uuid);
@@ -3108,8 +3136,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
 }
 }
 
-ret = doCoreDump(driver, vm, path, getCompressionType(driver),
- (flags  VIR_DUMP_BYPASS_CACHE) != 0);
+ret = doCoreDump(driver, vm, path, 

[libvirt] [PATCH 1/3] qemu: implement qemu's dump-guest-memory

2012-04-20 Thread Wen Congyang
dump-guest-memory is a new dump mechanism, and it can work when the
guest uses host devices. This patch adds a API to use this new
monitor command.

---
 src/qemu/qemu_monitor.c  |   38 ++
 src/qemu/qemu_monitor.h  |   12 
 src/qemu/qemu_monitor_json.c |   34 ++
 src/qemu/qemu_monitor_json.h |6 ++
 4 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 2f66c46..a5d3eec 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2018,6 +2018,44 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon)
 return ret;
 }
 
+int qemuMonitorDumpToFd(qemuMonitorPtr mon,
+unsigned int flags,
+int fd,
+unsigned long long begin,
+unsigned long long length)
+{
+int ret;
+VIR_DEBUG(mon=%p fd=%d flags=%x begin=%llx length=%llx,
+  mon, fd, flags, begin, length);
+
+if (!mon) {
+qemuReportError(VIR_ERR_INVALID_ARG, %s,
+_(monitor must not be NULL));
+return -1;
+}
+
+if (!mon-json) {
+/* dump-guest-memory is supported after qemu-1.0, and we always use 
json
+ * if qemu's version is = 0.15. So if we use text mode, the qemu is
+ * old, and it does not support dump-guest-memory.
+ */
+qemuReportError(VIR_ERR_NO_SUPPORT, %s,
+_(dump-guest-memory is not supported in text mode));
+return -1;
+}
+
+if (qemuMonitorSendFileHandle(mon, dump, fd)  0)
+return -1;
+
+ret = qemuMonitorJSONDump(mon, flags, fd:dump, begin, length);
+
+if (ret  0) {
+if (qemuMonitorCloseFileHandle(mon, dump)  0)
+VIR_WARN(failed to close dumping handle);
+}
+
+return ret;
+}
 
 int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
 int type,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f3cdcdd..7df52ad 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -379,6 +379,18 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
 
 int qemuMonitorMigrateCancel(qemuMonitorPtr mon);
 
+typedef enum {
+  QEMU_MONITOR_DUMP_HAVE_FILTER  = 1  0,
+  QEMU_MONITOR_DUMP_PAGING   = 1  1,
+  QEMU_MONITOR_DUMP_FLAGS_LAST
+} QEMU_MONITOR_DUMP;
+
+int qemuMonitorDumpToFd(qemuMonitorPtr mon,
+unsigned int flags,
+int fd,
+unsigned long long begin,
+unsigned long long length);
+
 int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
 int type,
 const char *hostname,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index eb58f13..b229a31 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2461,6 +2461,40 @@ int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon)
 return ret;
 }
 
+int qemuMonitorJSONDump(qemuMonitorPtr mon,
+unsigned int flags,
+const char *protocol,
+unsigned long long begin,
+unsigned long long length)
+{
+int ret;
+virJSONValuePtr cmd = NULL;
+virJSONValuePtr reply = NULL;
+
+if (flags  QEMU_MONITOR_DUMP_HAVE_FILTER)
+cmd = qemuMonitorJSONMakeCommand(dump-guest-memory,
+ b:paging, flags  
QEMU_MONITOR_DUMP_PAGING ? 1 : 0,
+ s:protocol, protocol,
+ U:begin, begin,
+ U:length, length,
+ NULL);
+else
+cmd = qemuMonitorJSONMakeCommand(dump-guest-memory,
+ b:paging, flags  
QEMU_MONITOR_DUMP_PAGING ? 1 : 0,
+ s:protocol, protocol,
+ NULL);
+if (!cmd)
+return -1;
+
+ret = qemuMonitorJSONCommand(mon, cmd, reply);
+
+if (ret == 0)
+ret = qemuMonitorJSONCheckError(cmd, reply);
+
+virJSONValueFree(cmd);
+virJSONValueFree(reply);
+return ret;
+}
 
 int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
 int type,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index aacbb5f..ccb2624 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -136,6 +136,12 @@ int qemuMonitorJSONMigrate(qemuMonitorPtr mon,
 
 int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon);
 
+int qemuMonitorJSONDump(qemuMonitorPtr mon,
+unsigned int flags,
+const char *protocol,
+unsigned long long begin,
+

[libvirt] [PATCH 3/3 v4] virsh: allow the user to specify vmcore's format

2012-04-20 Thread Wen Congyang
Add a new parameter --memory-only for 'virsh dump' command. So
the user can decide the vmcore's format.

---
 tools/virsh.c   |3 +++
 tools/virsh.pod |5 -
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 6168a13..c1e8891 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3982,6 +3982,7 @@ static const vshCmdOptDef opts_dump[] = {
 {domain, VSH_OT_DATA, VSH_OFLAG_REQ, N_(domain name, id or uuid)},
 {file, VSH_OT_DATA, VSH_OFLAG_REQ, N_(where to dump the core)},
 {verbose, VSH_OT_BOOL, 0, N_(display the progress of dump)},
+{memory-only, VSH_OT_BOOL, 0, N_(dump domain's memory only)},
 {NULL, 0, 0, NULL}
 };
 
@@ -4020,6 +4021,8 @@ doDump(void *opaque)
 flags |= VIR_DUMP_BYPASS_CACHE;
 if (vshCommandOptBool(cmd, reset))
 flags |= VIR_DUMP_RESET;
+if (vshCommandOptBool(cmd, memory-only))
+flags |= VIR_DUMP_MEMORY_ONLY;
 
 if (virDomainCoreDump(dom, to, flags)  0) {
 vshError(ctl, _(Failed to core dump domain %s to %s), name, to);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index ca5c853..9378714 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -784,7 +784,7 @@ the Iformat argument must be Bqemu-argv. For Xen 
hypervisor, the
 Iformat argument may be Bxen-xm or Bxen-sxpr.
 
 =item Bdump Idomain-id Icorefilepath [I--bypass-cache]
-{ [I--live] | [I--crash] | [I--reset] } [I--verbose]
+{ [I--live] | [I--crash] | [I--reset] } [I--verbose] [I--memory-only]
 
 Dumps the core of a domain to a file for analysis.
 If I--live is specified, the domain continues to run until the core
@@ -795,6 +795,9 @@ If I--reset is specified, the domain is reset after 
successful dump.
 Note, these three switches are mutually exclusive.
 If I--bypass-cache is specified, the save will avoid the file system
 cache, although this may slow down the operation.
+If I--memory-only is specified, the file is elf file, and will only
+include domain's memory and cpu common register value. It is very
+useful if the domain uses host devices directly.
 
 The progress may be monitored using Bdomjobinfo virsh command and canceled
 with Bdomjobabort command (sent by another virsh instance). Another option
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 03/17] Rename src/env_parser.py as src/global_parser.py

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 And:
 
 % for i in $(grep 'envparser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/envparser/global_parser/g' $i; \
   done
 
 % for i in $(grep 'Envparser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/Envparser/GlobalParser/g' $i; \
   done
 
 % for i in $(grep 'env_parser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/envparser/GlobalParser/g' $i; \
   done
 
 Typo fixes:
 
 % for i in $(grep 'Envpaser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/Envpaser/GlobalParser/g' $i; \
   done
 ---
  .../en-US/Understanding_libvirt-test-API.xml   |2 +-
  .../en-US/Writing_a_test_case.xml  |   16 
  repos/domain/install_image.py  |6 +++---
  repos/domain/install_linux_cdrom.py|8 
  repos/domain/install_linux_check.py|6 +++---
  repos/domain/install_linux_net.py  |   12 ++--
  repos/domain/install_windows_cdrom.py  |   12 ++--
  .../multiple_thread_block_on_domain_create.py  |8 
  src/env_inspect.py |   14 +++---
  src/generator.py   |4 ++--
  src/{env_parser.py = global_parser.py}|4 ++--
  src/parser.py  |4 ++--
  12 files changed, 48 insertions(+), 48 deletions(-)
  rename src/{env_parser.py = global_parser.py} (97%)
 
 diff --git 
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
  
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 index 88c1b76..a563953 100644
 --- 
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 +++ 
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 @@ -206,7 +206,7 @@ repos
paraRandom MAC address generator. Useful when installing a guest 
 machine./para
  /listitem
  listitem
 -  parafilenameenv_parser.py/filename is the parser component 
 of the environment INI file./para
 +  parafilenameglobal_parser.py/filename is the parser 
 component of the environment INI file./para
  /listitem
  listitem
parafilenamecheck.py/filename verifies if a hypervisor is 
 running./para
 diff --git 
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
 index 2a74518..b36c660 100644
 --- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
 +++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
 @@ -141,7 +141,7 @@ sys.path.append(rootdir)
  import exception
  from lib import connectAPI
  from lib import storageAPI
 -from utils import env_parser
 +from utils import global_parser
  from utils import xml_builder
  
  envfile = 'env.ini'
 @@ -149,9 +149,9 @@ envfile = 'env.ini'
  def initialize_storage(dict):
  logger = dict['logger']
  dict['hypertype'] = 'xen'
 -envparser = env_parser.Envpaser(envfile)
 -dict['sourcename'] = envparser.get_value('storage', 'sourcename')
 -dict['sourcepath'] = envparser.get_value('storage', 'sourcepath')
 +global_parser = global_parser.GlobalParser(envfile)

This is a little misleading, before this line, global_parser is a class,
but after this line global_parser is a generated object of this class os
something? I'm not sure this improves readability. As I see it is done
in almost the whole patch. Do we really want it this way?
How about at least:

import utils
global_parser = utils.global_parser.GlobalParser(envfile)

We don't have to have from module import class_or_whatever everywhere =)

 +dict['sourcename'] = global_parser.get_value('storage', 'sourcename')
 +dict['sourcepath'] = global_parser.get_value('storage', 'sourcepath')
  
  logger.info('prepare create storage pool')
  xmlobj = xml_builder.XmlBuilder()
 @@ -200,7 +200,7 @@ sys.path.append(rootdir)
  import exception
  from lib import connectAPI
  from lib import domainAPI
 -from utils import env_parser
 +from utils import global_parser
  from utils import xml_builder
  
  envfile = 'env.ini'
 @@ -237,9 +237,9 @@ def install_guest(dict):
  dict['bootcd'] = '/tmp/%s/custom.iso' %gname
  
  logger.info('get system environment information')
 -envparser = env_parser.Envpaser(envfile)
 -url = envparser.get_value(guest, gname + src)
 -dict['kickstart'] = envparser.get_value(guest, gname + ks)
 +global_parser = global_parser.GlobalParser(envfile)
 +url = global_parser.get_value(guest, gname + src)
 +dict['kickstart'] = global_parser.get_value(guest, gname + ks)
  logger.debug('install source: \n%s' %url)
  logger.debug('kisckstart file: \n%s' %dict['kickstart'])
  
snip
 diff --git a/src/parser.py 

Re: [libvirt] [test-API 03/17] Rename src/env_parser.py as src/global_parser.py

2012-04-20 Thread Osier Yang

On 2012年04月20日 15:35, Martin Kletzander wrote:

On 04/20/2012 08:46 AM, Osier Yang wrote:

And:

% for i in $(grep 'envparser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/envparser/global_parser/g' $i; \
   done

% for i in $(grep 'Envparser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/Envparser/GlobalParser/g' $i; \
   done

% for i in $(grep 'env_parser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/envparser/GlobalParser/g' $i; \
   done

Typo fixes:

% for i in $(grep 'Envpaser' * -r | awk -F':' '{print $1}' | uniq); do \
 sed -i -e 's/Envpaser/GlobalParser/g' $i; \
   done
---
  .../en-US/Understanding_libvirt-test-API.xml   |2 +-
  .../en-US/Writing_a_test_case.xml  |   16 
  repos/domain/install_image.py  |6 +++---
  repos/domain/install_linux_cdrom.py|8 
  repos/domain/install_linux_check.py|6 +++---
  repos/domain/install_linux_net.py  |   12 ++--
  repos/domain/install_windows_cdrom.py  |   12 ++--
  .../multiple_thread_block_on_domain_create.py  |8 
  src/env_inspect.py |   14 +++---
  src/generator.py   |4 ++--
  src/{env_parser.py =  global_parser.py}|4 ++--
  src/parser.py  |4 ++--
  12 files changed, 48 insertions(+), 48 deletions(-)
  rename src/{env_parser.py =  global_parser.py} (97%)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
index 88c1b76..a563953 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Understanding_libvirt-test-API.xml
@@ -206,7 +206,7 @@ repos
paraRandom MAC address generator. Useful when installing a guest 
machine./para
  /listitem
  listitem
-parafilenameenv_parser.py/filename  is the parser component of the environment 
INI file./para
+parafilenameglobal_parser.py/filename  is the parser component of the 
environment INI file./para
  /listitem
  listitem
parafilenamecheck.py/filename  verifies if a hypervisor is 
running./para
diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
index 2a74518..b36c660 100644
--- a/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
+++ b/docs/User_Guide/libvirt-test-API_Guide/en-US/Writing_a_test_case.xml
@@ -141,7 +141,7 @@ sys.path.append(rootdir)
  import exception
  from lib import connectAPI
  from lib import storageAPI
-from utils import env_parser
+from utils import global_parser
  from utils import xml_builder

  envfile = 'env.ini'
@@ -149,9 +149,9 @@ envfile = 'env.ini'
  def initialize_storage(dict):
  logger = dict['logger']
  dict['hypertype'] = 'xen'
-envparser = env_parser.Envpaser(envfile)
-dict['sourcename'] = envparser.get_value('storage', 'sourcename')
-dict['sourcepath'] = envparser.get_value('storage', 'sourcepath')
+global_parser = global_parser.GlobalParser(envfile)


This is a little misleading, before this line, global_parser is a class,
but after this line global_parser is a generated object of this class os
something? I'm not sure this improves readability. As I see it is done
in almost the whole patch. Do we really want it this way?
How about at least:

import utils
global_parser = utils.global_parser.GlobalParser(envfile)

We don't have to have frommodule  importclass_or_whatever  everywhere =)


+dict['sourcename'] = global_parser.get_value('storage', 'sourcename')
+dict['sourcepath'] = global_parser.get_value('storage', 'sourcepath')

  logger.info('prepare create storage pool')
  xmlobj = xml_builder.XmlBuilder()
@@ -200,7 +200,7 @@ sys.path.append(rootdir)
  import exception
  from lib import connectAPI
  from lib import domainAPI
-from utils import env_parser
+from utils import global_parser
  from utils import xml_builder

  envfile = 'env.ini'
@@ -237,9 +237,9 @@ def install_guest(dict):
  dict['bootcd'] = '/tmp/%s/custom.iso' %gname

  logger.info('get system environment information')
-envparser = env_parser.Envpaser(envfile)
-url = envparser.get_value(guest, gname + src)
-dict['kickstart'] = envparser.get_value(guest, gname + ks)
+global_parser = global_parser.GlobalParser(envfile)
+url = global_parser.get_value(guest, gname + src)
+dict['kickstart'] = global_parser.get_value(guest, gname + ks)
  logger.debug('install source: \n%s' %url)
  logger.debug('kisckstart file: \n%s' %dict['kickstart'])


snip

diff --git a/src/parser.py b/src/parser.py
index 

Re: [libvirt] [test-API 05/17] Substitue guestobj with domobj

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  repos/domain/update_devflag.py |   10 +-
  .../multiple_thread_block_on_domain_create.py  |4 ++--
  2 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
 index 6c75fd6..48efd72 100644
 --- a/repos/domain/update_devflag.py
 +++ b/repos/domain/update_devflag.py
 @@ -189,17 +189,17 @@ def update_devflag(params):
  return 1
  
  guestxml = domobj.XMLDesc(0)
 -guestobj = minidom.parseString(guestxml)
 +domobj = minidom.parseString(guestxml)
  
  # Generat device XML for original use
  origxmlobj = xml_builder.XmlBuilder()
  
  if devtype == 'cdrom':
 -origxmlobj.add_cdrom(xmlargs, guestobj)
 -guestxml = origxmlobj.build_domain(guestobj)
 +origxmlobj.add_cdrom(xmlargs, domobj)
 +guestxml = origxmlobj.build_domain(domobj)
  elif devtype == 'floppy':
 -origxmlobj.add_floppy(xmlargs, guestobj)
 -guestxml = origxmlobj.build_domain(guestobj)
 +origxmlobj.add_floppy(xmlargs, domobj)
 +guestxml = origxmlobj.build_domain(domobj)
  
  try:
  domobj.undefine()
 diff --git a/repos/regression/multiple_thread_block_on_domain_create.py 
 b/repos/regression/multiple_thread_block_on_domain_create.py
 index 08a9190..4224510 100644
 --- a/repos/regression/multiple_thread_block_on_domain_create.py
 +++ b/repos/regression/multiple_thread_block_on_domain_create.py
 @@ -81,8 +81,8 @@ class domain_install(Thread):
  self.logger.debug(guestxml is %s % guestxml)
  self.logger.info('create guest %sfrom xml description' % self.name)
  try:
 -guestobj = self.conn.createXML(guestxml, 0)
 -self.logger.info('guest %s API createXML returned successfuly' % 
 guestobj.name())
 +domobj = self.conn.createXML(guestxml, 0)
 +self.logger.info('guest %s API createXML returned successfuly' % 
 domobj.name())
  except libvirtError, e:
  logger.error(API error message: %s, error code is %s \
   % (e.message, e.get_error_code()))

ACK

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 04/17] Substitute guest_ with domain_

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  repos/domain/attach_disk.py|4 ++--
  repos/domain/attach_interface.py   |2 +-
  repos/domain/autostart.py  |4 ++--
  repos/domain/balloon_memory.py |8 
  repos/domain/blkstats.py   |4 ++--
  repos/domain/cpu_topology.py   |   12 ++--
  repos/domain/detach_disk.py|4 ++--
  repos/domain/detach_interface.py   |4 ++--
  repos/domain/dump.py   |   10 +-
  repos/domain/ifstats.py|4 ++--
  repos/domain/install_linux_cdrom.py|6 +++---
  repos/domain/install_linux_net.py  |6 +++---
  repos/domain/restore.py|   14 +++---
  repos/domain/save.py   |   16 
  repos/domain/sched_params.py   |4 ++--
  .../multiple_thread_block_on_domain_create.py  |   16 
  repos/snapshot/delete.py   |4 ++--
  repos/snapshot/snapshot_list.py|   16 
  18 files changed, 69 insertions(+), 69 deletions(-)
 
 diff --git a/repos/domain/attach_disk.py b/repos/domain/attach_disk.py
 index 4711ad1..f07b5bb 100644
 --- a/repos/domain/attach_disk.py
 +++ b/repos/domain/attach_disk.py
 @@ -32,7 +32,7 @@ def create_image(name, size, logger):
  else:
  return False
  
 -def check_guest_status(domobj):
 +def check_domain_status(domobj):
  Check guest current status
  state = domobj.info()[0]
  if state == libvirt.VIR_DOMAIN_SHUTOFF or state == 
 libvirt.VIR_DOMAIN_SHUTDOWN:
 @@ -76,7 +76,7 @@ def attach_disk(params):
  logger.debug(original disk number: %s %disk_num1)
  
  if disktype == virtio:
 -if check_guest_status(domobj):
 +if check_domain_status(domobj):
  pass
  else:
  domobj.create()
 diff --git a/repos/domain/attach_interface.py 
 b/repos/domain/attach_interface.py
 index 4d605f9..ce4282a 100644
 --- a/repos/domain/attach_interface.py
 +++ b/repos/domain/attach_interface.py
 @@ -15,7 +15,7 @@ from utils import xml_builder
  required_params = ('guestname', 'ifacetype', 'source',)
  optional_params = ('hdmodel',)
  
 -def check_guest_status(guestname, domobj):
 +def check_domain_status(guestname, domobj):
  Check guest current status
  state = domobj.get_state(guestname)
  if state == shutoff or state == shutdown:
 diff --git a/repos/domain/autostart.py b/repos/domain/autostart.py
 index da428c2..0b11022 100644
 --- a/repos/domain/autostart.py
 +++ b/repos/domain/autostart.py
 @@ -13,7 +13,7 @@ from src import sharedmod
  required_params = ('guestname', 'autostart',)
  optional_params = ()
  
 -def check_guest_autostart(*args):
 +def check_domain_autostart(*args):
  Check domain start automatically result, if setting domain is
 successful, guestname.xml will exist under
 /etc/libvirt/{hypervisor}/autostart/
 @@ -59,7 +59,7 @@ def autostart(params):
  
  try:
  domobj.setAutostart(flag)
 -if check_guest_autostart(guestname, uri.split(:)[0], flag, logger):
 +if check_domain_autostart(guestname, uri.split(:)[0], flag, 
 logger):
  logger.info(current %s autostart: %s %
  (guestname, domobj.autostart()))
  logger.info(executing autostart operation is successful)
 diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
 index fc7383c..642c1fa 100644
 --- a/repos/domain/balloon_memory.py
 +++ b/repos/domain/balloon_memory.py
 @@ -64,7 +64,7 @@ def redefine_memory_size(domobj, domname, memsize):
  
  return doc.toxml()
  
 -def guest_power_on(domobj, domname, mac):
 +def domain_power_on(domobj, domname, mac):
   power on guest virtual machine
  
  try:
 @@ -96,7 +96,7 @@ def guest_power_on(domobj, domname, mac):
  
  return 0
  
 -def guest_power_off(domobj, domname):
 +def domain_power_off(domobj, domname):
   power off guest virtual machine
  
  state = domobj.info()[0]
 @@ -161,7 +161,7 @@ def balloon_memory(params):
   power off it to set memory to maximum memory %
   domname)
  domobj = conn.lookupByName(domname)
 -ret = guest_power_off(domobj, domname)
 +ret = domain_power_off(domobj, domname)
  if ret:
  return 1
  
 @@ -188,7 +188,7 @@ def balloon_memory(params):
  return 1
  
  logger.info(memory set is finished, boot up the guest %s  % domname)
 -ret = guest_power_on(domobj, domname, mac)
 +ret = domain_power_on(domobj, domname, mac)
  if ret:
  return 1
  
 diff --git a/repos/domain/blkstats.py b/repos/domain/blkstats.py
 index 31bd37f..24c4b85 100644

Re: [libvirt] [test-API 06/17] Substitute guestxml with domxml

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  repos/domain/balloon_memory.py |   12 ++--
  repos/domain/cpu_affinity.py   |   12 ++--
  repos/domain/cpu_topology.py   |6 +++---
  repos/domain/install_image.py  |6 +++---
  repos/domain/install_linux_cdrom.py|   14 +++---
  repos/domain/install_linux_net.py  |   14 +++---
  repos/domain/install_windows_cdrom.py  |   14 +++---
  repos/domain/update_devflag.py |   10 +-
  .../multiple_thread_block_on_domain_create.py  |6 +++---
  utils/xml_builder.py   |2 +-
  10 files changed, 48 insertions(+), 48 deletions(-)
 
 diff --git a/repos/domain/balloon_memory.py b/repos/domain/balloon_memory.py
 index 642c1fa..11d4565 100644
 --- a/repos/domain/balloon_memory.py
 +++ b/repos/domain/balloon_memory.py
 @@ -42,10 +42,10 @@ def redefine_memory_size(domobj, domname, memsize):
   dump domain xml description to change the memory size,
  then, define the domain again
  
 -guestxml = domobj.XMLDesc(0)
 -logger.debug('''original guest %s xml :\n%s''' % (domname, guestxml))
 +domxml = domobj.XMLDesc(0)
 +logger.debug('''original guest %s xml :\n%s''' % (domname, domxml))
  
 -doc = minidom.parseString(guestxml)
 +doc = minidom.parseString(domxml)
  
  newmem = doc.createElement('memory')
  newmemval = doc.createTextNode(str(memsize))
 @@ -166,8 +166,8 @@ def balloon_memory(params):
  return 1
  
  # Redefine domain with specified memory size
 -newguestxml = redefine_memory_size(domobj, domname, maxmem)
 -logger.debug('''new guest %s xml :\n%s''' %(domname, newguestxml))
 +newdomxml = redefine_memory_size(domobj, domname, maxmem)
 +logger.debug('''new guest %s xml :\n%s''' %(domname, newdomxml))
  
  logger.info(undefine the original guest)
  try:
 @@ -180,7 +180,7 @@ def balloon_memory(params):
  
  logger.info(define guest with new xml)
  try:
 -conn.defineXML(newguestxml)
 +conn.defineXML(newdomxml)
  except libvirtError, e:
  logger.error(API error message: %s, error code is %s \
   % (e.message, e.get_error_code()))
 diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
 index fc99664..1b300dc 100644
 --- a/repos/domain/cpu_affinity.py
 +++ b/repos/domain/cpu_affinity.py
 @@ -22,10 +22,10 @@ def redefine_vcpu_number(domobj, domain_name, vcpu):
  dump domain xml description to change the vcpu number,
 then, define the domain again
  
 -guestxml = domobj.XMLDesc(0)
 -logger.debug('''original guest %s xml :\n%s''' %(domain_name, guestxml))
 +domxml = domobj.XMLDesc(0)
 +logger.debug('''original guest %s xml :\n%s''' %(domain_name, domxml))
  
 -doc = minidom.parseString(guestxml)
 +doc = minidom.parseString(domxml)
  
  newvcpu = doc.createElement('vcpu')
  newvcpuval = doc.createTextNode(vcpu)
 @@ -78,8 +78,8 @@ def set_vcpus(util, domobj, domain_name, vcpu):
  logger.error(the domain couldn't be destroied within 60 secs.)
  return 1
  
 -newguestxml = redefine_vcpu_number(domobj, domain_name, vcpu)
 -logger.debug('''new guest %s xml :\n%s''' %(domain_name, newguestxml))
 +newdomxml = redefine_vcpu_number(domobj, domain_name, vcpu)
 +logger.debug('''new guest %s xml :\n%s''' %(domain_name, newdomxml))
  
  logger.info(undefine the original guest)
  try:
 @@ -93,7 +93,7 @@ def set_vcpus(util, domobj, domain_name, vcpu):
  logger.info(define guest with new xml)
  try:
  conn = domobj._conn
 -conn.defineXML(newguestxml)
 +conn.defineXML(newdomxml)
  except libvirtError, e:
  logger.error(API error message: %s, error code is %s \
   % (e.message, e.get_error_code()))
 diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
 index a463668..ccde97f 100644
 --- a/repos/domain/cpu_topology.py
 +++ b/repos/domain/cpu_topology.py
 @@ -34,10 +34,10 @@ def check_domain_running(conn, guestname, logger):
  def add_cpu_xml(domobj, guestname, sockets, cores, threads, logger):
  edit domain xml description and insert cpu element
  
 -guestxml = domobj.XMLDesc(0)
 -logger.debug('''original guest %s xml :\n%s''' %(guestname, guestxml))
 +domxml = domobj.XMLDesc(0)
 +logger.debug('''original guest %s xml :\n%s''' %(guestname, domxml))
  
 -doc = minidom.parseString(guestxml)
 +doc = minidom.parseString(domxml)
  cpu = doc.createElement('cpu')
  topology = doc.createElement('topology')
  topology.setAttribute('sockets', sockets)
 diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
 index 84df56d..fe05ca8 100644
 --- a/repos/domain/install_image.py
 +++ 

Re: [libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  .../en-US/Creating_a_configuration_file.xml|   82 
 ++--
  .../en-US/Writing_a_test_case.xml  |   24 +++---
  .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
  repos/domain/domain_list.py|   12 ++--
  repos/domain/install_linux_cdrom.py|   18 ++--
  repos/domain/install_linux_net.py  |8 +-
  repos/domain/install_windows_cdrom.py  |6 +-
  repos/domain/update_devflag.py |6 +-
  8 files changed, 87 insertions(+), 87 deletions(-)
 
 diff --git 
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
  
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 index 80ebdb1..ffac187 100644
 --- 
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 +++ 
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 @@ -90,7 +90,7 @@ module:test_case
   example
 titleConfiguration file/title
  programlisting
 -Domain:install_guest
 +Domain:install_domain
  guestname
  rhel5u4
  memory
 @@ -105,7 +105,7 @@ Domain:install_guest
 titleList data structure/title
  programlisting
  [
 -  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 
 'vcpu': '1'}}]
 +  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
 'vcpu': '1'}}]

I'm not sure about this. The thing we're creating is a domain, but we're
installing a guest, am I right? (thus the guestname and later
guestip and so on. But I could be wrong. Also even if I'm not, the
question is how much we want to separate this in order to keep it readable.

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] build: fix fresh checkout on RHEL5

2012-04-20 Thread Daniel Veillard
On Thu, Apr 19, 2012 at 05:15:01PM -0600, Eric Blake wrote:
 Building a fresh checkout on RHEL 5 has been broken since commit
 29db7a00, due to a gnulib regression in the bootstrap script
 (incremental builds from a checkout earlier than that point were
 okay, though).
 
 * .gnulib: Update to latest, for bootstrap fixes.
 * bootstrap: Resync from gnulib.
 * gnulib/local/top/maint.mk.diff: Drop patch that was added
 upstream in the meantime.
 ---

  ACK

[...]
 --- a/bootstrap
 +++ b/bootstrap
 @@ -1,6 +1,6 @@
  #! /bin/sh
  # Print a version string.
 -scriptversion=2012-02-11.09; # UTC
 +scriptversion=2012-04-19.22; # UTC
 
  # Bootstrap this package from checked-out sources.
 
 @@ -36,6 +36,10 @@ nl='
  LC_ALL=C
  export LC_ALL
 
 +# Ensure that CDPATH is not set.  Otherwise, the output from cd
 +# would cause trouble in at least one use below.
 +(unset CDPATH) /dev/null 21  unset CDPATH
 +

  oh, fun, I'm one of the unfortunate using/relying on CDPATH for shell
naviagtion and it's incredible the amount of stuff it broke over the
years in auto* ...

  I have build scripts to disable it now ...

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Osier Yang

On 2012年04月20日 16:17, Martin Kletzander wrote:

On 04/20/2012 08:46 AM, Osier Yang wrote:

---
  .../en-US/Creating_a_configuration_file.xml|   82 ++--
  .../en-US/Writing_a_test_case.xml  |   24 +++---
  .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
  repos/domain/domain_list.py|   12 ++--
  repos/domain/install_linux_cdrom.py|   18 ++--
  repos/domain/install_linux_net.py  |8 +-
  repos/domain/install_windows_cdrom.py  |6 +-
  repos/domain/update_devflag.py |6 +-
  8 files changed, 87 insertions(+), 87 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
index 80ebdb1..ffac187 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
@@ -90,7 +90,7 @@ module:test_case
example
titleConfiguration file/title
  programlisting
-Domain:install_guest
+Domain:install_domain
  guestname
  rhel5u4
  memory
@@ -105,7 +105,7 @@ Domain:install_guest
titleList data structure/title
  programlisting
  [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': '1024', 'vcpu': 
'1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': '1024', 
'vcpu': '1'}}]


I'm not sure about this. The thing we're creating is a domain, but we're
installing a guest, am I right? (thus the guestname and later
guestip and so on. But I could be wrong. Also even if I'm not, the
question is how much we want to separate this in order to keep it readable.



I'm not quite sure about it either, but I would like to post the patch
so there could be discussion, IIRC, there was discussion about the TERM
domain and guest before too. Anyway, there should be guidelines for
it, mixing use of both of them at liberty can just produce messy codes.

Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [test-API 09/17] Substitute guestos with os_type

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  cases/consumption_cpu_topology.conf|2 +-
  cases/consumption_domain_nfs_start.conf|2 +-
  cases/consumption_eventhandler.conf|2 +-
  cases/consumption_libvirtd.conf|2 +-
  cases/consumption_ownership_test.conf  |2 +-
  cases/domain_linux_net_inst.conf   |2 +-
  cases/linux_domain.conf|2 +-
  cases/snapshot.conf|2 +-
  cases/windows_domain.conf  |2 +-
  repos/domain/install_image.py  |8 +++---
  repos/domain/install_linux_cdrom.py|8 +++---
  repos/domain/install_linux_net.py  |   14 +-
  repos/domain/install_windows_cdrom.py  |   24 
 ++--
  .../multiple_thread_block_on_domain_create.py  |   12 +-
  14 files changed, 42 insertions(+), 42 deletions(-)
 
 diff --git a/cases/consumption_cpu_topology.conf 
 b/cases/consumption_cpu_topology.conf
 index 1d76256..429f856 100644
 --- a/cases/consumption_cpu_topology.conf
 +++ b/cases/consumption_cpu_topology.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/consumption_domain_nfs_start.conf 
 b/cases/consumption_domain_nfs_start.conf
 index f97cda0..acc7f9e 100644
 --- a/cases/consumption_domain_nfs_start.conf
 +++ b/cases/consumption_domain_nfs_start.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/consumption_eventhandler.conf 
 b/cases/consumption_eventhandler.conf
 index 768d616..0fc4509 100644
 --- a/cases/consumption_eventhandler.conf
 +++ b/cases/consumption_eventhandler.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
 index 4eb8f86..330d7fc 100644
 --- a/cases/consumption_libvirtd.conf
 +++ b/cases/consumption_libvirtd.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/consumption_ownership_test.conf 
 b/cases/consumption_ownership_test.conf
 index 58468fd..dc0d7ab 100644
 --- a/cases/consumption_ownership_test.conf
 +++ b/cases/consumption_ownership_test.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/domain_linux_net_inst.conf 
 b/cases/domain_linux_net_inst.conf
 index 4c8ab5d..76bb6ba 100644
 --- a/cases/domain_linux_net_inst.conf
 +++ b/cases/domain_linux_net_inst.conf
 @@ -3,7 +3,7 @@ domain:install_linux_net
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
 index 5059c0d..bae93e6 100644
 --- a/cases/linux_domain.conf
 +++ b/cases/linux_domain.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/snapshot.conf b/cases/snapshot.conf
 index 0557c86..924ef61 100644
 --- a/cases/snapshot.conf
 +++ b/cases/snapshot.conf
 @@ -3,7 +3,7 @@ domain:install_linux_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
 index 6eed3f5..917f3ec 100644
 --- a/cases/windows_domain.conf
 +++ b/cases/windows_domain.conf
 @@ -3,7 +3,7 @@ domain:install_windows_cdrom
  $defaultname
  virt_type
  $defaulthv
 -guestos
 +os_type
  $defaultos
  guestarch
  $defaultarch
 diff --git a/repos/domain/install_image.py b/repos/domain/install_image.py
 index 80dcf1a..12c638e 100644
 --- a/repos/domain/install_image.py
 +++ b/repos/domain/install_image.py
 @@ -17,7 +17,7 @@ from utils import xml_builder
  
  HOME_PATH = os.getcwd()
  
 -required_params = ('guestname', 'virt_type', 'guestos', 'guestarch',)
 +required_params = ('guestname', 'virt_type', 'os_type', 'guestarch',)
  optional_params = ('uuid',
 'memory',
 'vcpu',
 @@ -35,12 +35,12 @@ def install_image(params):

Re: [libvirt] building error

2012-04-20 Thread Daniel Veillard
On Fri, Apr 20, 2012 at 02:26:31PM +0800, Wen Congyang wrote:
 When I build libvirt, I meet the following error message
 sometimes:
 
 make[4]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.11/docs'
   GENlibvirt-api.xml
   GENlibvirt-qemu-api.xml
   GENhtml/index.html
 ./libvirt-api.xml:2450: parser error : AttValue: ' expected
 function name='virConnectDomainEventDeregister' file='libvi

  hum ... libvirt-api.xml is generated by docs/apibuild.py

that's the first time I heard of a truncated output from that
program.

[...]
 unable to parse ./libvirt-api.xml
 make[4]: *** [html/index.html] Error 6
 make[4]: *** Waiting for unfinished jobs
 
 If I rebuild it without anything change, the building will success.

  It may be a problem of running make with a default parallel seting
and a bug in docs/Makefile.am where ./libvirt-api.xml would not be
properly serialized with the building of html/index.html.
  The weird thing is that from your output they seems to be serialized
but I would definitely investigate in that direction.

  I just checked from git head here and that seems to work fine 

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API PATCH 0/4]testcases will use xml file directly

2012-04-20 Thread Guannan Ren

Right now, for testcases that needs xml to define domain or storage, etc
they call module *utils/xmlbuilder.py  utils/xmlgenerator.py* to get back
a string of xml. These two module create xml string by xml.dom.minidom
This approach is hard to maintain and not easy to use. So we will depreciate it
in near furture.

The new way is to use xml file directly. There will be a new folder named
'xmls' in path repos/*/xmls, testcases will use the xmlfile in the foler
directly.

For example: domain:define
required_params = ('guestname', 'diskpath',)
optional_params = {'memory': 1048576,
   'vcpu': 1,
   'hddriver' : 'virtio',
   'nicdriver': 'virtio',
   'macaddr': '52:54:00:97:e4:28',
   'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
   'username': None,
   'password': None,
   'guesttype': 'kvm',
   'xml': 'xmls/kvm_guest_define.xml'
  }


The define.py will get the xml string of xmls/kvm_guest_define.xml and define 
it
directly. 
The framework takes the charge of getting the content of the file, replacing
some TEXT in it and passing the string to define.py for use.

The define.py supports any file in absolute path if the xml option is given in 
testcase
file like

domain:eventhandler
guestname
fedoraVM
diskpath
/var/lib/libvirt/images/fedoraVM
xml
/PATH/TO/FILE

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API PATCH 1/4] add a feature to support the use of xml file by testcases directly

2012-04-20 Thread Guannan Ren
src/testcasexml.py: the function will be called just before
calling main function in testcase. The purpose of it is to
replace the opition(if present) 'xml = file_path' with
'xml = xmlstring' and pass it into testcase after replacing
keywords in the xml file based on the opitional_params in testcase
---
 src/testcasexml.py |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 src/testcasexml.py

diff --git a/src/testcasexml.py b/src/testcasexml.py
new file mode 100644
index 000..742116b
--- /dev/null
+++ b/src/testcasexml.py
@@ -0,0 +1,61 @@
+
+
+import os
+import exception
+
+def xml_file_to_str(proxy_obj, mod_case, case_params):
+ get xml string from xml file in case_params
+return a new case_params with the string in it
+
+
+optional_params = proxy_obj.get_testcase_params(mod_case)[1]
+
+if case_params.has_key('xml'):
+file_name = case_params.pop('xml')
+elif optional_params.has_key('xml'):
+file_name = optional_params.pop('xml')
+else:
+return None
+
+# If file_name is not absolute path, that means
+# the file is in repos/*/xmls/
+# if it is absolute use it directly
+if not os.path.isabs(file_name):
+mod = mod_case.split(':')[0]
+file_path = os.path.join('repos', mod, file_name)
+else:
+file_path = file_name
+
+text = ''
+if os.path.exists(file_path):
+fh = open(file_path,'r')
+text = fh.read()
+fh.close()
+else:
+raise exception.FileDoesNotExist(xml file %s doesn't exist % 
xml_file_path)
+
+optional_params = proxy_obj.get_testcase_params(mod_case)[1]
+
+# replace the params that in testcase.conf first
+for (key, value) in case_params.items():
+
+if key == 'logger':
+continue
+
+key = key.upper()
+text = text.replace(key, value)
+
+# relace the optional params that defined in testcase.py
+for (key, value) in optional_params.items():
+
+if key == 'xml':
+continue
+
+key = key.upper()
+if value == None:
+value = ''
+
+text = text.replace(key, str(value))
+
+case_params['xml'] = text
+return case_params
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API PATCH 3/4] example: modify define.py to use the feature

2012-04-20 Thread Guannan Ren
repos/domain/define.py
repos/domain/xmls/kvm_guest_define.xml:
the define.py will use the kvm_guest_define.xml by default.
it also support a file given by user.
---
 repos/domain/define.py |   50 ++-
 repos/domain/xmls/kvm_guest_define.xml |   47 ++
 2 files changed, 70 insertions(+), 27 deletions(-)
 create mode 100644 repos/domain/xmls/kvm_guest_define.xml

diff --git a/repos/domain/define.py b/repos/domain/define.py
index c8fe20e..18e87ac 100644
--- a/repos/domain/define.py
+++ b/repos/domain/define.py
@@ -14,21 +14,21 @@ from src import sharedmod
 from utils import utils
 from utils import xmlbuilder
 
-required_params = ('guestname', 'guesttype',)
-optional_params = ('uuid',
-   'memory',
-   'vcpu',
-   'disksize',
-   'fullimagepath',
-   'imagetype',
-   'hdmodel',
-   'nicmodel',
-   'macaddr',
-   'ifacetype',
-   'source',)
+required_params = ('guestname', 'diskpath',)
+optional_params = {'memory': 1048576,
+   'vcpu': 1,
+   'hddriver' : 'virtio',
+   'nicdriver': 'virtio',
+   'macaddr': '52:54:00:97:e4:28',
+   'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
+   'username': None,
+   'password': None,
+   'guesttype': 'kvm',
+   'xml': 'xmls/kvm_guest_define.xml'
+  }
 
 def check_define_domain(guestname, guesttype, hostname, username, \
-password, util, logger):
+password, logger):
 Check define domain result, if define domain is successful,
guestname.xml will exist under /etc/libvirt/qemu/
and can use virt-xml-validate tool to check the file validity
@@ -59,29 +59,25 @@ def define(params):
 Define a domain from xml
 logger = params['logger']
 guestname = params['guestname']
-guesttype = params['guesttype']
+
+xmlstr = params['xml']
+logger.debug(domain xml:\n%s % xmlstr)
+
 conn = sharedmod.libvirtobj['conn']
 uri = conn.getURI()
 
-hostname = utils.parser_uri(uri)[1]
+hostname = utils.parse_uri(uri)[1]
+username = params.get('username', '')
+password = params.get('password', '')
+guesttype = params.get('guesttype', 'kvm')
 
-username = params['username']
-password = params['password']
 logger.info(define domain on %s % uri)
 
-# Generate damain xml
-xml_obj = xmlbuilder.XmlBuilder()
-domain = xml_obj.add_domain(params)
-xml_obj.add_disk(params, domain)
-xml_obj.add_interface(params, domain)
-dom_xml = xml_obj.build_domain(domain)
-logger.debug(domain xml:\n%s %dom_xml)
-
 # Define domain from xml
 try:
-conn.defineXML(dom_xml)
+conn.defineXML(xmlstr)
 if check_define_domain(guestname, guesttype, hostname, \
-   username, password, util, logger):
+   username, password, logger):
 logger.info(define a domain form xml is successful)
 else:
 logger.error(fail to check define domain)
diff --git a/repos/domain/xmls/kvm_guest_define.xml 
b/repos/domain/xmls/kvm_guest_define.xml
new file mode 100644
index 000..385ec66
--- /dev/null
+++ b/repos/domain/xmls/kvm_guest_define.xml
@@ -0,0 +1,47 @@
+domain type='kvm'
+  nameGUESTNAME/name
+  uuidUUID/uuid
+  memory unit='KiB'MEMORY/memory
+  currentMemory unit='KiB'MEMORY/currentMemory
+  vcpuVCPU/vcpu
+  os
+type arch='x86_64' machine='pc-0.14'hvm/type
+boot dev='hd'/
+  /os
+  features
+acpi/
+apic/
+pae/
+  /features
+  clock offset='utc'/
+  on_poweroffdestroy/on_poweroff
+  on_rebootrestart/on_reboot
+  on_crashrestart/on_crash
+  devices
+disk type='file' device='disk'
+  driver name='qemu' type='qcow2'/
+  source file='DISKPATH'/
+  target dev='vda' bus='HDDRIVER'/
+/disk
+interface type='network'
+  mac address='MACADDR'/
+  model type='NICDRIVER'/
+  source network='default'/
+/interface
+serial type='pty'
+  target port='0'/
+/serial
+console type='pty'
+  target type='serial' port='0'/
+/console
+input type='mouse' bus='ps2'/
+graphics type='vnc' port='-1' autoport='yes'/
+sound model='ich6'
+/sound
+video
+  model type='cirrus' vram='9216' heads='1'/
+/video
+memballoon model='virtio'
+/memballoon
+  /devices
+/domain
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [test-API PATCH 2/4] modify framework to support it

2012-04-20 Thread Guannan Ren
libvirt-test-api: pass proxy_obj to generator, and support dict type
  of optional_params
src/generator.py: call xml_file_to_str()
src/proxy.py: get the optional_params of a testcase
---
 libvirt-test-api |3 ++-
 src/generator.py |7 ++-
 src/proxy.py |   17 +
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/libvirt-test-api b/libvirt-test-api
index 373e5c6..a7c9138 100644
--- a/libvirt-test-api
+++ b/libvirt-test-api
@@ -147,6 +147,7 @@ class Main(object):
 logfile = os.path.join('log/%s' % testrunid, logname)
 procs.append(generator.FuncGen(cases_func_ref_dict,
cases_checkfunc_ref_dict,
+   proxy_obj,
activity,
logfile,
testrunid,
@@ -244,7 +245,7 @@ class Main(object):
 string +=   * 8 + p.upper() + \n
 for p in optional_params:
 string +=   * 4 + [ + p + ]\n
-string +=   * 8 + p.upper() + \n
+string +=   * 8 + optional_params[p] + \n
 
 if proxy_obj.has_clean_function(key):
 string += clean\n
diff --git a/src/generator.py b/src/generator.py
index e3bc344..5d7bc96 100644
--- a/src/generator.py
+++ b/src/generator.py
@@ -25,6 +25,7 @@ import os
 import traceback
 
 from src import mapper
+from src.testcasexml import xml_file_to_str
 from utils import log
 from utils import format
 from utils import env_parser
@@ -41,12 +42,14 @@ class FuncGen(object):
  To generate a callable testcase
 def __init__(self, cases_func_ref_dict,
  cases_checkfunc_ref_dict,
+ proxy_obj,
  activity, logfile,
  testrunid, testid,
  log_xml_parser, lockfile,
  loglevel):
 self.cases_func_ref_dict = cases_func_ref_dict
 self.cases_checkfunc_ref_dict = cases_checkfunc_ref_dict
+self.proxy_obj = proxy_obj
 self.logfile = logfile
 self.testrunid = testrunid
 self.testid = testid
@@ -131,7 +134,7 @@ class FuncGen(object):
 
 case_start_time = time.strftime(%Y-%m-%d %H:%M:%S)
 
-ret = 0
+ret = 1
 try:
 try:
 if mod_case_func == 'sleep':
@@ -140,6 +143,8 @@ class FuncGen(object):
 time.sleep(int(sleepsecs))
 ret = 0
 else:
+xml_file_to_str(self.proxy_obj, mod_case, case_params)
+
 ret = 
self.cases_func_ref_dict[mod_case_func](case_params)
 # In the case where testcase return -1 on error
 if ret  0: ret = 1
diff --git a/src/proxy.py b/src/proxy.py
index 623fa43..fe50fff 100644
--- a/src/proxy.py
+++ b/src/proxy.py
@@ -130,6 +130,23 @@ class Proxy(object):
   (required_params or optional_params not found in %s % 
modcase)
 return case_params
 
+def get_testcase_params(self, modcase):
+ Return a pair of required_params and optional_params
+for a testcase
+
+if not modcase:
+return None
+
+casemod_ref = self.testcase_ref_dict[modcase]
+var_func_names = dir(casemod_ref)
+
+if 'required_params' not in var_func_names \
+   or 'optional_params' not in var_func_names:
+raise exception.TestCaseError\
+  (required_params or optional_params not found in %s % 
modcase)
+
+return [casemod_ref.required_params, casemod_ref.optional_params]
+
 def has_clean_function(self, testcase_name):
  Return true if the testcase have clean function
 
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Martin Kletzander
On 04/20/2012 10:29 AM, Osier Yang wrote:
 On 2012年04月20日 16:17, Martin Kletzander wrote:
 On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
   .../en-US/Creating_a_configuration_file.xml|   82
 ++--
   .../en-US/Writing_a_test_case.xml  |   24 +++---
   .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
   repos/domain/domain_list.py|   12 ++--
   repos/domain/install_linux_cdrom.py|   18 ++--
   repos/domain/install_linux_net.py  |8 +-
   repos/domain/install_windows_cdrom.py  |6 +-
   repos/domain/update_devflag.py |6 +-
   8 files changed, 87 insertions(+), 87 deletions(-)

 diff --git
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 index 80ebdb1..ffac187 100644
 ---
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 +++
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 @@ -90,7 +90,7 @@ module:test_case
   example
   titleConfiguration file/title
   programlisting
 -Domain:install_guest
 +Domain:install_domain
   guestname
   rhel5u4
   memory
 @@ -105,7 +105,7 @@ Domain:install_guest
   titleList data structure/title
   programlisting
   [
 -  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory':
 '1024', 'vcpu': '1'}}]
 +  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory':
 '1024', 'vcpu': '1'}}]

 I'm not sure about this. The thing we're creating is a domain, but we're
 installing a guest, am I right? (thus the guestname and later
 guestip and so on. But I could be wrong. Also even if I'm not, the
 question is how much we want to separate this in order to keep it
 readable.
 
 
 I'm not quite sure about it either, but I would like to post the patch
 so there could be discussion, IIRC, there was discussion about the TERM
 domain and guest before too. Anyway, there should be guidelines for
 it, mixing use of both of them at liberty can just produce messy codes.
 
 Osier

It's written in the guide: http://libvirt.org/devguide.html but I'm not
sure even after reading it. It's not _defined_ there, so we should
probably go with our gut on this one. After looking at the code with all
the patches applied, I think this could be ok, we have only few words
with guest in it and they make sense, so for the sake of stabilizing the
code asap, ACK.

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [test-API PATCH 4/4] change the type of optional_params from list to dictionary

2012-04-20 Thread Guannan Ren
The dictionary could support the string replacement in
xml file.
---
 repos/domain/attach_disk.py|2 +-
 repos/domain/attach_interface.py   |2 +-
 repos/domain/autostart.py  |2 +-
 repos/domain/balloon_memory.py |2 +-
 repos/domain/blkstats.py   |2 +-
 repos/domain/console_io.py |7 -
 repos/domain/console_mutex.py  |2 +-
 repos/domain/cpu_affinity.py   |2 +-
 repos/domain/cpu_topology.py   |2 +-
 repos/domain/create.py |   24 ++
 repos/domain/destroy.py|2 +-
 repos/domain/detach_disk.py|2 +-
 repos/domain/detach_interface.py   |2 +-
 repos/domain/domain_blkinfo.py |2 +-
 repos/domain/domain_id.py  |2 +-
 repos/domain/domain_list.py|2 +-
 repos/domain/domain_name.py|2 +-
 repos/domain/domain_uuid.py|2 +-
 repos/domain/domblkinfo.py |2 +-
 repos/domain/dump.py   |2 +-
 repos/domain/eventhandler.py   |2 +-
 repos/domain/hostname.py   |2 +-
 repos/domain/ifstats.py|2 +-
 repos/domain/install_image.py  |   20 ++-
 repos/domain/install_linux_cdrom.py|   26 ++--
 repos/domain/install_linux_check.py|   10 +---
 repos/domain/install_linux_net.py  |   24 ++
 repos/domain/install_windows_cdrom.py  |   26 ++--
 repos/domain/migrate.py|2 +-
 repos/domain/ownership_test.py |2 +-
 repos/domain/reboot.py |2 +-
 repos/domain/restore.py|2 +-
 repos/domain/resume.py |2 +-
 repos/domain/save.py   |2 +-
 repos/domain/sched_params.py   |2 +-
 repos/domain/screenshot.py |2 +-
 repos/domain/shutdown.py   |2 +-
 repos/domain/start.py  |2 +-
 repos/domain/suspend.py|2 +-
 repos/domain/undefine.py   |2 +-
 repos/domain/update_devflag.py |2 +-
 repos/domain/xmls/replace.py   |7 +
 repos/interface/create.py  |2 +-
 repos/interface/define.py  |2 +-
 repos/interface/destroy.py |2 +-
 repos/interface/iface_list.py  |2 +-
 repos/interface/iface_mac.py   |2 +-
 repos/interface/iface_name.py  |2 +-
 repos/interface/undefine.py|2 +-
 repos/libvirtd/qemu_hang.py|2 +-
 repos/libvirtd/restart.py  |2 +-
 repos/libvirtd/upstart.py  |2 +-
 repos/network/autostart.py |2 +-
 repos/network/create.py|2 +-
 repos/network/define.py|2 +-
 repos/network/destroy.py   |2 +-
 repos/network/network_list.py  |2 +-
 repos/network/network_name.py  |2 +-
 repos/network/network_uuid.py  |2 +-
 repos/network/start.py |2 +-
 repos/network/undefine.py  |2 +-
 repos/nodedevice/detach.py |2 +-
 repos/nodedevice/reattach.py   |2 +-
 repos/nodedevice/reset.py  |2 +-
 repos/npiv/create_virtual_hba.py   |2 +-
 .../multiple_thread_block_on_domain_create.py  |2 +-
 repos/remoteAccess/tcp_setup.py|2 +-
 repos/remoteAccess/tls_setup.py|2 +-
 repos/remoteAccess/unix_perm_sasl.py   |2 +-
 repos/sVirt/domain_nfs_start.py|2 +-
 repos/snapshot/delete.py   |2 +-
 repos/snapshot/file_flag.py|2 +-
 repos/snapshot/flag_check.py   |2 +-
 repos/snapshot/internal_create.py  |2 +-
 repos/snapshot/revert.py   |2 +-
 repos/snapshot/snapshot_list.py|2 +-
 repos/storage/activate_pool.py |2 +-
 repos/storage/build_dir_pool.py|  

Re: [libvirt] building error

2012-04-20 Thread Wen Congyang
At 04/20/2012 04:50 PM, Daniel Veillard Wrote:
 On Fri, Apr 20, 2012 at 02:26:31PM +0800, Wen Congyang wrote:
 When I build libvirt, I meet the following error message
 sometimes:

 make[4]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.11/docs'
   GENlibvirt-api.xml
   GENlibvirt-qemu-api.xml
   GENhtml/index.html
 ./libvirt-api.xml:2450: parser error : AttValue: ' expected
 function name='virConnectDomainEventDeregister' file='libvi
 
   hum ... libvirt-api.xml is generated by docs/apibuild.py
 
 that's the first time I heard of a truncated output from that
 program.
 
 [...]
 unable to parse ./libvirt-api.xml
 make[4]: *** [html/index.html] Error 6
 make[4]: *** Waiting for unfinished jobs

 If I rebuild it without anything change, the building will success.
 
   It may be a problem of running make with a default parallel seting
 and a bug in docs/Makefile.am where ./libvirt-api.xml would not be
 properly serialized with the building of html/index.html.
   The weird thing is that from your output they seems to be serialized
 but I would definitely investigate in that direction.
 
   I just checked from git head here and that seems to work fine 

The following is my build script:

=
./autogen.sh
if [[ $? -ne 0 ]]; then
exit 1
fi

perl -pi -e 's/ *-O2//' configure #remove -O2 from configure
if [[ $? -ne 0 ]]; then
exit 1
fi

./configure --enable-compile-warnings=error
if [[ $? -ne 0 ]]; then
exit 1
fi

make syntax-check
if [[ $? -ne 0 ]]; then
exit 1
fi

perl -pi -e 's/ --enable-compile-warnings=error//' libvirt.spec
perl -pi -e 's/%configure/%configure --enable-compile-warnings=error/' 
libvirt.spec

make dist
if [[ $? -ne 0 ]]; then
exit 1
fi

rpmbuild --define _sourcedir `pwd`  --define _without-numad 1 -ba 
libvirt.spec
=

Thanks
Wen Congyang
 
 Daniel
 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] openvz; wire up getHostname

2012-04-20 Thread Guido Günther
On Thu, Apr 19, 2012 at 04:40:58PM -0600, Eric Blake wrote:
 On 04/19/2012 04:32 PM, Guido Günther wrote:
  ---
  Trivial thing missing in the openvz driver.
  Cheers,
   -- Guido
  
   src/openvz/openvz_driver.c |1 +
   1 file changed, 1 insertion(+)
  
  diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
  index 0451c22..7ec327d 100644
  --- a/src/openvz/openvz_driver.c
  +++ b/src/openvz/openvz_driver.c
  @@ -1679,6 +1679,7 @@ static virDriver openvzDriver = {
   .close = openvzClose, /* 0.3.1 */
   .type = openvzGetType, /* 0.3.1 */
   .version = openvzGetVersion, /* 0.5.0 */
  +.getHostname = virGetHostname, /* 0.9.12 */
 
 ACK.
Pushed. Thanks,
 -- Guido

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Alex Jia

On 04/20/2012 04:29 PM, Osier Yang wrote:

On 2012年04月20日 16:17, Martin Kletzander wrote:

On 04/20/2012 08:46 AM, Osier Yang wrote:

---
  .../en-US/Creating_a_configuration_file.xml|   82 
++--

  .../en-US/Writing_a_test_case.xml  |   24 +++---
  .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
  repos/domain/domain_list.py|   12 ++--
  repos/domain/install_linux_cdrom.py|   18 ++--
  repos/domain/install_linux_net.py  |8 +-
  repos/domain/install_windows_cdrom.py  |6 +-
  repos/domain/update_devflag.py |6 +-
  8 files changed, 87 insertions(+), 87 deletions(-)

diff --git 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml 


index 80ebdb1..ffac187 100644
--- 
a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
+++ 
b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

@@ -90,7 +90,7 @@ module:test_case
example
titleConfiguration file/title
programlisting
-Domain:install_guest
+Domain:install_domain
  guestname
  rhel5u4
  memory
@@ -105,7 +105,7 @@ Domain:install_guest
titleList data structure/title
programlisting
  [
-  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory': 
'1024', 'vcpu': '1'}}]
+  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory': 
'1024', 'vcpu': '1'}}]


I'm not sure about this. The thing we're creating is a domain, but we're
installing a guest, am I right? (thus the guestname and later
guestip and so on. But I could be wrong. Also even if I'm not, the
question is how much we want to separate this in order to keep it 
readable.



I'm not quite sure about it either, but I would like to post the patch
so there could be discussion, IIRC, there was discussion about the TERM
domain and guest before too. Anyway, there should be guidelines for
it, mixing use of both of them at liberty can just produce messy codes.

I feel 'domain' should be a xen terminology such as domain 0(dom0) and 
domain U(domU),
and domU is a user domains, as usual, called a guest in kvm/qemu, 
however, it's not very

clear such as some guys say xen guest domain :-(


Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] Schedule for next release libvirt-0.9.12

2012-04-20 Thread Daniel Veillard
  Assuming we try to stay on a monthly schedule, then I would
suggest to enter the freeze around next Friday (27th April)
and shoot for a release around the 4th of May.
  I'm supposed to be in vacation most of next week, but I think
I will still be able to make the release candidate 1
  We have a number of patch set which need further review to
be pushed fully, and there are a few things in
  http://libvirt.org/pending.html
which aren't false positive that we really ought to check and push :-)

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [test-API 07/17] Substitute _guest with _domain

2012-04-20 Thread Martin Kletzander
On 04/20/2012 11:16 AM, Alex Jia wrote:
 On 04/20/2012 04:29 PM, Osier Yang wrote:
 On 2012年04月20日 16:17, Martin Kletzander wrote:
 On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
   .../en-US/Creating_a_configuration_file.xml|   82
 ++--
   .../en-US/Writing_a_test_case.xml  |   24 +++---
   .../libvirt-test-API_Guide/en-US/extras/log.txt|   18 ++--
   repos/domain/domain_list.py|   12 ++--
   repos/domain/install_linux_cdrom.py|   18 ++--
   repos/domain/install_linux_net.py  |8 +-
   repos/domain/install_windows_cdrom.py  |6 +-
   repos/domain/update_devflag.py |6 +-
   8 files changed, 87 insertions(+), 87 deletions(-)

 diff --git
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 index 80ebdb1..ffac187 100644
 ---
 a/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 +++
 b/docs/User_Guide/libvirt-test-API_Guide/en-US/Creating_a_configuration_file.xml

 @@ -90,7 +90,7 @@ module:test_case
 example
 titleConfiguration file/title
 programlisting
 -Domain:install_guest
 +Domain:install_domain
   guestname
   rhel5u4
   memory
 @@ -105,7 +105,7 @@ Domain:install_guest
 titleList data structure/title
 programlisting
   [
 -  [{'domain:install_guest': {'guestname': 'rhel5u4', 'memory':
 '1024', 'vcpu': '1'}}]
 +  [{'domain:install_domain': {'guestname': 'rhel5u4', 'memory':
 '1024', 'vcpu': '1'}}]

 I'm not sure about this. The thing we're creating is a domain, but we're
 installing a guest, am I right? (thus the guestname and later
 guestip and so on. But I could be wrong. Also even if I'm not, the
 question is how much we want to separate this in order to keep it
 readable.


 I'm not quite sure about it either, but I would like to post the patch
 so there could be discussion, IIRC, there was discussion about the TERM
 domain and guest before too. Anyway, there should be guidelines for
 it, mixing use of both of them at liberty can just produce messy codes.

 I feel 'domain' should be a xen terminology such as domain 0(dom0) and
 domain U(domU),
 and domU is a user domains, as usual, called a guest in kvm/qemu,
 however, it's not very
 clear such as some guys say xen guest domain :-(

I feel it a little bit different. I know I'm in no position to have a
firm stance on this subject, but let me explain what I mean.

From my point of view, domain is a (virtual) machine. The system running
inside the VM is guest. However, there are things that might have
connection with both. This is clearly the where do we draw the line
kind of case. I think HW-related terms could be called 'domain' (e.g.
MAC address), which would make the SW-related called 'guest'. When it
sounds good, there is no problem with calling something 'guest domain',
but just when it feels right (and that's probably just when it means
domain, as it is the subjective noun in this case, whether guest is
just an adjective). I got caught in a moment and went a little deep, I
know, sorry for that.

Just my $0.02

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [test-API 08/17] Substitute 'guest ' with 'domain '

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  cases/migration/ssh_persistent_paused_no_dst.conf  |2 +-
  .../migration/ssh_persistent_paused_with_dst.conf  |2 +-
  cases/migration/ssh_persistent_running_no_dst.conf |2 +-
  .../migration/ssh_persistent_running_with_dst.conf |2 +-
  cases/migration/ssh_transient_paused_no_dst.conf   |2 +-
  cases/migration/ssh_transient_paused_with_dst.conf |2 +-
  cases/migration/ssh_transient_running_no_dst.conf  |2 +-
  .../migration/ssh_transient_running_with_dst.conf  |2 +-
  cases/migration/tcp_persistent_paused_no_dst.conf  |2 +-
  .../migration/tcp_persistent_paused_with_dst.conf  |2 +-
  cases/migration/tcp_persistent_running_no_dst.conf |2 +-
  .../migration/tcp_persistent_running_with_dst.conf |2 +-
  .../tcp_sasl_persistent_paused_no_dst.conf |2 +-
  .../tcp_sasl_persistent_paused_with_dst.conf   |2 +-
  .../tcp_sasl_persistent_running_no_dst.conf|2 +-
  .../tcp_sasl_persistent_running_with_dst.conf  |2 +-
  .../tcp_sasl_transient_paused_no_dst.conf  |2 +-
  .../tcp_sasl_transient_paused_with_dst.conf|2 +-
  .../tcp_sasl_transient_running_no_dst.conf |2 +-
  .../tcp_sasl_transient_running_with_dst.conf   |2 +-
  cases/migration/tcp_transient_paused_no_dst.conf   |2 +-
  cases/migration/tcp_transient_paused_with_dst.conf |2 +-
  cases/migration/tcp_transient_running_no_dst.conf  |2 +-
  .../migration/tcp_transient_running_with_dst.conf  |2 +-
  cases/migration/tls_persistent_paused_no_dst.conf  |2 +-
  .../migration/tls_persistent_paused_with_dst.conf  |2 +-
  cases/migration/tls_persistent_running_no_dst.conf |2 +-
  .../migration/tls_persistent_running_with_dst.conf |2 +-
  .../tls_sasl_persistent_paused_no_dst.conf |2 +-
  .../tls_sasl_persistent_paused_with_dst.conf   |2 +-
  .../tls_sasl_persistent_running_no_dst.conf|2 +-
  .../tls_sasl_persistent_running_with_dst.conf  |2 +-
  .../tls_sasl_transient_paused_no_dst.conf  |2 +-
  .../tls_sasl_transient_paused_with_dst.conf|2 +-
  .../tls_sasl_transient_running_no_dst.conf |2 +-
  .../tls_sasl_transient_running_with_dst.conf   |2 +-
  cases/migration/tls_transient_paused_no_dst.conf   |2 +-
  cases/migration/tls_transient_paused_with_dst.conf |2 +-
  cases/migration/tls_transient_running_no_dst.conf  |2 +-
  .../migration/tls_transient_running_with_dst.conf  |2 +-
  .../en-US/Understanding_libvirt-test-API.xml   |2 +-
  .../en-US/Writing_a_test_case.xml  |   14 +++---
  .../libvirt-test-API_Guide/en-US/extras/log.txt|8 ++--
  global.cfg |   14 +++---
  repos/domain/attach_disk.py|4 +-
  repos/domain/attach_interface.py   |4 +-
  repos/domain/autostart.py  |2 +-
  repos/domain/balloon_memory.py |   42 +++---
  repos/domain/blkstats.py   |2 +-
  repos/domain/console_io.py |4 +-
  repos/domain/console_mutex.py  |2 +-
  repos/domain/cpu_affinity.py   |   22 
  repos/domain/cpu_topology.py   |   14 +++---
  repos/domain/create.py |4 +-
  repos/domain/define.py |2 +-
  repos/domain/destroy.py|6 +-
  repos/domain/detach_disk.py|4 +-
  repos/domain/detach_interface.py   |4 +-
  repos/domain/domain_blkinfo.py |2 +-
  repos/domain/domain_id.py  |2 +-
  repos/domain/domain_list.py|   10 ++--
  repos/domain/domain_name.py|4 +-
  repos/domain/domain_uuid.py|4 +-
  repos/domain/domblkinfo.py |2 +-
  repos/domain/dump.py   |   14 +++---
  repos/domain/eventhandler.py   |6 +-
  repos/domain/ifstats.py|2 +-
  repos/domain/install_image.py  |   14 +++---
  repos/domain/install_linux_cdrom.py|   58 
 ++--
  repos/domain/install_linux_check.py|   36 ++--
  repos/domain/install_linux_net.py  |   52 +-
  repos/domain/install_windows_cdrom.py  |   50 +-
  repos/domain/migrate.py|2 +-
  repos/domain/restore.py|   16 +++---
  repos/domain/save.py   |   16 +++---
  repos/domain/sched_params.py   |2 +-
  repos/domain/shutdown.py  

Re: [libvirt] [test-API 11/17] Substitute 'guestip' with 'domip'

2012-04-20 Thread Martin Kletzander
On 04/20/2012 08:46 AM, Osier Yang wrote:
 ---
  repos/domain/update_devflag.py |   20 ++--
  1 files changed, 10 insertions(+), 10 deletions(-)
 
 diff --git a/repos/domain/update_devflag.py b/repos/domain/update_devflag.py
 index f1ecf32..e87b1e5 100644
 --- a/repos/domain/update_devflag.py
 +++ b/repos/domain/update_devflag.py
 @@ -77,7 +77,7 @@ def create_image(params, util, img_name):
  
  return True
  
 -def check_device_in_domain(params, util, guestip):
 +def check_device_in_domain(params, util, domip):
  Check updated device in guest
  logger = params['logger']
  
 @@ -89,7 +89,7 @@ def check_device_in_domain(params, util, guestip):
  logger.error(it's not a cdrom or floppy device.)
  return False, None
  
 -ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
 +ret, output = utils.remote_exec_pexpect(domip, params['username'], \
 params['password'], cmd)
  logger.debug(output)
  if ret:
 @@ -98,7 +98,7 @@ def check_device_in_domain(params, util, guestip):
  
  time.sleep(5)
  
 -ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
 +ret, output = utils.remote_exec_pexpect(domip, params['username'], \
 params['password'], umount 
 /media)
  logger.debug(output)
  if ret:
 @@ -107,7 +107,7 @@ def check_device_in_domain(params, util, guestip):
  
  time.sleep(5)
  
 -ret, output = utils.remote_exec_pexpect(guestip, params['username'], \
 +ret, output = utils.remote_exec_pexpect(domip, params['username'], \
 params['password'], ls /media)
  logger.debug(output)
  if ret:
 @@ -117,7 +117,7 @@ def check_device_in_domain(params, util, guestip):
  
  return True, output
  
 -def check_updated_device(params, output, util, guestip, domobj, srcfile):
 +def check_updated_device(params, output, util, domip, domobj, srcfile):
  Check if the device is updated
  logger = params['logger']
  xmlobj = domobj.XMLDesc(0)
 @@ -129,7 +129,7 @@ def check_updated_device(params, output, util, guestip, 
 domobj, srcfile):
  elif diskTag.parentNode.getAttribute('device') == 'floppy':
  upfile = diskTag.getAttribute(file)
  
 -res = check_device_in_domain(params, util, guestip)
 +res = check_device_in_domain(params, util, domip)
  if res[0] and cmp(res[1], output):
  if upfile == srcfile:
  logger.debug(checking fail.)
 @@ -172,8 +172,8 @@ def update_devflag(params):
  flag = libvirt.VIR_DOMAIN_AFFECT_CONFIG
  
  mac = utils.get_dom_mac_addr(guestname)
 -guestip = utils.mac_to_ip(mac, 180)
 -logger.debug(ip address: %s % guestip)
 +domip = utils.mac_to_ip(mac, 180)
 +logger.debug(ip address: %s % domip)
  
  conn = sharedmod.libvirtobj['conn']
  
 @@ -211,7 +211,7 @@ def update_devflag(params):
  return 1
  
  time.sleep(60)
 -ret, output = check_device_in_domain(params, util, guestip)
 +ret, output = check_device_in_domain(params, util, domip)
  logger.debug(output)
  if not ret:
  return 1
 @@ -249,7 +249,7 @@ def update_devflag(params):
  return 1
  
  result = check_updated_device(params, output, util, \
 -   guestip, domobj, srcfile)
 +   domip, domobj, srcfile)
  if result[0]:
  logger.error(fail to update '%s' device: %s\n % (devtype, 
 result[1]))
  return 1

This one I'd rather reconsider with the others, guest ip is better I
think. Just my opinion though.

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Python binding APIs strict or loose

2012-04-20 Thread Guannan Ren




   Hi

There is a question. we need strict python binding API 
or loose one.


For example:
The setSchedulerParameters(), it accepts one of 
parameters: 'vcpu_quota'
In C its type is of 'long long', then we need a 
conversion from PyInt/PyLong
to 'long long' by using cpython function 
'PyLong_AsLongLong'.
The problem is when the user python pass in a value of 
type Pyfloat instead
of PyInt/PyLong, the cpython function drops the 
fraction part of the value
automatically, Is it what we want or we need to add a 
type checking to ensure that
the type of value passed in is PyInt/PyLong, otherwise, 
we raise an exception.



 dom.schedulerParameters()
{'vcpu_quota': -1L, 'vcpu_period': 10L, 
'cpu_shares': 500L}



 dom.setSchedulerParameters({'vcpu_quota': 10.88})

works as dom.setSchedulerParameters({'vcpu_quota': 10})

Any idea?

Guannan Ren

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2] Improve on virAtomic implementation

2012-04-20 Thread Stefan Berger

This patch improves the previously added virAtomicInt implementation
by using gcc-builtins if possible. The needed builtins are available
since GCC = 4.1. At least the 4.0 docs don't mention them.

---
 src/util/viratomic.h |   95 
++-

 1 file changed, 79 insertions(+), 16 deletions(-)

Index: libvirt-acl/src/util/viratomic.h
===
--- libvirt-acl.orig/src/util/viratomic.h
+++ libvirt-acl/src/util/viratomic.h
@@ -30,6 +30,29 @@
 typedef struct _virAtomicInt virAtomicInt;
 typedef virAtomicInt *virAtomicIntPtr;

+# define __VIR_ATOMIC_USES_LOCK
+
+# if ((__GNUC__ == 4)  (__GNUC_MINOR__ = 1)) || (__GNUC__  4)
+#  undef __VIR_ATOMIC_USES_LOCK
+# endif
+
+static inline int virAtomicIntInit(virAtomicIntPtr vaip)
+ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+static inline int virAtomicIntRead(virAtomicIntPtr vaip)
+ATTRIBUTE_NONNULL(1);
+static inline void virAtomicIntSet(virAtomicIntPtr vaip, int val)
+ATTRIBUTE_NONNULL(1);
+static inline int virAtomicIntAdd(virAtomicIntPtr vaip, int add)
+ATTRIBUTE_NONNULL(1);
+static inline int virAtomicIntSub(virAtomicIntPtr vaip, int add)
+ATTRIBUTE_NONNULL(1);
+static inline int virAtomicIntInc(virAtomicIntPtr vaip)
+ATTRIBUTE_NONNULL(1);
+static inline int virAtomicIntDec(virAtomicIntPtr vaip)
+ATTRIBUTE_NONNULL(1);
+
+# ifdef __VIR_ATOMIC_USES_LOCK
+
 struct _virAtomicInt {
 virMutex lock;
 int value;
@@ -42,22 +65,6 @@ virAtomicIntInit(virAtomicIntPtr vaip)
 return virMutexInit(vaip-lock);
 }

-static inline void
-virAtomicIntSet(virAtomicIntPtr vaip, int value)
-{
- virMutexLock(vaip-lock);
-
- vaip-value = value;
-
- virMutexUnlock(vaip-lock);
-}
-
-static inline int
-virAtomicIntRead(virAtomicIntPtr vaip)
-{
- return vaip-value;
-}
-
 static inline int
 virAtomicIntAdd(virAtomicIntPtr vaip, int add)
 {
@@ -88,4 +95,60 @@ virAtomicIntSub(virAtomicIntPtr vaip, in
 return ret;
 }

+# else /* __VIR_ATOMIC_USES_LOCK */
+
+struct _virAtomicInt {
+int value;
+};
+
+static inline int
+virAtomicIntInit(virAtomicIntPtr vaip)
+{
+vaip-value = 0;
+return 0;
+}
+
+static inline int
+virAtomicIntAdd(virAtomicIntPtr vaip, int add)
+{
+return __sync_add_and_fetch(vaip-value, add);
+}
+
+static inline int
+virAtomicIntSub(virAtomicIntPtr vaip, int sub)
+{
+return __sync_sub_and_fetch(vaip-value, sub);
+}
+
+# endif /* __VIR_ATOMIC_USES_LOCK */
+
+
+
+/* common operations that need no locking or build on others */
+
+
+static inline void
+virAtomicIntSet(virAtomicIntPtr vaip, int value)
+{
+ vaip-value = value;
+}
+
+static inline int
+virAtomicIntRead(virAtomicIntPtr vaip)
+{
+ return *(volatile int *)vaip-value;
+}
+
+static inline int
+virAtomicIntInc(virAtomicIntPtr vaip)
+{
+return virAtomicIntAdd(vaip, 1);
+}
+
+static inline int
+virAtomicIntDec(virAtomicIntPtr vaip)
+{
+return virAtomicIntSub(vaip, 1);
+}
+
 #endif /* __VIR_ATOMIC_H */

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-glib 1/5] Make GVirConfigDomainTimer abstract

2012-04-20 Thread Christophe Fergeau
Ping?

Christophe

On Fri, Apr 13, 2012 at 05:20:14PM +0200, Christophe Fergeau wrote:
 Specialized timer classes will inherit from it
 ---
  libvirt-gconfig/libvirt-gconfig-domain-timer.c |   22 +-
  libvirt-gconfig/libvirt-gconfig-domain-timer.h |4 
  libvirt-gconfig/libvirt-gconfig.sym|2 --
  3 files changed, 1 insertion(+), 27 deletions(-)
 
 diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c 
 b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
 index 70215ae..67a1812 100644
 --- a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
 +++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
 @@ -32,7 +32,7 @@ struct _GVirConfigDomainTimerPrivate
  gboolean unused;
  };
  
 -G_DEFINE_TYPE(GVirConfigDomainTimer, gvir_config_domain_timer, 
 GVIR_CONFIG_TYPE_OBJECT);
 +G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainTimer, gvir_config_domain_timer, 
 GVIR_CONFIG_TYPE_OBJECT);
  
  
  static void gvir_config_domain_timer_class_init(GVirConfigDomainTimerClass 
 *klass)
 @@ -47,23 +47,3 @@ static void 
 gvir_config_domain_timer_init(GVirConfigDomainTimer *timer)
  
  timer-priv = GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(timer);
  }
 -
 -
 -GVirConfigDomainTimer *gvir_config_domain_timer_new(void)
 -{
 -GVirConfigObject *object;
 -
 -object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_TIMER, timer, 
 NULL);
 -return GVIR_CONFIG_DOMAIN_TIMER(object);
 -}
 -
 -
 -GVirConfigDomainTimer *gvir_config_domain_timer_new_from_xml(const gchar 
 *xml,
 -GError **error)
 -{
 -GVirConfigObject *object;
 -
 -object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_TIMER,
 - timer, NULL, xml, error);
 -return GVIR_CONFIG_DOMAIN_TIMER(object);
 -}
 diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.h 
 b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
 index 11038e2..a7b4332 100644
 --- a/libvirt-gconfig/libvirt-gconfig-domain-timer.h
 +++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.h
 @@ -59,10 +59,6 @@ struct _GVirConfigDomainTimerClass
  
  GType gvir_config_domain_timer_get_type(void);
  
 -GVirConfigDomainTimer *gvir_config_domain_timer_new(void);
 -GVirConfigDomainTimer *gvir_config_domain_timer_new_from_xml(const gchar 
 *xml,
 -  GError **error);
 -
  G_END_DECLS
  
  #endif /* __LIBVIRT_GCONFIG_DOMAIN_TIMER_H__ */
 diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
 b/libvirt-gconfig/libvirt-gconfig.sym
 index 2378a3c..77d0a45 100644
 --- a/libvirt-gconfig/libvirt-gconfig.sym
 +++ b/libvirt-gconfig/libvirt-gconfig.sym
 @@ -227,8 +227,6 @@ LIBVIRT_GCONFIG_0.0.7 {
   gvir_config_domain_sound_set_model;
  
   gvir_config_domain_timer_get_type;
 - gvir_config_domain_timer_new;
 - gvir_config_domain_timer_new_from_xml;
  
   gvir_config_domain_video_get_type;
   gvir_config_domain_video_model_get_type;
 -- 
 1.7.10
 
 --
 libvir-list mailing list
 libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list


pgpivAo1dCf9y.pgp
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RH-BZ #595428] 'virsh list' should output more information 'xm list'

2012-04-20 Thread Maxim Sditanov
2012/4/19 dennis jenkins dennis.jenkins...@gmail.com:


 On Thu, Apr 19, 2012 at 10:25 AM, Maxim Sditanov feni...@rambler.ru wrote:

 2012/4/2 Maxim Sditanov feni...@rambler.ru:
  Is this new feature request still
  https://bugs.gentoo.org/show_bug.cgi?id=366561 actual?
 
  Because virsh still show not enough information:
 
  $./virsh -c qemu:///system list --all
 
   Id    Name                           State
  
   1                                     running
   -     winxp                          shut off
 
  And it will be good idea to show more detailed information or add
  additional flag, something like --detail.
  ./virsh -c qemu:///system list --all --detailed
 
 
  Id Name       State        Memory   VCPU     Uptime    CPU   IOPS
  --
  -
   1              running        768M      2         3hours     5%
   12.1
   -  winxp      shut off        512M      1
 

 I implemented first part of this task - VCPU and CPU load.
 I ported from virt-manager CPU load algorithm
 (thanks Cole Robinson for help
 https://www.redhat.com/archives/virt-tools-list/2012-April/msg00051.html)

 virt manager update graphic in such way:
 It create thread, than it take host CPU ticks (how much cpu time take
 host)
 then every 1 sec it update value and calculate percentage.
 But this algorithm is bad in virsh, because virsh give information about
 domains imidiatly, without delays and thats why i can't caclulate cpu
 (also io and
 network usage).

 I think it will be good idea if libvirtd will hold information about
 resource usage and implement interface for this data via libvirt
 And virsh and virt-manager will use
 the same functions to get cpu, disk and network usage, host uptime

 How do you think?


 (disclaimer: I'm not a libvirt contributor, just a consumer.  Do I get to
 vote? :) )

I am not libvirt core team developer, i am just volunteer :-)

 If statistics collection is implemented directly in libvirtd, how often
 would libvirtd capture these statistics?  Once per second? 10s, 1m, etc...?

Libvirt manager update graphics every 1 second. I think it is good idea to
allow configure how offen ilbvirtd will update statistic

 Would the interval be user-configurable (per-VM)?  If so, could this setting
 be changed on the fly (eg, to a live VM and effective immediately)?

 Would the statistics survive a restart of libvirtd?  If so, how would they
 be persisted (flat text, xml, sqlite database)?

I didn't think about this yet. But it is reasonable to hold statistic
after libvirtd
restart (or crash). But i didn't examine libvirtd yet

 How far back would the stats be kept for?  Would this value be configurable
 per-VM?

 +1.  I would like to get these kind of stats from virsh list, and very
 much like to get CPU and IO usage history from libvirtd.  I'm developing a
 simple web interface for managing QEMU and LXC via libvirt (apache,
 mod_perl, Sys-Virt, sqlite3, noVnc) for personal use.  I know that libvirt
 can give CPU and IO usage info, but not historic info suitable for
 assembling a quick graph.  If libvirtd cannot provide historic info, then I
 will need to implement a separate daemon to record it, probably by polling
 libvirtd at synchronous intervals.

Also, it is not trivial to get cpu percentage usage (because you need to make
calculation). And virsh, virt-manager and other 3-ty pard software
will implement
the same percentage calculation algorithm. I think, it is better to
hold such things in
one place

 side-note: I should put up a web page with screen-shots of my work in
 progress, and provide access to my source code (personal SVN server).  Does
 anyone here have an interest in using or examining my little project?

I am interesting, just email me directly :-)

 ps- I didn't mean to hijack your thread.  I just wanted to state my desire,
 as a user of libvirt, to have this functionality (however tenuously defined)
 in place.

No problem

 Thank you guys and gals for making libvirt excellent.  I've notice the
 quality of the feedback given to submitted patches and am impressed.

 --
 libvir-list mailing list
 libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list

But i still need comments from libvirt core team about such improvement
and advice

Thanks

-- 
With best wishes, Feniks Gordon Freeman

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH libvirt 1/3] build: do not build shunloadtest if pthread missing

2012-04-20 Thread Marc-André Lureau
Fixes build on Windows systems
---
 configure.ac  |2 ++
 tests/Makefile.am |8 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 89fe818..347c48c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,6 +154,8 @@ AC_CHECK_FUNC([clock_gettime],[
 LIBS=$old_libs
 AC_SUBST(RT_LIBS)
 
+AM_CONDITIONAL([HAVE_PTHREAD], [test x$HAVE_PTHREAD_H = x1])
+
 dnl Availability of various common headers (non-fatal if missing).
 AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
   sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c4d550f..3d9235c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,7 +98,7 @@ test_programs = virshtest sockettest \
nodeinfotest virbuftest \
commandtest seclabeltest \
virhashtest virnetmessagetest virnetsockettest \
-   utiltest virnettlscontexttest shunloadtest \
+   utiltest virnettlscontexttest \
virtimetest viruritest virkeyfiletest \
virauthconfigtest
 
@@ -106,6 +106,10 @@ test_programs = virshtest sockettest \
 ssh_SOURCES = ssh.c
 ssh_LDADD = $(COVERAGE_LDFLAGS)
 
+if HAVE_PTHREAD
+test_programs += shunloadtest
+endif
+
 if WITH_XEN
 test_programs += xml2sexprtest sexpr2xmltest \
xmconfigtest xencapstest statstest reconnect
@@ -527,10 +531,12 @@ libshunload_la_SOURCES = shunloadhelper.c
 libshunload_la_LIBADD = ../src/libvirt.la
 libshunload_la_LDFLAGS = -module -avoid-version -rpath 
/evil/libtool/hack/to/force/shared/lib/creation
 
+if HAVE_PTHREAD
 shunloadtest_SOURCES = \
shunloadtest.c
 shunloadtest_LDADD = -lpthread
 shunloadtest_DEPENDENCIES = libshunload.la
+endif
 
 if WITH_CIL
 CILOPTFLAGS =
-- 
1.7.10

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt 2/3] build: fix output of pid values

2012-04-20 Thread Marc-André Lureau
Fix a few more places where pid_t is printed with wrong type
---
 src/conf/domain_audit.c |4 ++--
 src/conf/domain_conf.c  |4 ++--
 src/util/command.c  |2 +-
 src/util/virpidfile.c   |2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index b885906..653657b 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -562,8 +562,8 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op,
 }
 
 VIR_AUDIT(VIR_AUDIT_RECORD_MACHINE_CONTROL, success,
-  virt=%s op=%s reason=%s %s uuid=%s vm-pid=%d,
-  virt, op, reason, vmname, uuidstr, vm-pid);
+  virt=%s op=%s reason=%s %s uuid=%s vm-pid=%lld,
+  virt, op, reason, vmname, uuidstr, (long long)vm-pid);
 
 VIR_FREE(vmname);
 }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ac877f9..15a097a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12787,10 +12787,10 @@ static char *virDomainObjFormat(virCapsPtr caps,
 int i;
 
 state = virDomainObjGetState(obj, reason);
-virBufferAsprintf(buf, domstatus state='%s' reason='%s' pid='%d'\n,
+virBufferAsprintf(buf, domstatus state='%s' reason='%s' pid='%lld'\n,
   virDomainStateTypeToString(state),
   virDomainStateReasonToString(state, reason),
-  obj-pid);
+  (long long)obj-pid);
 
 for (i = 0 ; i  VIR_DOMAIN_TAINT_LAST ; i++) {
 if (obj-taint  (1  i))
diff --git a/src/util/command.c b/src/util/command.c
index 2837450..800ec8f 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -2399,7 +2399,7 @@ void
 virPidAbort(pid_t pid)
 {
 /* Not yet ported to mingw.  Any volunteers?  */
-VIR_DEBUG(failed to reap child %d, abandoning it, pid);
+VIR_DEBUG(failed to reap child %lldd, abandoning it, (long long)pid);
 }
 
 void
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 1934341..59d0c94 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -222,7 +222,7 @@ int virPidFileReadPathIfAlive(const char *path,
 #endif
 
 if (binpath) {
-if (virAsprintf(procpath, /proc/%d/exe, *pid)  0) {
+if (virAsprintf(procpath, /proc/%lld/exe, (long long)*pid)  0) {
 *pid = -1;
 return -1;
 }
-- 
1.7.10

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt 3/3] build: update pid_t type static check

2012-04-20 Thread Marc-André Lureau
The code uses long long for pid_t now.
It fails on mingw64 without this change.
---
 src/util/virpidfile.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 59d0c94..27811e1 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -316,8 +316,7 @@ cleanup:
 return rc;
 }
 
-
-verify(sizeof(pid_t) = sizeof(unsigned int));
+verify(sizeof(pid_t) = sizeof(long long));
 
 int virPidFileAcquirePath(const char *path,
   pid_t pid)
-- 
1.7.10

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [libvirt-glib 2/2] Add API doc for GVirConfigDomainControllerUsb

2012-04-20 Thread Christophe Fergeau
---
 .../libvirt-gconfig-domain-controller-usb.c|  119 +++-
 1 file changed, 118 insertions(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c 
b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
index 8ab3e25..1fd248c 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
@@ -25,6 +25,84 @@
 #include libvirt-gconfig/libvirt-gconfig.h
 #include libvirt-gconfig/libvirt-gconfig-private.h
 
+/**
+ * SECTION:libvirt-gconfig-domain-controller-usb
+ * @title: USB Controller Configuration
+ * @short_description: configuration of USB controllers
+ *
+ * A #GVirConfigDomainControllerUsb represents an USB controller device.
+ * A #GVirConfigDomain with #GVirConfigDomainControllerUsb devices will
+ * be able to use USB devices.
+ *
+ * Several USB controllers can be added to the same domain, for example
+ * to have an USB1 and an USB2 controller.
+ *
+ * When using SPICE (see #GVirConfigGraphicsSpice), USB devices plugged
+ * on the client can be forwarded to the guest through the use of
+ * #GVirConfigDomainRedirDev.
+ *
+ * example
+ * titleAdding USB controllers to a standard x86 domain/title
+ * para
+ * This example shows the recommended USB setup to get a virtual machine
+ * looking like your usual x86 desktop or laptop.
+ * /para
+ * programlisting
+ * static GVirConfigDomainControllerUsb *
+ * create_usb_controller(GVirConfigDomainControllerUsbModel model, guint index,
+ *   GVirConfigDomainControllerUsb *master, guint 
start_port)
+ * {
+ * GVirConfigDomainControllerUsb *controller;
+ *
+ * controller = gvir_config_domain_controller_usb_new();
+ * gvir_config_domain_controller_usb_set_model(controller, model);
+ * 
gvir_config_domain_controller_set_index(GVIR_CONFIG_DOMAIN_CONTROLLER(controller),
 index);
+ * if (master)
+ * gvir_config_domain_controller_usb_set_master(controller, master, 
start_port);
+ *
+ * return controller;
+ * }
+ *
+ * void setup_default_usb_controllers(GVirConfigDomain *domain)
+ * {
+ *  GVirConfigDomainControllerUsb *ehci;
+ *  GVirConfigDomainControllerUsb *uhci1;
+ *  GVirConfigDomainControllerUsb *uhci2;
+ *  GVirConfigDomainControllerUsb *uhci3;
+ *
+ *  ehci = 
create_usb_controller(GVIR_CONFIG_DOMAIN_CONTROLLER_USB_MODEL_ICH9_EHCI1,
+ *   0, NULL, 0);
+ *  gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(ehci));
+ *  uhci1 = 
create_usb_controller(GVIR_CONFIG_DOMAIN_CONTROLLER_USB_MODEL_ICH9_UHCI1,
+ *0, ehci, 0);
+ *  gvir_config_domain_add_device(domain, 
GVIR_CONFIG_DOMAIN_DEVICE(uhci1));
+ *  g_object_unref(G_OBJECT(uhci1));
+ *  uhci2 = 
create_usb_controller(GVIR_CONFIG_DOMAIN_CONTROLLER_USB_MODEL_ICH9_UHCI2,
+ *0, ehci, 2);
+ *  gvir_config_domain_add_device(domain, 
GVIR_CONFIG_DOMAIN_DEVICE(uhci2));
+ *  g_object_unref(G_OBJECT(uhci2));
+ *  uhci3 = 
create_usb_controller(GVIR_CONFIG_DOMAIN_CONTROLLER_USB_MODEL_ICH9_UHCI3,
+ *0, ehci, 4);
+ *  gvir_config_domain_add_device(domain, 
GVIR_CONFIG_DOMAIN_DEVICE(uhci3));
+ *  g_object_unref(G_OBJECT(uhci3));
+ *  g_object_unref(G_OBJECT(ehci));
+ *}
+ * /programlisting
+ * /example
+ *
+ * This class models libvirt XML nodes located at
+ * ulink url=http://libvirt.org/formatdomain.html#elementsControllers;
+ * /domain/devices/controller[@type=usb]/ulink
+ */
+
+/**
+ * GVirConfigDomainControllerUsb:
+ *
+ * The #GVirConfigDomainControllerUsb struct is an opaque data structure
+ * which is used to configure USB controllers on a domain. It should only
+ * be accessed via the following functions.
+ */
+
 #define GVIR_CONFIG_DOMAIN_CONTROLLER_USB_GET_PRIVATE(obj) 
\
 (G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB, GVirConfigDomainControllerUsbPrivate))
 
@@ -50,6 +128,15 @@ static void 
gvir_config_domain_controller_usb_init(GVirConfigDomainControllerUsb
 }
 
 
+/**
+ * gvir_config_domain_controller_usb_new:
+ *
+ * Creates a new #GVirConfigDomainControllerUsb with a reference count of 1.
+ * gvir_config_domain_controller_set_index() must be called before
+ * this controller is usable.
+ *
+ * Returns: a new #GVirConfigDomainControllerUsb
+ */
 GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new(void)
 {
 GVirConfigObject *object;
@@ -60,8 +147,21 @@ GVirConfigDomainControllerUsb 
*gvir_config_domain_controller_usb_new(void)
 return GVIR_CONFIG_DOMAIN_CONTROLLER_USB(object);
 }
 
+/**
+ * gvir_config_domain_controller_usb_new_from_xml:
+ * @xml: xml data to create the controller from
+ * @error: return location for a #GError, or NULL
+ *
+ * Creates a new #GVirConfigDomainControllerUsb with a reference count of 1.
+ * The controller 

[libvirt] [libvirt-glib 1/2] Update Libvirt-gconfig-docs.xml

2012-04-20 Thread Christophe Fergeau
It was missing most classes in the GVirConfig namespace.
---
 docs/libvirt-gconfig/Libvirt-gconfig-docs.xml |   67 ++---
 1 file changed, 60 insertions(+), 7 deletions(-)

diff --git a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml 
b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
index 9719734..a05c3f3 100644
--- a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
+++ b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
@@ -9,24 +9,77 @@
 titleLibvirt-gconfig Reference Manual/title
   /bookinfo
 
-  chapter
+  part
 titleLibvirt-gconfig/title
 xi:include href=xml/libvirt-gconfig-object.xml/
-xi:include href=xml/libvirt-gconfig-domain.xml/
+chapter
+  titleDomain configuration/title
+  xi:include href=xml/libvirt-gconfig-domain-address-pci.xml/
+  xi:include href=xml/libvirt-gconfig-domain-address-usb.xml/
+  xi:include href=xml/libvirt-gconfig-domain-address.xml/
+  xi:include href=xml/libvirt-gconfig-domain-channel.xml/
+  xi:include href=xml/libvirt-gconfig-domain-chardev.xml/
+  xi:include href=xml/libvirt-gconfig-domain-chardev-source.xml/
+  xi:include href=xml/libvirt-gconfig-domain-chardev-source-pty.xml/
+  xi:include 
href=xml/libvirt-gconfig-domain-chardev-source-spicevmc.xml/
+  xi:include href=xml/libvirt-gconfig-domain-clock.xml/
+  xi:include href=xml/libvirt-gconfig-domain-console.xml/
+  xi:include href=xml/libvirt-gconfig-domain-controller.xml/
+  xi:include href=xml/libvirt-gconfig-domain-controller-usb.xml/
+  xi:include href=xml/libvirt-gconfig-domain-device.xml/
+  xi:include href=xml/libvirt-gconfig-domain-disk.xml/
+  xi:include href=xml/libvirt-gconfig-domain-filesys.xml/
+  xi:include href=xml/libvirt-gconfig-domain-graphics.xml/
+  xi:include href=xml/libvirt-gconfig-domain-graphics-sdl.xml/
+  xi:include href=xml/libvirt-gconfig-domain-graphics-spice.xml/
+  xi:include href=xml/libvirt-gconfig-domain-graphics-vnc.xml/
+  xi:include href=xml/libvirt-gconfig-domain-input.xml/
+  xi:include href=xml/libvirt-gconfig-domain-interface.xml/
+  xi:include href=xml/libvirt-gconfig-domain-interface-bridge.xml/
+  xi:include href=xml/libvirt-gconfig-domain-interface-network.xml/
+  xi:include href=xml/libvirt-gconfig-domain-interface-user.xml/
+  xi:include href=xml/libvirt-gconfig-domain-memballoon.xml/
+  xi:include href=xml/libvirt-gconfig-domain-os.xml/
+  xi:include href=xml/libvirt-gconfig-domain-parallel.xml/
+  xi:include href=xml/libvirt-gconfig-domain-redirdev.xml/
+  xi:include href=xml/libvirt-gconfig-domain-seclabel.xml/
+  xi:include href=xml/libvirt-gconfig-domain-serial.xml/
+  xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
+  xi:include href=xml/libvirt-gconfig-domain-sound.xml/
+  xi:include href=xml/libvirt-gconfig-domain-timer.xml/
+  xi:include href=xml/libvirt-gconfig-domain-timer-pit.xml/
+  xi:include href=xml/libvirt-gconfig-domain-timer-rtc.xml/
+  xi:include href=xml/libvirt-gconfig-domain-video.xml/
+  xi:include href=xml/libvirt-gconfig-domain.xml/
+/chapter
 xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
 xi:include href=xml/libvirt-gconfig-interface.xml/
 xi:include href=xml/libvirt-gconfig-network-filter.xml/
 xi:include href=xml/libvirt-gconfig-network.xml/
 xi:include href=xml/libvirt-gconfig-node-device.xml/
 xi:include href=xml/libvirt-gconfig-secret.xml/
-xi:include href=xml/libvirt-gconfig-storage-pool.xml/
-xi:include href=xml/libvirt-gconfig-storage-vol.xml/
+chapter
+  titleStorage Configuration/title
+  xi:include href=xml/libvirt-gconfig-storage-permissions.xml/
+  section
+titleStorage Pools Configuration/title
+xi:include href=xml/libvirt-gconfig-storage-pool.xml/
+xi:include href=xml/libvirt-gconfig-storage-pool-source.xml/
+xi:include href=xml/libvirt-gconfig-storage-pool-target.xml/
+  /section
+  section
+titleStorage Volumes Configuration/title
+xi:include href=xml/libvirt-gconfig-storage-vol.xml/
+xi:include href=xml/libvirt-gconfig-storage-vol-backing-store.xml/
+xi:include href=xml/libvirt-gconfig-storage-vol-target.xml/
+  /section
+/chapter
 xi:include href=xml/libvirt-gconfig-capabilities.xml/
-  /chapter
-  chapter id=object-tree
+  /part
+  part id=object-tree
 titleObject Hierarchy/title
  xi:include href=xml/tree_index.sgml/
-  /chapter
+  /part
   index id=api-index-full
 titleAPI Index/title
 xi:include href=xml/api-index-full.xmlxi:fallback //xi:include
-- 
1.7.10

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-glib 1/2] Update Libvirt-gconfig-docs.xml

2012-04-20 Thread Marc-André Lureau
Hi,

I think doc should fall in the trivial category, unless you need
review for spelling and correctness, ack.

On Fri, Apr 20, 2012 at 4:06 PM, Christophe Fergeau cferg...@redhat.com wrote:
 It was missing most classes in the GVirConfig namespace.
 ---
  docs/libvirt-gconfig/Libvirt-gconfig-docs.xml |   67 
 ++---
  1 file changed, 60 insertions(+), 7 deletions(-)

 diff --git a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml 
 b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
 index 9719734..a05c3f3 100644
 --- a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
 +++ b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
 @@ -9,24 +9,77 @@
     titleLibvirt-gconfig Reference Manual/title
   /bookinfo

 -  chapter
 +  part
     titleLibvirt-gconfig/title
     xi:include href=xml/libvirt-gconfig-object.xml/
 -    xi:include href=xml/libvirt-gconfig-domain.xml/
 +    chapter
 +      titleDomain configuration/title
 +      xi:include href=xml/libvirt-gconfig-domain-address-pci.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-address-usb.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-address.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-channel.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-chardev.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-chardev-source.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-chardev-source-pty.xml/
 +      xi:include 
 href=xml/libvirt-gconfig-domain-chardev-source-spicevmc.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-clock.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-console.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-controller.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-controller-usb.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-device.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-disk.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-filesys.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-graphics.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-graphics-sdl.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-graphics-spice.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-graphics-vnc.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-input.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-interface.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-interface-bridge.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-interface-network.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-interface-user.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-memballoon.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-os.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-parallel.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-redirdev.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-seclabel.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-serial.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-sound.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-timer.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-timer-pit.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-timer-rtc.xml/
 +      xi:include href=xml/libvirt-gconfig-domain-video.xml/
 +      xi:include href=xml/libvirt-gconfig-domain.xml/
 +    /chapter
     xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
     xi:include href=xml/libvirt-gconfig-interface.xml/
     xi:include href=xml/libvirt-gconfig-network-filter.xml/
     xi:include href=xml/libvirt-gconfig-network.xml/
     xi:include href=xml/libvirt-gconfig-node-device.xml/
     xi:include href=xml/libvirt-gconfig-secret.xml/
 -    xi:include href=xml/libvirt-gconfig-storage-pool.xml/
 -    xi:include href=xml/libvirt-gconfig-storage-vol.xml/
 +    chapter
 +      titleStorage Configuration/title
 +      xi:include href=xml/libvirt-gconfig-storage-permissions.xml/
 +      section
 +        titleStorage Pools Configuration/title
 +        xi:include href=xml/libvirt-gconfig-storage-pool.xml/
 +        xi:include href=xml/libvirt-gconfig-storage-pool-source.xml/
 +        xi:include href=xml/libvirt-gconfig-storage-pool-target.xml/
 +      /section
 +      section
 +        titleStorage Volumes Configuration/title
 +        xi:include href=xml/libvirt-gconfig-storage-vol.xml/
 +        xi:include 
 href=xml/libvirt-gconfig-storage-vol-backing-store.xml/
 +        xi:include href=xml/libvirt-gconfig-storage-vol-target.xml/
 +      /section
 +    /chapter
     xi:include href=xml/libvirt-gconfig-capabilities.xml/
 -  /chapter
 -  chapter id=object-tree
 +  /part
 +  part id=object-tree
     titleObject Hierarchy/title
      xi:include href=xml/tree_index.sgml/
 -  /chapter
 +  /part
   index id=api-index-full
     titleAPI Index/title
     xi:include href=xml/api-index-full.xmlxi:fallback //xi:include
 --
 1.7.10

 --
 libvir-list mailing list
 

Re: [libvirt] [libvirt-glib 1/2] Update Libvirt-gconfig-docs.xml

2012-04-20 Thread Christophe Fergeau
On Fri, Apr 20, 2012 at 05:13:02PM +0200, Marc-André Lureau wrote:
 I think doc should fall in the trivial category, unless you need
 review for spelling and correctness, ack.

I'd appreciate feedback on the docbook structural changes
(chapter/part/...) since I don't know a lot about it.
In the second patch of this series, a review of the doc for
gvir_config_domain_controller_usb_set_master would be appreciated too since
I'm not sure what startport is, and I'm not too confident about the way I
described the master/companion relationship.

Christophe

 
 On Fri, Apr 20, 2012 at 4:06 PM, Christophe Fergeau cferg...@redhat.com 
 wrote:
  It was missing most classes in the GVirConfig namespace.
  ---
   docs/libvirt-gconfig/Libvirt-gconfig-docs.xml |   67 
  ++---
   1 file changed, 60 insertions(+), 7 deletions(-)
 
  diff --git a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml 
  b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
  index 9719734..a05c3f3 100644
  --- a/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
  +++ b/docs/libvirt-gconfig/Libvirt-gconfig-docs.xml
  @@ -9,24 +9,77 @@
      titleLibvirt-gconfig Reference Manual/title
    /bookinfo
 
  -  chapter
  +  part
      titleLibvirt-gconfig/title
      xi:include href=xml/libvirt-gconfig-object.xml/
  -    xi:include href=xml/libvirt-gconfig-domain.xml/
  +    chapter
  +      titleDomain configuration/title
  +      xi:include href=xml/libvirt-gconfig-domain-address-pci.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-address-usb.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-address.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-channel.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-chardev.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-chardev-source.xml/
  +      xi:include 
  href=xml/libvirt-gconfig-domain-chardev-source-pty.xml/
  +      xi:include 
  href=xml/libvirt-gconfig-domain-chardev-source-spicevmc.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-clock.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-console.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-controller.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-controller-usb.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-device.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-disk.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-filesys.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-graphics.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-graphics-sdl.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-graphics-spice.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-graphics-vnc.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-input.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-interface.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-interface-bridge.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-interface-network.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-interface-user.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-memballoon.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-os.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-parallel.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-redirdev.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-seclabel.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-serial.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-sound.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-timer.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-timer-pit.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-timer-rtc.xml/
  +      xi:include href=xml/libvirt-gconfig-domain-video.xml/
  +      xi:include href=xml/libvirt-gconfig-domain.xml/
  +    /chapter
      xi:include href=xml/libvirt-gconfig-domain-snapshot.xml/
      xi:include href=xml/libvirt-gconfig-interface.xml/
      xi:include href=xml/libvirt-gconfig-network-filter.xml/
      xi:include href=xml/libvirt-gconfig-network.xml/
      xi:include href=xml/libvirt-gconfig-node-device.xml/
      xi:include href=xml/libvirt-gconfig-secret.xml/
  -    xi:include href=xml/libvirt-gconfig-storage-pool.xml/
  -    xi:include href=xml/libvirt-gconfig-storage-vol.xml/
  +    chapter
  +      titleStorage Configuration/title
  +      xi:include href=xml/libvirt-gconfig-storage-permissions.xml/
  +      section
  +        titleStorage Pools Configuration/title
  +        xi:include href=xml/libvirt-gconfig-storage-pool.xml/
  +        xi:include href=xml/libvirt-gconfig-storage-pool-source.xml/
  +        xi:include href=xml/libvirt-gconfig-storage-pool-target.xml/
  +      /section
  +      section
  +        titleStorage Volumes Configuration/title
  +        xi:include href=xml/libvirt-gconfig-storage-vol.xml/
  +        xi:include 
  

[libvirt] [PATCH v4 6/9] pvs: add support of VNC remote display

2012-04-20 Thread Dmitry Guryanov
Add support of reading VNC parameters of the VM.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |   65 ++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index ea551fb..839cf06 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -257,6 +257,68 @@ pvsAddDomainHardware(virDomainObjPtr dom, virJSONValuePtr 
jobj)
 return -1;
 }
 
+static int
+pvsAddVNCInfo(virDomainObjPtr dom, virJSONValuePtr jobj_root)
+{
+const char *tmp;
+unsigned int port;
+virJSONValuePtr jobj;
+int ret = -1;
+
+virDomainDefPtr def = dom-def;
+
+virDomainGraphicsDefPtr gr = NULL;
+
+jobj = virJSONValueObjectGet(jobj_root, Remote display);
+if (!jobj) {
+pvsParseError();
+goto cleanup;
+}
+
+tmp = virJSONValueObjectGetString(jobj, mode);
+if (!tmp) {
+pvsParseError();
+goto cleanup;
+}
+
+if (STREQ(tmp, off)) {
+ret = 0;
+goto cleanup;
+}
+
+if (VIR_ALLOC(gr)  0)
+goto no_memory;
+
+if (virJSONValueObjectGetNumberUint(jobj, port, port)  0) {
+pvsParseError();
+goto cleanup;
+}
+
+/* TODO: handle non-auto vnc mode */
+gr-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+gr-data.vnc.port = port;
+gr-data.vnc.autoport = 0;
+gr-data.vnc.keymap = NULL;
+gr-data.vnc.socket = NULL;
+gr-data.vnc.auth.passwd = NULL;
+gr-data.vnc.auth.expires = 0;
+gr-data.vnc.auth.connected = 0;
+
+if (VIR_REALLOC_N(def-graphics, def-ngraphics + 1)  0) {
+virDomainGraphicsDefFree(gr);
+goto no_memory;
+}
+
+def-graphics[def-ngraphics++] = gr;
+return 0;
+
+  no_memory:
+virReportOOMError();
+  cleanup:
+VIR_FREE(gr);
+return ret;
+}
+
 /*
  * Must be called with privconn-lock held
  */
@@ -408,6 +470,9 @@ pvsLoadDomain(pvsConnPtr privconn, virJSONValuePtr jobj)
 if (pvsAddDomainHardware(dom, jobj2)  0)
 goto cleanup_unlock;
 
+if (pvsAddVNCInfo(dom, jobj)  0)
+goto cleanup_unlock;
+
 virDomainObjUnlock(dom);
 
 return dom;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 4/9] pvs: implement functions for domain life cycle management

2012-04-20 Thread Dmitry Guryanov
Add functions for create/shutdown/destroy and suspend/resume domain.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 po/POTFILES.in   |1 +
 src/pvs/pvs_driver.c |  148 ++
 src/pvs/pvs_driver.h |1 +
 src/pvs/pvs_utils.c  |   18 ++
 4 files changed, 168 insertions(+), 0 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index fb70cf7..cb0f7d6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -165,6 +165,7 @@ src/xenapi/xenapi_utils.c
 src/xenxs/xen_sxpr.c
 src/xenxs/xen_xm.c
 src/pvs/pvs_driver.c
+src/pvs/pvs_utils.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 736aa55..b0835b0 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -59,6 +59,11 @@
 void pvsFreeDomObj(void *p);
 static virCapsPtr pvsBuildCapabilities(void);
 static int pvsClose(virConnectPtr conn);
+int pvsPause(virDomainObjPtr privdom);
+int pvsResume(virDomainObjPtr privdom);
+int pvsStart(virDomainObjPtr privdom);
+int pvsKill(virDomainObjPtr privdom);
+int pvsStop(virDomainObjPtr privdom);
 
 static void
 pvsDriverLock(pvsConnPtr driver)
@@ -86,6 +91,12 @@ pvsFreeDomObj(void *p)
 VIR_FREE(pdom);
 };
 
+static void
+pvsDomainEventQueue(pvsConnPtr driver, virDomainEventPtr event)
+{
+virDomainEventStateQueue(driver-domainEventState, event);
+}
+
 static virCapsPtr
 pvsBuildCapabilities(void)
 {
@@ -746,6 +757,138 @@ pvsDomainGetAutostart(virDomainPtr domain, int *autostart)
 return ret;
 }
 
+typedef int (*pvsChangeState)(virDomainObjPtr privdom);
+#define PVS_UUID(x) (((pvsDomObjPtr)(x-privateData))-uuid)
+
+static int
+pvsDomainChangeState(virDomainPtr domain,
+ virDomainState req_state, const char * req_state_name,
+ pvsChangeState chstate,
+ virDomainState new_state, int reason,
+ int event_type, int event_detail)
+{
+pvsConnPtr privconn = domain-conn-privateData;
+virDomainObjPtr privdom;
+virDomainEventPtr event = NULL;
+int state;
+int ret = -1;
+
+pvsDriverLock(privconn);
+privdom = virDomainFindByName(privconn-domains, domain-name);
+pvsDriverUnlock(privconn);
+
+if (privdom == NULL) {
+pvsError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+goto cleanup;
+}
+
+state = virDomainObjGetState(privdom, NULL);
+if (state != req_state) {
+pvsError(VIR_ERR_INTERNAL_ERROR, _(domain '%s' not %s),
+ privdom-def-name, req_state_name);
+goto cleanup;
+}
+
+if (chstate(privdom))
+goto cleanup;
+
+virDomainObjSetState(privdom, new_state, reason);
+
+event = virDomainEventNewFromObj(privdom, event_type, event_detail);
+ret = 0;
+
+  cleanup:
+if (privdom)
+virDomainObjUnlock(privdom);
+
+if (event) {
+pvsDriverLock(privconn);
+pvsDomainEventQueue(privconn, event);
+pvsDriverUnlock(privconn);
+}
+return ret;
+}
+
+int pvsPause(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, pause, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsPauseDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_RUNNING, running,
+pvsPause,
+VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER,
+VIR_DOMAIN_EVENT_SUSPENDED,
+VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+}
+
+int pvsResume(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, resume, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsResumeDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_PAUSED, paused,
+pvsResume,
+VIR_DOMAIN_RUNNING, 
VIR_DOMAIN_RUNNING_UNPAUSED,
+VIR_DOMAIN_EVENT_RESUMED,
+VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
+}
+
+int pvsStart(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, start, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsDomainCreate(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_SHUTOFF, stopped,
+pvsStart,
+VIR_DOMAIN_RUNNING, 
VIR_DOMAIN_EVENT_STARTED_BOOTED,
+VIR_DOMAIN_EVENT_STARTED,
+VIR_DOMAIN_EVENT_STARTED_BOOTED);
+}
+
+int pvsKill(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, stop, PVS_UUID(privdom), --kill, NULL);
+}
+
+static int
+pvsDestroyDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_RUNNING, running,
+pvsKill,
+VIR_DOMAIN_SHUTOFF, 

[libvirt] [PATCH v4 5/9] pvs: get info about serial ports

2012-04-20 Thread Dmitry Guryanov
Add support of collecting information about serial
ports. This change is needed mostly as an example,
support of other devices will be added later.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |  115 ++
 1 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index b0835b0..ea551fb 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -145,6 +145,118 @@ pvsGetCapabilities(virConnectPtr conn)
 return xml;
 }
 
+static int
+pvsGetSerialInfo(virDomainChrDefPtr chr,
+ const char *name, virJSONValuePtr value)
+{
+const char *tmp;
+
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+chr-target.port = atoi(name + strlen(serial));
+
+if (virJSONValueObjectHasKey(value, output)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_FILE;
+
+tmp = virJSONValueObjectGetString(value, output);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.file.path = strdup(tmp)))
+goto no_memory;
+} else if (virJSONValueObjectHasKey(value, socket)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_UNIX;
+
+tmp = virJSONValueObjectGetString(value, socket);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.nix.path = strdup(tmp)))
+goto no_memory;
+chr-source.data.nix.listen = false;
+} else if (virJSONValueObjectHasKey(value, real)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_DEV;
+
+tmp = virJSONValueObjectGetString(value, real);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.file.path = strdup(tmp)))
+goto no_memory;
+} else {
+pvsParseError();
+return -1;
+}
+
+return 0;
+
+  no_memory:
+virReportOOMError();
+return -1;
+}
+
+static int
+pvsAddSerialInfo(virDomainObjPtr dom,
+ const char *key, virJSONValuePtr value)
+{
+virDomainDefPtr def = dom-def;
+virDomainChrDefPtr chr = NULL;
+
+if (!(chr = virDomainChrDefNew()))
+goto no_memory;
+
+if (pvsGetSerialInfo(chr, key, value))
+goto cleanup;
+
+if (VIR_REALLOC_N(def-serials, def-nserials + 1)  0) {
+virDomainChrDefFree(chr);
+goto no_memory;
+}
+
+def-serials[def-nserials++] = chr;
+
+return 0;
+
+  no_memory:
+virReportOOMError();
+  cleanup:
+virDomainChrDefFree(chr);
+return -1;
+}
+
+static int
+pvsAddDomainHardware(virDomainObjPtr dom, virJSONValuePtr jobj)
+{
+int n, i;
+virJSONValuePtr value;
+const char *key;
+
+n = virJSONValueObjectKeysNumber(jobj);
+if (n  1)
+goto cleanup;
+
+for (i = 0; i  n; i++) {
+key = virJSONValueObjectGetKey(jobj, i);
+value = virJSONValueObjectGetValue(jobj, i);
+
+if (STRPREFIX(key, serial)) {
+if (pvsAddSerialInfo(dom, key, value))
+goto cleanup;
+}
+}
+
+return 0;
+
+  cleanup:
+return -1;
+}
+
 /*
  * Must be called with privconn-lock held
  */
@@ -293,6 +405,9 @@ pvsLoadDomain(pvsConnPtr privconn, virJSONValuePtr jobj)
 else
 dom-autostart = 0;
 
+if (pvsAddDomainHardware(dom, jobj2)  0)
+goto cleanup_unlock;
+
 virDomainObjUnlock(dom);
 
 return dom;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 0/9] Add basic driver for Parallels Virtuozzo Server

2012-04-20 Thread Dmitry Guryanov
Parallels Virtuozzo Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.

Current name of this product is Parallels Server Bare Metal and
more information about it can be found here -
http://www.parallels.com/products/server/baremetal/sp/.

This driver will work with PVS version 6.0 , beta version
scheduled at 2012 Q2.

changes in v4:
* fix errors, found by 'make syntax-check'

Dmitry Guryanov (9):
  pvs: add driver skeleton
  util: add functions for interating over json object
  pvs: add functions to list domains and get info
  pvs: implement functions for domain life cycle management
  pvs: get info about serial ports
  pvs: add support of VNC remote display
  pvs: implement virDomainDefineXML operation for existing domains
  pvs: add storage driver
  pvs: implement VM creation

 AUTHORS |1 +
 cfg.mk  |1 +
 configure.ac|   23 +
 docs/drvpvs.html.in |   28 +
 include/libvirt/virterror.h |1 +
 libvirt.spec.in |7 +
 mingw32-libvirt.spec.in |6 +
 po/POTFILES.in  |3 +
 src/Makefile.am |   23 +
 src/conf/domain_conf.c  |3 +-
 src/conf/domain_conf.h  |1 +
 src/driver.h|1 +
 src/libvirt.c   |   12 +
 src/pvs/pvs_driver.c| 1280 +
 src/pvs/pvs_driver.h|   75 +++
 src/pvs/pvs_storage.c   | 1458 +++
 src/pvs/pvs_utils.c |  143 +
 src/util/json.c |   30 +
 src/util/json.h |4 +
 src/util/virterror.c|3 +
 20 files changed, 3102 insertions(+), 1 deletions(-)
 create mode 100644 docs/drvpvs.html.in
 create mode 100644 src/pvs/pvs_driver.c
 create mode 100644 src/pvs/pvs_driver.h
 create mode 100644 src/pvs/pvs_storage.c
 create mode 100644 src/pvs/pvs_utils.c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 2/9] util: add functions for interating over json object

2012-04-20 Thread Dmitry Guryanov
Add function virJSONValueObjectKeysNumber, virJSONValueObjectGetKey
and virJSONValueObjectGetValue, which allow you to iterate over all
fields of json object: you can get number of fields and then get
name and value, stored in field with that name by index.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/util/json.c |   30 ++
 src/util/json.h |4 
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/util/json.c b/src/util/json.c
index 3258c3f..e7dc272 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -431,6 +431,36 @@ virJSONValuePtr virJSONValueObjectGet(virJSONValuePtr 
object, const char *key)
 return NULL;
 }
 
+int virJSONValueObjectKeysNumber(virJSONValuePtr object)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return -1;
+
+return object-data.object.npairs;
+}
+
+const char *virJSONValueObjectGetKey(virJSONValuePtr object, unsigned int n)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return NULL;
+
+if (n = object-data.object.npairs)
+return NULL;
+
+return object-data.object.pairs[n].key;
+}
+
+virJSONValuePtr virJSONValueObjectGetValue(virJSONValuePtr object, unsigned 
int n)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return NULL;
+
+if (n = object-data.object.npairs)
+return NULL;
+
+return object-data.object.pairs[n].value;
+}
+
 int virJSONValueArraySize(virJSONValuePtr array)
 {
 if (array-type != VIR_JSON_TYPE_ARRAY)
diff --git a/src/util/json.h b/src/util/json.h
index 686a8fb..436405f 100644
--- a/src/util/json.h
+++ b/src/util/json.h
@@ -100,6 +100,10 @@ virJSONValuePtr virJSONValueObjectGet(virJSONValuePtr 
object, const char *key);
 int virJSONValueArraySize(virJSONValuePtr object);
 virJSONValuePtr virJSONValueArrayGet(virJSONValuePtr object, unsigned int 
element);
 
+int virJSONValueObjectKeysNumber(virJSONValuePtr object);
+const char *virJSONValueObjectGetKey(virJSONValuePtr object, unsigned int n);
+virJSONValuePtr virJSONValueObjectGetValue(virJSONValuePtr object, unsigned 
int n);
+
 const char *virJSONValueGetString(virJSONValuePtr object);
 int virJSONValueGetNumberInt(virJSONValuePtr object, int *value);
 int virJSONValueGetNumberUint(virJSONValuePtr object, unsigned int *value);
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 9/9] pvs: implement VM creation

2012-04-20 Thread Dmitry Guryanov
To create a new VM in PVS we should issue prlctl create command,
and give path to the directory, where VM should be created. VM's
storage will be in that directory later. So in this first version
find out location of first VM's hard disk and create VM there.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c  |   78 -
 src/pvs/pvs_driver.h  |4 ++
 src/pvs/pvs_storage.c |6 +---
 3 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 0ae9b47..424d552 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -1097,6 +1097,74 @@ pvsApplyChanges(virDomainObjPtr dom, virDomainDefPtr 
newdef)
 return 0;
 }
 
+static int
+pvsCreateVm(virConnectPtr conn, virDomainDefPtr def)
+{
+pvsConnPtr privconn = conn-privateData;
+int i;
+virStorageVolDefPtr privvol = NULL;
+virStoragePoolObjPtr pool = NULL;
+virStorageVolPtr vol = NULL;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+for (i = 0; i  def-ndisks; i++) {
+if (def-disks[i]-device != VIR_DOMAIN_DISK_DEVICE_DISK)
+continue;
+
+vol = pvsStorageVolumeLookupByPathLocked(conn, def-disks[i]-src);
+if (!vol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find volume with path '%s'),
+ def-disks[i]-src);
+return -1;
+}
+break;
+}
+
+if (!vol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't create VM without hard disks));
+return -1;
+}
+
+pool = virStoragePoolObjFindByName(privconn-pools, vol-pool);
+if (!pool) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find storage pool with name '%s'),
+ vol-pool);
+goto error;
+}
+
+privvol = virStorageVolDefFindByPath(pool, def-disks[i]-src);
+if (!privvol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find storage volume definition for path '%s'),
+ def-disks[i]-src);
+goto error2;
+}
+
+virUUIDFormat(def-uuid, uuidstr);
+
+if (pvsCmdRun(PRLCTL, create, def-name, --dst,
+  pool-def-target.path, --no-hdd,
+  --uuid, uuidstr, NULL)  0)
+goto error2;
+
+if (pvsCmdRun(PRLCTL, set, def-name, --vnc-mode, auto, NULL)  0)
+goto error2;
+
+virStoragePoolObjUnlock(pool);
+virUnrefStorageVol(vol);
+
+return 0;
+
+  error2:
+virStoragePoolObjUnlock(pool);
+  error:
+virUnrefStorageVol(vol);
+return -1;
+}
+
 static virDomainPtr
 pvsDomainDefineXML(virConnectPtr conn, const char *xml)
 {
@@ -1133,8 +1201,16 @@ pvsDomainDefineXML(virConnectPtr conn, const char *xml)
 
 def = NULL;
 } else {
-pvsError(VIR_ERR_NO_SUPPORT, _(Not implemented yet));
+if (pvsCreateVm(conn, def))
 goto cleanup;
+if (pvsLoadDomains(privconn, def-name))
+goto cleanup;
+dom = virDomainFindByName(privconn-domains, def-name);
+if (!dom) {
+pvsError(VIR_ERR_INTERNAL_ERROR,
+ _(Domain is not defined after creation));
+goto cleanup;
+}
 }
 
 event = virDomainEventNewFromObj(dom,
diff --git a/src/pvs/pvs_driver.h b/src/pvs/pvs_driver.h
index 7a21952..a1125cd 100644
--- a/src/pvs/pvs_driver.h
+++ b/src/pvs/pvs_driver.h
@@ -67,5 +67,9 @@ int pvsCmdRun(const char *binary, ...);
 char * pvsAddFileExt(const char *path, const char *ext);
 void pvsDriverLock(pvsConnPtr driver);
 void pvsDriverUnlock(pvsConnPtr driver);
+virStorageVolPtr pvsStorageVolumeLookupByPathLocked(virConnectPtr
+   conn,
+   const char
+   *path);
 
 #endif
diff --git a/src/pvs/pvs_storage.c b/src/pvs/pvs_storage.c
index b2a9a2c..3f08264 100644
--- a/src/pvs/pvs_storage.c
+++ b/src/pvs/pvs_storage.c
@@ -41,10 +41,6 @@ static virStorageVolDefPtr 
pvsStorageVolumeDefine(virStoragePoolObjPtr pool,
   const char *xmldesc,
   const char *xmlfile,
   bool is_new);
-static virStorageVolPtr pvsStorageVolumeLookupByPathLocked(virConnectPtr
-   conn,
-   const char
-   *path);
 static virStorageVolPtr pvsStorageVolumeLookupByPath(virConnectPtr conn,
  const char *path);
 static int pvsStoragePoolGetAlloc(virStoragePoolDefPtr def);
@@ -941,7 +937,7 @@ pvsStorageVolumeLookupByKey(virConnectPtr conn, const char 
*key)
 return ret;
 }
 
-static 

[libvirt] [PATCH v4 7/9] pvs: implement virDomainDefineXML operation for existing domains

2012-04-20 Thread Dmitry Guryanov
Add pvsDomainDefineXML functions, it works only for existing
domains for the present.

It's too hard to convert libvirt's XML domain configuration into
PVS's one, so I've decided to compare virDomainDef structures:
current domain definition and the one created from XML, given to
the function. And change only different parameters.

Only description change implemetented, changing other parameters
will be implemented later.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |   89 ++
 1 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 839cf06..9052740 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -1069,6 +1069,94 @@ pvsShutdownDomain(virDomainPtr domain)
 VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
 }
 
+static int
+pvsSetDescription(virDomainObjPtr dom, const char *description)
+{
+pvsDomObjPtr pvsdom;
+
+pvsdom = dom-privateData;
+if (pvsCmdRun(PRLCTL, set, pvsdom-uuid,
+  --description, description, NULL))
+return -1;
+
+return 0;
+}
+
+static int
+pvsApplyChanges(virDomainObjPtr dom, virDomainDefPtr newdef)
+{
+virDomainDefPtr olddef = dom-def;
+
+if (newdef-description  !STREQ(olddef-description, 
newdef-description)) {
+if (pvsSetDescription(dom, newdef-description))
+return -1;
+}
+
+/* TODO: compare all other parameters */
+
+return 0;
+}
+
+static virDomainPtr
+pvsDomainDefineXML(virConnectPtr conn, const char *xml)
+{
+pvsConnPtr privconn = conn-privateData;
+virDomainPtr ret = NULL;
+virDomainDefPtr def;
+virDomainObjPtr dom = NULL, olddom = NULL;
+virDomainEventPtr event = NULL;
+int dupVM;
+
+pvsDriverLock(privconn);
+if ((def = virDomainDefParseString(privconn-caps, xml,
+   1  VIR_DOMAIN_VIRT_PVS,
+   VIR_DOMAIN_XML_INACTIVE)) == NULL) {
+pvsError(VIR_ERR_INVALID_ARG, _(Can't parse XML desc));
+goto cleanup;
+}
+
+if ((dupVM = virDomainObjIsDuplicate(privconn-domains, def, 0))  0) {
+pvsError(VIR_ERR_INVALID_ARG, _(Already exists));
+goto cleanup;
+}
+
+if (dupVM == 1) {
+olddom = virDomainFindByUUID(privconn-domains, def-uuid);
+pvsApplyChanges(olddom, def);
+virDomainObjUnlock(olddom);
+
+if (!(dom = virDomainAssignDef(privconn-caps,
+   privconn-domains, def, false))) {
+pvsError(VIR_ERR_INTERNAL_ERROR, _(Can't allocate domobj));
+goto cleanup;
+}
+
+def = NULL;
+} else {
+pvsError(VIR_ERR_NO_SUPPORT, _(Not implemented yet));
+goto cleanup;
+}
+
+event = virDomainEventNewFromObj(dom,
+ VIR_DOMAIN_EVENT_DEFINED,
+ !dupVM ?
+ VIR_DOMAIN_EVENT_DEFINED_ADDED :
+ VIR_DOMAIN_EVENT_DEFINED_UPDATED);
+
+ret = virGetDomain(conn, dom-def-name, dom-def-uuid);
+if (ret)
+ret-id = dom-def-id;
+
+  cleanup:
+virDomainDefFree(def);
+if (dom)
+virDomainObjUnlock(dom);
+if (event)
+pvsDomainEventQueue(privconn, event);
+pvsDriverUnlock(privconn);
+return ret;
+}
+
 static virDriver pvsDriver = {
 .no = VIR_DRV_PVS,
 .name = PVS,
@@ -1096,6 +1184,7 @@ static virDriver pvsDriver = {
 .domainDestroy = pvsDestroyDomain,  /* 0.9.12 */
 .domainShutdown = pvsShutdownDomain, /* 0.9.12 */
 .domainCreate = pvsDomainCreate,/* 0.9.12 */
+.domainDefineXML = pvsDomainDefineXML,  /* 0.9.12 */
 };
 
 /**
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 8/9] pvs: add storage driver

2012-04-20 Thread Dmitry Guryanov
PVS has one serious discrepancy with libvirt: libvirt stores
domain configuration files always in one place, and storage files
in other places (with API of storage pools and storage volumes).
PVS store all domain data in a single directory, for example, you
may have domain with name fedora-15, which will be located in
'/var/parallels/fedora-15.pvm', and it's hard disk image will be
in '/var/parallels/fedora-15.pvm/harddisk1.hdd'.

I've decided to create storage driver, which produces pseudo-volumes
(xml files with volume description), and they will be 'converted' to
real disk images after attaching to a VM.

So if someone creates VM with one hard disk using virt-manager,
at first virt-manager creates a new volume, and then defines a
domain. We can lookup a volume by path in XML domain definition
and find out location of new domain and size of its hard disk.

changes in v4:
* add virCheckFlags to pvsStorageFindPoolSources

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 po/POTFILES.in|1 +
 src/Makefile.am   |3 +-
 src/pvs/pvs_driver.c  |6 +-
 src/pvs/pvs_driver.h  |5 +
 src/pvs/pvs_storage.c | 1462 +
 src/pvs/pvs_utils.c   |   24 +
 6 files changed, 1498 insertions(+), 3 deletions(-)
 create mode 100644 src/pvs/pvs_storage.c

diff --git a/po/POTFILES.in b/po/POTFILES.in
index cb0f7d6..014a42c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -166,6 +166,7 @@ src/xenxs/xen_sxpr.c
 src/xenxs/xen_xm.c
 src/pvs/pvs_driver.c
 src/pvs/pvs_utils.c
+src/pvs/pvs_storage.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
diff --git a/src/Makefile.am b/src/Makefile.am
index bc9efcf..0765aaf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -468,7 +468,8 @@ HYPERV_DRIVER_EXTRA_DIST =  
\
 PVS_DRIVER_SOURCES =   
\
pvs/pvs_driver.h
\
pvs/pvs_driver.c
\
-   pvs/pvs_utils.c
+   pvs/pvs_utils.c 
\
+   pvs/pvs_storage.c
 
 NETWORK_DRIVER_SOURCES =   \
network/bridge_driver.h network/bridge_driver.c
diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 9052740..0ae9b47 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -65,13 +65,13 @@ int pvsStart(virDomainObjPtr privdom);
 int pvsKill(virDomainObjPtr privdom);
 int pvsStop(virDomainObjPtr privdom);
 
-static void
+void
 pvsDriverLock(pvsConnPtr driver)
 {
 virMutexLock(driver-lock);
 }
 
-static void
+void
 pvsDriverUnlock(pvsConnPtr driver)
 {
 virMutexUnlock(driver-lock);
@@ -1197,6 +1197,8 @@ pvsRegister(void)
 {
 if (virRegisterDriver(pvsDriver)  0)
 return -1;
+if (pvsStorageRegister())
+return -1;
 
 return 0;
 }
diff --git a/src/pvs/pvs_driver.h b/src/pvs/pvs_driver.h
index 080f34b..7a21952 100644
--- a/src/pvs/pvs_driver.h
+++ b/src/pvs/pvs_driver.h
@@ -26,6 +26,7 @@
 
 # include domain_conf.h
 # include storage_conf.h
+# include driver.h
 # include domain_event.h
 
 # include json.h
@@ -59,8 +60,12 @@ typedef struct _pvsConn pvsConn;
 typedef struct _pvsConn *pvsConnPtr;
 
 int pvsRegister(void);
+int pvsStorageRegister(void);
 
 virJSONValuePtr pvsParseOutput(const char *binary, ...);
 int pvsCmdRun(const char *binary, ...);
+char * pvsAddFileExt(const char *path, const char *ext);
+void pvsDriverLock(pvsConnPtr driver);
+void pvsDriverUnlock(pvsConnPtr driver);
 
 #endif
diff --git a/src/pvs/pvs_storage.c b/src/pvs/pvs_storage.c
new file mode 100644
index 000..b2a9a2c
--- /dev/null
+++ b/src/pvs/pvs_storage.c
@@ -0,0 +1,1462 @@
+/*
+ * pvs_storage.c: core driver functions for managing
+ * Parallels Virtuozzo Server hosts
+ *
+ * Copyright (C) 2012 Parallels, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include config.h
+
+#include stdlib.h
+#include dirent.h
+#include sys/statvfs.h
+
+#include datatypes.h
+#include memory.h
+#include configmake.h
+#include storage_file.h
+#include virterror_internal.h
+
+#include 

Re: [libvirt] [PATCH v2] Improve on virAtomic implementation

2012-04-20 Thread Laine Stump
On 04/20/2012 06:44 AM, Stefan Berger wrote:
 This patch improves the previously added virAtomicInt implementation
 by using gcc-builtins if possible. The needed builtins are available
 since GCC = 4.1. At least the 4.0 docs don't mention them.

 ---
  src/util/viratomic.h |   95
 ++-
  1 file changed, 79 insertions(+), 16 deletions(-)

ACK.

Now we can start thinking about eliminating locking for things that just
need a refcount :-)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v4 1/9] pvs: add driver skeleton

2012-04-20 Thread Dmitry Guryanov

On 04/20/2012 07:49 PM, Dmitry Guryanov wrote:

Add driver, which can report node info only.

changes:
 * add me to AUTHORS
 * fix indent in preprocessor directives in pvs_driver.h
 * remove unneded include
 * remove pvs_driver.c from po/POTFILES.in

Signed-off-by: Dmitry Guryanovdgurya...@parallels.com


Sorry, forgot to rebase, conflict found in libvirt/virterror.h

.

--
Dmitry Guryanov

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 6/9] pvs: add support of VNC remote display

2012-04-20 Thread Dmitry Guryanov
Add support of reading VNC parameters of the VM.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |   65 ++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index ea551fb..839cf06 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -257,6 +257,68 @@ pvsAddDomainHardware(virDomainObjPtr dom, virJSONValuePtr 
jobj)
 return -1;
 }
 
+static int
+pvsAddVNCInfo(virDomainObjPtr dom, virJSONValuePtr jobj_root)
+{
+const char *tmp;
+unsigned int port;
+virJSONValuePtr jobj;
+int ret = -1;
+
+virDomainDefPtr def = dom-def;
+
+virDomainGraphicsDefPtr gr = NULL;
+
+jobj = virJSONValueObjectGet(jobj_root, Remote display);
+if (!jobj) {
+pvsParseError();
+goto cleanup;
+}
+
+tmp = virJSONValueObjectGetString(jobj, mode);
+if (!tmp) {
+pvsParseError();
+goto cleanup;
+}
+
+if (STREQ(tmp, off)) {
+ret = 0;
+goto cleanup;
+}
+
+if (VIR_ALLOC(gr)  0)
+goto no_memory;
+
+if (virJSONValueObjectGetNumberUint(jobj, port, port)  0) {
+pvsParseError();
+goto cleanup;
+}
+
+/* TODO: handle non-auto vnc mode */
+gr-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+gr-data.vnc.port = port;
+gr-data.vnc.autoport = 0;
+gr-data.vnc.keymap = NULL;
+gr-data.vnc.socket = NULL;
+gr-data.vnc.auth.passwd = NULL;
+gr-data.vnc.auth.expires = 0;
+gr-data.vnc.auth.connected = 0;
+
+if (VIR_REALLOC_N(def-graphics, def-ngraphics + 1)  0) {
+virDomainGraphicsDefFree(gr);
+goto no_memory;
+}
+
+def-graphics[def-ngraphics++] = gr;
+return 0;
+
+  no_memory:
+virReportOOMError();
+  cleanup:
+VIR_FREE(gr);
+return ret;
+}
+
 /*
  * Must be called with privconn-lock held
  */
@@ -408,6 +470,9 @@ pvsLoadDomain(pvsConnPtr privconn, virJSONValuePtr jobj)
 if (pvsAddDomainHardware(dom, jobj2)  0)
 goto cleanup_unlock;
 
+if (pvsAddVNCInfo(dom, jobj)  0)
+goto cleanup_unlock;
+
 virDomainObjUnlock(dom);
 
 return dom;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 2/9] util: add functions for interating over json object

2012-04-20 Thread Dmitry Guryanov
Add function virJSONValueObjectKeysNumber, virJSONValueObjectGetKey
and virJSONValueObjectGetValue, which allow you to iterate over all
fields of json object: you can get number of fields and then get
name and value, stored in field with that name by index.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/util/json.c |   30 ++
 src/util/json.h |4 
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/util/json.c b/src/util/json.c
index 3258c3f..e7dc272 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -431,6 +431,36 @@ virJSONValuePtr virJSONValueObjectGet(virJSONValuePtr 
object, const char *key)
 return NULL;
 }
 
+int virJSONValueObjectKeysNumber(virJSONValuePtr object)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return -1;
+
+return object-data.object.npairs;
+}
+
+const char *virJSONValueObjectGetKey(virJSONValuePtr object, unsigned int n)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return NULL;
+
+if (n = object-data.object.npairs)
+return NULL;
+
+return object-data.object.pairs[n].key;
+}
+
+virJSONValuePtr virJSONValueObjectGetValue(virJSONValuePtr object, unsigned 
int n)
+{
+if (object-type != VIR_JSON_TYPE_OBJECT)
+return NULL;
+
+if (n = object-data.object.npairs)
+return NULL;
+
+return object-data.object.pairs[n].value;
+}
+
 int virJSONValueArraySize(virJSONValuePtr array)
 {
 if (array-type != VIR_JSON_TYPE_ARRAY)
diff --git a/src/util/json.h b/src/util/json.h
index 686a8fb..436405f 100644
--- a/src/util/json.h
+++ b/src/util/json.h
@@ -100,6 +100,10 @@ virJSONValuePtr virJSONValueObjectGet(virJSONValuePtr 
object, const char *key);
 int virJSONValueArraySize(virJSONValuePtr object);
 virJSONValuePtr virJSONValueArrayGet(virJSONValuePtr object, unsigned int 
element);
 
+int virJSONValueObjectKeysNumber(virJSONValuePtr object);
+const char *virJSONValueObjectGetKey(virJSONValuePtr object, unsigned int n);
+virJSONValuePtr virJSONValueObjectGetValue(virJSONValuePtr object, unsigned 
int n);
+
 const char *virJSONValueGetString(virJSONValuePtr object);
 int virJSONValueGetNumberInt(virJSONValuePtr object, int *value);
 int virJSONValueGetNumberUint(virJSONValuePtr object, unsigned int *value);
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 4/9] pvs: implement functions for domain life cycle management

2012-04-20 Thread Dmitry Guryanov
Add functions for create/shutdown/destroy and suspend/resume domain.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 po/POTFILES.in   |1 +
 src/pvs/pvs_driver.c |  148 ++
 src/pvs/pvs_driver.h |1 +
 src/pvs/pvs_utils.c  |   18 ++
 4 files changed, 168 insertions(+), 0 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 07ccb7c..7ec8df5 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -166,6 +166,7 @@ src/xenapi/xenapi_utils.c
 src/xenxs/xen_sxpr.c
 src/xenxs/xen_xm.c
 src/pvs/pvs_driver.c
+src/pvs/pvs_utils.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 736aa55..b0835b0 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -59,6 +59,11 @@
 void pvsFreeDomObj(void *p);
 static virCapsPtr pvsBuildCapabilities(void);
 static int pvsClose(virConnectPtr conn);
+int pvsPause(virDomainObjPtr privdom);
+int pvsResume(virDomainObjPtr privdom);
+int pvsStart(virDomainObjPtr privdom);
+int pvsKill(virDomainObjPtr privdom);
+int pvsStop(virDomainObjPtr privdom);
 
 static void
 pvsDriverLock(pvsConnPtr driver)
@@ -86,6 +91,12 @@ pvsFreeDomObj(void *p)
 VIR_FREE(pdom);
 };
 
+static void
+pvsDomainEventQueue(pvsConnPtr driver, virDomainEventPtr event)
+{
+virDomainEventStateQueue(driver-domainEventState, event);
+}
+
 static virCapsPtr
 pvsBuildCapabilities(void)
 {
@@ -746,6 +757,138 @@ pvsDomainGetAutostart(virDomainPtr domain, int *autostart)
 return ret;
 }
 
+typedef int (*pvsChangeState)(virDomainObjPtr privdom);
+#define PVS_UUID(x) (((pvsDomObjPtr)(x-privateData))-uuid)
+
+static int
+pvsDomainChangeState(virDomainPtr domain,
+ virDomainState req_state, const char * req_state_name,
+ pvsChangeState chstate,
+ virDomainState new_state, int reason,
+ int event_type, int event_detail)
+{
+pvsConnPtr privconn = domain-conn-privateData;
+virDomainObjPtr privdom;
+virDomainEventPtr event = NULL;
+int state;
+int ret = -1;
+
+pvsDriverLock(privconn);
+privdom = virDomainFindByName(privconn-domains, domain-name);
+pvsDriverUnlock(privconn);
+
+if (privdom == NULL) {
+pvsError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+goto cleanup;
+}
+
+state = virDomainObjGetState(privdom, NULL);
+if (state != req_state) {
+pvsError(VIR_ERR_INTERNAL_ERROR, _(domain '%s' not %s),
+ privdom-def-name, req_state_name);
+goto cleanup;
+}
+
+if (chstate(privdom))
+goto cleanup;
+
+virDomainObjSetState(privdom, new_state, reason);
+
+event = virDomainEventNewFromObj(privdom, event_type, event_detail);
+ret = 0;
+
+  cleanup:
+if (privdom)
+virDomainObjUnlock(privdom);
+
+if (event) {
+pvsDriverLock(privconn);
+pvsDomainEventQueue(privconn, event);
+pvsDriverUnlock(privconn);
+}
+return ret;
+}
+
+int pvsPause(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, pause, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsPauseDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_RUNNING, running,
+pvsPause,
+VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER,
+VIR_DOMAIN_EVENT_SUSPENDED,
+VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+}
+
+int pvsResume(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, resume, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsResumeDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_PAUSED, paused,
+pvsResume,
+VIR_DOMAIN_RUNNING, 
VIR_DOMAIN_RUNNING_UNPAUSED,
+VIR_DOMAIN_EVENT_RESUMED,
+VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
+}
+
+int pvsStart(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, start, PVS_UUID(privdom), NULL);
+}
+
+static int
+pvsDomainCreate(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_SHUTOFF, stopped,
+pvsStart,
+VIR_DOMAIN_RUNNING, 
VIR_DOMAIN_EVENT_STARTED_BOOTED,
+VIR_DOMAIN_EVENT_STARTED,
+VIR_DOMAIN_EVENT_STARTED_BOOTED);
+}
+
+int pvsKill(virDomainObjPtr privdom)
+{
+return pvsCmdRun(PRLCTL, stop, PVS_UUID(privdom), --kill, NULL);
+}
+
+static int
+pvsDestroyDomain(virDomainPtr domain)
+{
+return pvsDomainChangeState(domain,
+VIR_DOMAIN_RUNNING, running,
+pvsKill,
+VIR_DOMAIN_SHUTOFF, 

Re: [libvirt] [PATCH] openvz: add network interface stats

2012-04-20 Thread Laine Stump
On 04/19/2012 06:32 PM, Guido Günther wrote:
 This will only work for veth devices since venet devices don't have
 a target element.


Well, there is precedent for having stats work on some types of
interfaces and not on others - type='user' interfaces in qemu also don't
get stats (as the gnome-boxes guys found out, much to their
disappointment). (Anyway, my point is that this shouldn't stop us from
enabling stats for those interfaces we *can* support :-)


 ---
  src/openvz/openvz_driver.c |   52 
 
  1 file changed, 52 insertions(+)

 diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
 index 7ec327d..e8b6915 100644
 --- a/src/openvz/openvz_driver.c
 +++ b/src/openvz/openvz_driver.c
 @@ -57,6 +57,7 @@
  #include logging.h
  #include command.h
  #include viruri.h
 +#include stats_linux.h
  
  #define VIR_FROM_THIS VIR_FROM_OPENVZ
  
 @@ -1672,6 +1673,56 @@ cleanup:
  return ret;
  }
  
 +static int
 +openvzDomainInterfaceStats (virDomainPtr dom,
 +const char *path,
 +struct _virDomainInterfaceStats *stats)
 +{
 +struct openvz_driver *driver = dom-conn-privateData;
 +virDomainObjPtr vm;
 +int i;
 +int ret = -1;
 +
 +openvzDriverLock(driver);
 +vm = virDomainFindByUUID(driver-domains, dom-uuid);
 +openvzDriverUnlock(driver);
 +
 +if (!vm) {
 +char uuidstr[VIR_UUID_STRING_BUFLEN];
 +virUUIDFormat(dom-uuid, uuidstr);
 +openvzError(VIR_ERR_NO_DOMAIN,
 +_(no domain with matching uuid '%s'), uuidstr);
 +goto cleanup;
 +}
 +
 +if (!virDomainObjIsActive(vm)) {
 +openvzError(VIR_ERR_OPERATION_INVALID,
 +%s, _(domain is not running));
 +goto cleanup;
 +}
 +
 +/* Check the path is one of the domain's network interfaces. */
 +for (i = 0 ; i  vm-def-nnets ; i++) {
 +if (vm-def-nets[i]-ifname 
 +STREQ (vm-def-nets[i]-ifname, path)) {
 +ret = 0;
 +break;
 +}
 +}
 +
 +if (ret == 0)
 +ret = linuxDomainInterfaceStats(path, stats);
 +else
 +openvzError(VIR_ERR_INVALID_ARG,
 +_(invalid path, '%s' is not a known interface), path);
 +
 +cleanup:
 +if (vm)
 +virDomainObjUnlock(vm);
 +return ret;
 +}
 +
 +
  static virDriver openvzDriver = {
  .no = VIR_DRV_OPENVZ,
  .name = OPENVZ,
 @@ -1717,6 +1768,7 @@ static virDriver openvzDriver = {
  .domainUndefineFlags = openvzDomainUndefineFlags, /* 0.9.4 */
  .domainGetAutostart = openvzDomainGetAutostart, /* 0.4.6 */
  .domainSetAutostart = openvzDomainSetAutostart, /* 0.4.6 */
 +.domainInterfaceStats = openvzDomainInterfaceStats, /* 0.9.12 */
  .isEncrypted = openvzIsEncrypted, /* 0.7.3 */
  .isSecure = openvzIsSecure, /* 0.7.3 */
  .domainIsActive = openvzDomainIsActive, /* 0.7.3 */

ACK. This is pretty much verbatim what is in qemuDomainInterfaceStats,
and they're both operating on a host-side veth/tap.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 0/9] Add basic driver for Parallels Virtuozzo Server

2012-04-20 Thread Dmitry Guryanov
Parallels Virtuozzo Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.

Current name of this product is Parallels Server Bare Metal and
more information about it can be found here -
http://www.parallels.com/products/server/baremetal/sp/.

This driver will work with PVS version 6.0 , beta version
scheduled at 2012 Q2.

changes in v5:
* rebased to current version
changes in v4:
* fix errors, found by 'make syntax-check'

Dmitry Guryanov (9):
  pvs: add driver skeleton
  util: add functions for interating over json object
  pvs: add functions to list domains and get info
  pvs: implement functions for domain life cycle management
  pvs: get info about serial ports
  pvs: add support of VNC remote display
  pvs: implement virDomainDefineXML operation for existing domains
  pvs: add storage driver
  pvs: implement VM creation

 AUTHORS |1 +
 cfg.mk  |1 +
 configure.ac|   23 +
 docs/drvpvs.html.in |   28 +
 include/libvirt/virterror.h |1 +
 libvirt.spec.in |7 +
 mingw32-libvirt.spec.in |6 +
 po/POTFILES.in  |3 +
 src/Makefile.am |   23 +
 src/conf/domain_conf.c  |3 +-
 src/conf/domain_conf.h  |1 +
 src/driver.h|1 +
 src/libvirt.c   |   12 +
 src/pvs/pvs_driver.c| 1280 +
 src/pvs/pvs_driver.h|   75 +++
 src/pvs/pvs_storage.c   | 1458 +++
 src/pvs/pvs_utils.c |  143 +
 src/util/json.c |   30 +
 src/util/json.h |4 +
 src/util/virterror.c|3 +
 20 files changed, 3102 insertions(+), 1 deletions(-)
 create mode 100644 docs/drvpvs.html.in
 create mode 100644 src/pvs/pvs_driver.c
 create mode 100644 src/pvs/pvs_driver.h
 create mode 100644 src/pvs/pvs_storage.c
 create mode 100644 src/pvs/pvs_utils.c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 9/9] pvs: implement VM creation

2012-04-20 Thread Dmitry Guryanov
To create a new VM in PVS we should issue prlctl create command,
and give path to the directory, where VM should be created. VM's
storage will be in that directory later. So in this first version
find out location of first VM's hard disk and create VM there.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c  |   78 -
 src/pvs/pvs_driver.h  |4 ++
 src/pvs/pvs_storage.c |6 +---
 3 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 0ae9b47..424d552 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -1097,6 +1097,74 @@ pvsApplyChanges(virDomainObjPtr dom, virDomainDefPtr 
newdef)
 return 0;
 }
 
+static int
+pvsCreateVm(virConnectPtr conn, virDomainDefPtr def)
+{
+pvsConnPtr privconn = conn-privateData;
+int i;
+virStorageVolDefPtr privvol = NULL;
+virStoragePoolObjPtr pool = NULL;
+virStorageVolPtr vol = NULL;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+for (i = 0; i  def-ndisks; i++) {
+if (def-disks[i]-device != VIR_DOMAIN_DISK_DEVICE_DISK)
+continue;
+
+vol = pvsStorageVolumeLookupByPathLocked(conn, def-disks[i]-src);
+if (!vol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find volume with path '%s'),
+ def-disks[i]-src);
+return -1;
+}
+break;
+}
+
+if (!vol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't create VM without hard disks));
+return -1;
+}
+
+pool = virStoragePoolObjFindByName(privconn-pools, vol-pool);
+if (!pool) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find storage pool with name '%s'),
+ vol-pool);
+goto error;
+}
+
+privvol = virStorageVolDefFindByPath(pool, def-disks[i]-src);
+if (!privvol) {
+pvsError(VIR_ERR_INVALID_ARG,
+ _(Can't find storage volume definition for path '%s'),
+ def-disks[i]-src);
+goto error2;
+}
+
+virUUIDFormat(def-uuid, uuidstr);
+
+if (pvsCmdRun(PRLCTL, create, def-name, --dst,
+  pool-def-target.path, --no-hdd,
+  --uuid, uuidstr, NULL)  0)
+goto error2;
+
+if (pvsCmdRun(PRLCTL, set, def-name, --vnc-mode, auto, NULL)  0)
+goto error2;
+
+virStoragePoolObjUnlock(pool);
+virUnrefStorageVol(vol);
+
+return 0;
+
+  error2:
+virStoragePoolObjUnlock(pool);
+  error:
+virUnrefStorageVol(vol);
+return -1;
+}
+
 static virDomainPtr
 pvsDomainDefineXML(virConnectPtr conn, const char *xml)
 {
@@ -1133,8 +1201,16 @@ pvsDomainDefineXML(virConnectPtr conn, const char *xml)
 
 def = NULL;
 } else {
-pvsError(VIR_ERR_NO_SUPPORT, _(Not implemented yet));
+if (pvsCreateVm(conn, def))
 goto cleanup;
+if (pvsLoadDomains(privconn, def-name))
+goto cleanup;
+dom = virDomainFindByName(privconn-domains, def-name);
+if (!dom) {
+pvsError(VIR_ERR_INTERNAL_ERROR,
+ _(Domain is not defined after creation));
+goto cleanup;
+}
 }
 
 event = virDomainEventNewFromObj(dom,
diff --git a/src/pvs/pvs_driver.h b/src/pvs/pvs_driver.h
index 7a21952..a1125cd 100644
--- a/src/pvs/pvs_driver.h
+++ b/src/pvs/pvs_driver.h
@@ -67,5 +67,9 @@ int pvsCmdRun(const char *binary, ...);
 char * pvsAddFileExt(const char *path, const char *ext);
 void pvsDriverLock(pvsConnPtr driver);
 void pvsDriverUnlock(pvsConnPtr driver);
+virStorageVolPtr pvsStorageVolumeLookupByPathLocked(virConnectPtr
+   conn,
+   const char
+   *path);
 
 #endif
diff --git a/src/pvs/pvs_storage.c b/src/pvs/pvs_storage.c
index b2a9a2c..3f08264 100644
--- a/src/pvs/pvs_storage.c
+++ b/src/pvs/pvs_storage.c
@@ -41,10 +41,6 @@ static virStorageVolDefPtr 
pvsStorageVolumeDefine(virStoragePoolObjPtr pool,
   const char *xmldesc,
   const char *xmlfile,
   bool is_new);
-static virStorageVolPtr pvsStorageVolumeLookupByPathLocked(virConnectPtr
-   conn,
-   const char
-   *path);
 static virStorageVolPtr pvsStorageVolumeLookupByPath(virConnectPtr conn,
  const char *path);
 static int pvsStoragePoolGetAlloc(virStoragePoolDefPtr def);
@@ -941,7 +937,7 @@ pvsStorageVolumeLookupByKey(virConnectPtr conn, const char 
*key)
 return ret;
 }
 
-static 

[libvirt] [PATCH v5 3/9] pvs: add functions to list domains and get info

2012-04-20 Thread Dmitry Guryanov
PVS driver is 'stateless', like vmware or openvz drivers.
It collects information about domains during startup using
command-line utility prlctl. VMs in PVS identified by UUIDs
or unique names, which can be used as respective fields in
virDomainDef structure. Currently only basic info, like
description, virtual cpus number and memory amount implemented.
Quering devices information will be added in the next patches.

PVS does't support non-persistent domains - you can't run
a domain having only disk image, it must always be registered
in system.

Functions for quering domain info have been just copied from
test driver with some changes - they extract needed data from
previouly created list of virDomainObj objects.

changes in v4:
* fix indent in preprocessor directives in pvs_driver.h
* add pvs_driver.c to POTFILES.in

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 po/POTFILES.in   |1 +
 src/Makefile.am  |3 +-
 src/pvs/pvs_driver.c |  516 +-
 src/pvs/pvs_driver.h |   14 ++
 src/pvs/pvs_utils.c  |  101 ++
 5 files changed, 633 insertions(+), 2 deletions(-)
 create mode 100644 src/pvs/pvs_utils.c

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4ea544b..07ccb7c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -165,6 +165,7 @@ src/xenapi/xenapi_driver.c
 src/xenapi/xenapi_utils.c
 src/xenxs/xen_sxpr.c
 src/xenxs/xen_xm.c
+src/pvs/pvs_driver.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 8057f54..1dd27c3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -468,7 +468,8 @@ HYPERV_DRIVER_EXTRA_DIST =  
\
 
 PVS_DRIVER_SOURCES =   
\
pvs/pvs_driver.h
\
-   pvs/pvs_driver.c
+   pvs/pvs_driver.c
\
+   pvs/pvs_utils.c
 
 NETWORK_DRIVER_SOURCES =   \
network/bridge_driver.h network/bridge_driver.c
diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 3e48a76..736aa55 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -50,12 +50,13 @@
 #include configmake.h
 #include storage_file.h
 #include nodeinfo.h
-#include json.h
+#include domain_conf.h
 
 #include pvs_driver.h
 
 #define VIR_FROM_THIS VIR_FROM_PVS
 
+void pvsFreeDomObj(void *p);
 static virCapsPtr pvsBuildCapabilities(void);
 static int pvsClose(virConnectPtr conn);
 
@@ -77,6 +78,14 @@ pvsDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
 return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
 }
 
+void
+pvsFreeDomObj(void *p)
+{
+pvsDomObjPtr pdom = (pvsDomObjPtr) p;
+
+VIR_FREE(pdom);
+};
+
 static virCapsPtr
 pvsBuildCapabilities(void)
 {
@@ -125,6 +134,218 @@ pvsGetCapabilities(virConnectPtr conn)
 return xml;
 }
 
+/*
+ * Must be called with privconn-lock held
+ */
+static virDomainObjPtr
+pvsLoadDomain(pvsConnPtr privconn, virJSONValuePtr jobj)
+{
+virDomainObjPtr dom = NULL;
+virDomainDefPtr def = NULL;
+pvsDomObjPtr pdom = NULL;
+virJSONValuePtr jobj2, jobj3;
+const char *tmp;
+char *endptr;
+unsigned long mem;
+unsigned int x;
+
+if (VIR_ALLOC(def)  0)
+goto no_memory;
+
+def-virtType = VIR_DOMAIN_VIRT_PVS;
+def-id = -1;
+
+tmp = virJSONValueObjectGetString(jobj, Name);
+if (!tmp) {
+pvsParseError();
+goto cleanup;
+}
+if (!(def-name = strdup(tmp)))
+goto no_memory;
+
+tmp = virJSONValueObjectGetString(jobj, ID);
+if (!tmp) {
+pvsParseError();
+goto cleanup;
+}
+
+if (virUUIDParse(tmp, def-uuid)  0) {
+pvsError(VIR_ERR_INTERNAL_ERROR, %s,
+ _(UUID in config file malformed));
+goto cleanup;
+}
+
+tmp = virJSONValueObjectGetString(jobj, Description);
+if (!tmp) {
+pvsParseError();
+goto cleanup;
+}
+if (!(def-description = strdup(tmp)))
+goto no_memory;
+
+jobj2 = virJSONValueObjectGet(jobj, Hardware);
+if (!jobj2) {
+pvsParseError();
+goto cleanup;
+}
+
+jobj3 = virJSONValueObjectGet(jobj2, cpu);
+if (!jobj3) {
+pvsParseError();
+goto cleanup;
+}
+
+if (virJSONValueObjectGetNumberUint(jobj3, cpus, x)  0) {
+pvsParseError();
+goto cleanup;
+}
+def-vcpus = x;
+def-maxvcpus = x;
+
+jobj3 = virJSONValueObjectGet(jobj2, memory);
+if (!jobj3) {
+pvsParseError();
+goto cleanup;
+}
+
+tmp = virJSONValueObjectGetString(jobj3, size);
+
+if (virStrToLong_ul(tmp, endptr, 10, mem)  0) {
+pvsParseError();
+goto cleanup;
+}
+
+if (!STREQ(endptr, Mb)) {
+pvsParseError();
+goto cleanup;
+}
+
+

[libvirt] [PATCH v5 5/9] pvs: get info about serial ports

2012-04-20 Thread Dmitry Guryanov
Add support of collecting information about serial
ports. This change is needed mostly as an example,
support of other devices will be added later.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |  115 ++
 1 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index b0835b0..ea551fb 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -145,6 +145,118 @@ pvsGetCapabilities(virConnectPtr conn)
 return xml;
 }
 
+static int
+pvsGetSerialInfo(virDomainChrDefPtr chr,
+ const char *name, virJSONValuePtr value)
+{
+const char *tmp;
+
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+chr-target.port = atoi(name + strlen(serial));
+
+if (virJSONValueObjectHasKey(value, output)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_FILE;
+
+tmp = virJSONValueObjectGetString(value, output);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.file.path = strdup(tmp)))
+goto no_memory;
+} else if (virJSONValueObjectHasKey(value, socket)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_UNIX;
+
+tmp = virJSONValueObjectGetString(value, socket);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.nix.path = strdup(tmp)))
+goto no_memory;
+chr-source.data.nix.listen = false;
+} else if (virJSONValueObjectHasKey(value, real)) {
+chr-source.type = VIR_DOMAIN_CHR_TYPE_DEV;
+
+tmp = virJSONValueObjectGetString(value, real);
+if (!tmp) {
+pvsParseError();
+return -1;
+}
+
+if (!(chr-source.data.file.path = strdup(tmp)))
+goto no_memory;
+} else {
+pvsParseError();
+return -1;
+}
+
+return 0;
+
+  no_memory:
+virReportOOMError();
+return -1;
+}
+
+static int
+pvsAddSerialInfo(virDomainObjPtr dom,
+ const char *key, virJSONValuePtr value)
+{
+virDomainDefPtr def = dom-def;
+virDomainChrDefPtr chr = NULL;
+
+if (!(chr = virDomainChrDefNew()))
+goto no_memory;
+
+if (pvsGetSerialInfo(chr, key, value))
+goto cleanup;
+
+if (VIR_REALLOC_N(def-serials, def-nserials + 1)  0) {
+virDomainChrDefFree(chr);
+goto no_memory;
+}
+
+def-serials[def-nserials++] = chr;
+
+return 0;
+
+  no_memory:
+virReportOOMError();
+  cleanup:
+virDomainChrDefFree(chr);
+return -1;
+}
+
+static int
+pvsAddDomainHardware(virDomainObjPtr dom, virJSONValuePtr jobj)
+{
+int n, i;
+virJSONValuePtr value;
+const char *key;
+
+n = virJSONValueObjectKeysNumber(jobj);
+if (n  1)
+goto cleanup;
+
+for (i = 0; i  n; i++) {
+key = virJSONValueObjectGetKey(jobj, i);
+value = virJSONValueObjectGetValue(jobj, i);
+
+if (STRPREFIX(key, serial)) {
+if (pvsAddSerialInfo(dom, key, value))
+goto cleanup;
+}
+}
+
+return 0;
+
+  cleanup:
+return -1;
+}
+
 /*
  * Must be called with privconn-lock held
  */
@@ -293,6 +405,9 @@ pvsLoadDomain(pvsConnPtr privconn, virJSONValuePtr jobj)
 else
 dom-autostart = 0;
 
+if (pvsAddDomainHardware(dom, jobj2)  0)
+goto cleanup_unlock;
+
 virDomainObjUnlock(dom);
 
 return dom;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 7/9] pvs: implement virDomainDefineXML operation for existing domains

2012-04-20 Thread Dmitry Guryanov
Add pvsDomainDefineXML functions, it works only for existing
domains for the present.

It's too hard to convert libvirt's XML domain configuration into
PVS's one, so I've decided to compare virDomainDef structures:
current domain definition and the one created from XML, given to
the function. And change only different parameters.

Only description change implemetented, changing other parameters
will be implemented later.

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 src/pvs/pvs_driver.c |   89 ++
 1 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 839cf06..9052740 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -1069,6 +1069,94 @@ pvsShutdownDomain(virDomainPtr domain)
 VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
 }
 
+static int
+pvsSetDescription(virDomainObjPtr dom, const char *description)
+{
+pvsDomObjPtr pvsdom;
+
+pvsdom = dom-privateData;
+if (pvsCmdRun(PRLCTL, set, pvsdom-uuid,
+  --description, description, NULL))
+return -1;
+
+return 0;
+}
+
+static int
+pvsApplyChanges(virDomainObjPtr dom, virDomainDefPtr newdef)
+{
+virDomainDefPtr olddef = dom-def;
+
+if (newdef-description  !STREQ(olddef-description, 
newdef-description)) {
+if (pvsSetDescription(dom, newdef-description))
+return -1;
+}
+
+/* TODO: compare all other parameters */
+
+return 0;
+}
+
+static virDomainPtr
+pvsDomainDefineXML(virConnectPtr conn, const char *xml)
+{
+pvsConnPtr privconn = conn-privateData;
+virDomainPtr ret = NULL;
+virDomainDefPtr def;
+virDomainObjPtr dom = NULL, olddom = NULL;
+virDomainEventPtr event = NULL;
+int dupVM;
+
+pvsDriverLock(privconn);
+if ((def = virDomainDefParseString(privconn-caps, xml,
+   1  VIR_DOMAIN_VIRT_PVS,
+   VIR_DOMAIN_XML_INACTIVE)) == NULL) {
+pvsError(VIR_ERR_INVALID_ARG, _(Can't parse XML desc));
+goto cleanup;
+}
+
+if ((dupVM = virDomainObjIsDuplicate(privconn-domains, def, 0))  0) {
+pvsError(VIR_ERR_INVALID_ARG, _(Already exists));
+goto cleanup;
+}
+
+if (dupVM == 1) {
+olddom = virDomainFindByUUID(privconn-domains, def-uuid);
+pvsApplyChanges(olddom, def);
+virDomainObjUnlock(olddom);
+
+if (!(dom = virDomainAssignDef(privconn-caps,
+   privconn-domains, def, false))) {
+pvsError(VIR_ERR_INTERNAL_ERROR, _(Can't allocate domobj));
+goto cleanup;
+}
+
+def = NULL;
+} else {
+pvsError(VIR_ERR_NO_SUPPORT, _(Not implemented yet));
+goto cleanup;
+}
+
+event = virDomainEventNewFromObj(dom,
+ VIR_DOMAIN_EVENT_DEFINED,
+ !dupVM ?
+ VIR_DOMAIN_EVENT_DEFINED_ADDED :
+ VIR_DOMAIN_EVENT_DEFINED_UPDATED);
+
+ret = virGetDomain(conn, dom-def-name, dom-def-uuid);
+if (ret)
+ret-id = dom-def-id;
+
+  cleanup:
+virDomainDefFree(def);
+if (dom)
+virDomainObjUnlock(dom);
+if (event)
+pvsDomainEventQueue(privconn, event);
+pvsDriverUnlock(privconn);
+return ret;
+}
+
 static virDriver pvsDriver = {
 .no = VIR_DRV_PVS,
 .name = PVS,
@@ -1096,6 +1184,7 @@ static virDriver pvsDriver = {
 .domainDestroy = pvsDestroyDomain,  /* 0.9.12 */
 .domainShutdown = pvsShutdownDomain, /* 0.9.12 */
 .domainCreate = pvsDomainCreate,/* 0.9.12 */
+.domainDefineXML = pvsDomainDefineXML,  /* 0.9.12 */
 };
 
 /**
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 8/9] pvs: add storage driver

2012-04-20 Thread Dmitry Guryanov
PVS has one serious discrepancy with libvirt: libvirt stores
domain configuration files always in one place, and storage files
in other places (with API of storage pools and storage volumes).
PVS store all domain data in a single directory, for example, you
may have domain with name fedora-15, which will be located in
'/var/parallels/fedora-15.pvm', and it's hard disk image will be
in '/var/parallels/fedora-15.pvm/harddisk1.hdd'.

I've decided to create storage driver, which produces pseudo-volumes
(xml files with volume description), and they will be 'converted' to
real disk images after attaching to a VM.

So if someone creates VM with one hard disk using virt-manager,
at first virt-manager creates a new volume, and then defines a
domain. We can lookup a volume by path in XML domain definition
and find out location of new domain and size of its hard disk.

changes in v4:
* add virCheckFlags to pvsStorageFindPoolSources

Signed-off-by: Dmitry Guryanov dgurya...@parallels.com
---
 po/POTFILES.in|1 +
 src/Makefile.am   |3 +-
 src/pvs/pvs_driver.c  |6 +-
 src/pvs/pvs_driver.h  |5 +
 src/pvs/pvs_storage.c | 1462 +
 src/pvs/pvs_utils.c   |   24 +
 6 files changed, 1498 insertions(+), 3 deletions(-)
 create mode 100644 src/pvs/pvs_storage.c

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7ec8df5..d9f4d65 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -167,6 +167,7 @@ src/xenxs/xen_sxpr.c
 src/xenxs/xen_xm.c
 src/pvs/pvs_driver.c
 src/pvs/pvs_utils.c
+src/pvs/pvs_storage.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 1dd27c3..e6f59cd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -469,7 +469,8 @@ HYPERV_DRIVER_EXTRA_DIST =  
\
 PVS_DRIVER_SOURCES =   
\
pvs/pvs_driver.h
\
pvs/pvs_driver.c
\
-   pvs/pvs_utils.c
+   pvs/pvs_utils.c 
\
+   pvs/pvs_storage.c
 
 NETWORK_DRIVER_SOURCES =   \
network/bridge_driver.h network/bridge_driver.c
diff --git a/src/pvs/pvs_driver.c b/src/pvs/pvs_driver.c
index 9052740..0ae9b47 100644
--- a/src/pvs/pvs_driver.c
+++ b/src/pvs/pvs_driver.c
@@ -65,13 +65,13 @@ int pvsStart(virDomainObjPtr privdom);
 int pvsKill(virDomainObjPtr privdom);
 int pvsStop(virDomainObjPtr privdom);
 
-static void
+void
 pvsDriverLock(pvsConnPtr driver)
 {
 virMutexLock(driver-lock);
 }
 
-static void
+void
 pvsDriverUnlock(pvsConnPtr driver)
 {
 virMutexUnlock(driver-lock);
@@ -1197,6 +1197,8 @@ pvsRegister(void)
 {
 if (virRegisterDriver(pvsDriver)  0)
 return -1;
+if (pvsStorageRegister())
+return -1;
 
 return 0;
 }
diff --git a/src/pvs/pvs_driver.h b/src/pvs/pvs_driver.h
index 080f34b..7a21952 100644
--- a/src/pvs/pvs_driver.h
+++ b/src/pvs/pvs_driver.h
@@ -26,6 +26,7 @@
 
 # include domain_conf.h
 # include storage_conf.h
+# include driver.h
 # include domain_event.h
 
 # include json.h
@@ -59,8 +60,12 @@ typedef struct _pvsConn pvsConn;
 typedef struct _pvsConn *pvsConnPtr;
 
 int pvsRegister(void);
+int pvsStorageRegister(void);
 
 virJSONValuePtr pvsParseOutput(const char *binary, ...);
 int pvsCmdRun(const char *binary, ...);
+char * pvsAddFileExt(const char *path, const char *ext);
+void pvsDriverLock(pvsConnPtr driver);
+void pvsDriverUnlock(pvsConnPtr driver);
 
 #endif
diff --git a/src/pvs/pvs_storage.c b/src/pvs/pvs_storage.c
new file mode 100644
index 000..b2a9a2c
--- /dev/null
+++ b/src/pvs/pvs_storage.c
@@ -0,0 +1,1462 @@
+/*
+ * pvs_storage.c: core driver functions for managing
+ * Parallels Virtuozzo Server hosts
+ *
+ * Copyright (C) 2012 Parallels, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include config.h
+
+#include stdlib.h
+#include dirent.h
+#include sys/statvfs.h
+
+#include datatypes.h
+#include memory.h
+#include configmake.h
+#include storage_file.h
+#include virterror_internal.h
+
+#include