[libvirt] [test-API][PATCH] Add new case for listAllVolumes and update releated conf

2013-12-11 Thread codong
listAllVolumes is a new API in RHEL7, so add a new case for it.
And add the case to releated conf to check the volumes list.

modified:   cases/storage_dir.conf
modified:   cases/storage_dir_vol_resize_delta.conf
modified:   cases/storage_logical.conf
modified:   cases/storage_netfs.conf
new file:   repos/storage/list_volumes.py
---
 cases/storage_dir.conf  |   16 +
 cases/storage_dir_vol_resize_delta.conf |8 +++
 cases/storage_logical.conf  |   16 +
 cases/storage_netfs.conf|   16 +
 repos/storage/list_volumes.py   |   97 +++
 5 files changed, 153 insertions(+), 0 deletions(-)
 create mode 100644 repos/storage/list_volumes.py

diff --git a/cases/storage_dir.conf b/cases/storage_dir.conf
index 38b349d..393d34f 100644
--- a/cases/storage_dir.conf
+++ b/cases/storage_dir.conf
@@ -20,6 +20,10 @@ storage:create_dir_volume
 capacity
 $defaultvolumesize
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:vol_clone
 poolname
 $defaultpoolname
@@ -28,18 +32,30 @@ storage:vol_clone
 clonevolname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_dir_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_dir_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolumename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:destroy_pool
 poolname
 $defaultpoolname
diff --git a/cases/storage_dir_vol_resize_delta.conf 
b/cases/storage_dir_vol_resize_delta.conf
index 58e15bf..22d3b47 100644
--- a/cases/storage_dir_vol_resize_delta.conf
+++ b/cases/storage_dir_vol_resize_delta.conf
@@ -12,6 +12,10 @@ storage:create_dir_volume
 capacity
 $defaultvolumesize
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:vol_resize_delta
 poolname
 $defaultpoolname
@@ -42,6 +46,10 @@ storage:delete_dir_volume
 volname
 $defaultvolumename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:destroy_pool
 poolname
 $defaultpoolname
diff --git a/cases/storage_logical.conf b/cases/storage_logical.conf
index d374dfa..a0fdad6 100644
--- a/cases/storage_logical.conf
+++ b/cases/storage_logical.conf
@@ -22,6 +22,10 @@ storage:create_logical_volume
 capacity
 $defaultvolumesize
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:vol_clone
 poolname
 $defaultpoolname
@@ -30,18 +34,30 @@ storage:vol_clone
 clonevolname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_logical_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_logical_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolumename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:destroy_pool
 poolname
 $defaultpoolname
diff --git a/cases/storage_netfs.conf b/cases/storage_netfs.conf
index f486ff4..6880763 100644
--- a/cases/storage_netfs.conf
+++ b/cases/storage_netfs.conf
@@ -24,6 +24,10 @@ storage:create_netfs_volume
 capacity
 $defaultvolumesize
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:vol_clone
 poolname
 $defaultpoolname
@@ -32,18 +36,30 @@ storage:vol_clone
 clonevolname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_netfs_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolclonename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:delete_netfs_volume
 poolname
 $defaultpoolname
 volname
 $defaultvolumename
 
+storage:list_volumes
+poolname
+$defaultpoolname
+
 storage:destroy_pool
 poolname
 $defaultpoolname
diff --git a/repos/storage/list_volumes.py b/repos/storage/list_volumes.py
new file mode 100644
index 000..9555720
--- /dev/null
+++ b/repos/storage/list_volumes.py
@@ -0,0 +1,97 @@
+#!/usr/bin/evn python
+
+import libvirt
+from libvirt import libvirtError
+from xml.dom import minidom
+
+from utils import utils
+
+from src import sharedmod
+
+required_params = ('poolname',)
+optional_params = {}
+
+
+def get_pool_path(pool_obj):
+
+Get the pool path
+
+poolxml = pool_obj.XMLDesc(0)
+logger.debug(the xml description of pool is %s % poolxml)
+
+doc = minidom.parseString(poolxml)
+path_element = doc.getElementsByTagName('path')[0]
+textnode = path_element.childNodes[0]
+path_value = textnode.data
+
+

Re: [libvirt] [test-API][PATCH] Add new case for listAllVolumes and update releated conf

2013-12-11 Thread Guannan Ren

On 2013年12月12日 10:13, codong wrote:

listAllVolumes is a new API in RHEL7, so add a new case for it.
And add the case to releated conf to check the volumes list.

modified:   cases/storage_dir.conf
modified:   cases/storage_dir_vol_resize_delta.conf
modified:   cases/storage_logical.conf
modified:   cases/storage_netfs.conf
new file:   repos/storage/list_volumes.py
---
  cases/storage_dir.conf  |   16 +
  cases/storage_dir_vol_resize_delta.conf |8 +++
  cases/storage_logical.conf  |   16 +
  cases/storage_netfs.conf|   16 +
  repos/storage/list_volumes.py   |   97 +++
  5 files changed, 153 insertions(+), 0 deletions(-)
  create mode 100644 repos/storage/list_volumes.py




The testcase works for the pool of dir type only.
If you want to test pool of all type in one testcase, the testcase is 
not good enough obviously.


Guannan

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

Re: [libvirt] [test-API][PATCH] Add new case for listAllVolumes and update releated conf

2013-12-11 Thread Cong Dong

- Original Message -
 From: Guannan Ren g...@redhat.com
 To: codong cod...@redhat.com
 Cc: libvir-list@redhat.com
 Sent: Thursday, December 12, 2013 11:57:31 AM
 Subject: Re: [libvirt][test-API][PATCH] Add new case for listAllVolumes and 
 update releated conf
 
 On 2013年12月12日 10:13, codong wrote:
  listAllVolumes is a new API in RHEL7, so add a new case for it.
  And add the case to releated conf to check the volumes list.
 
  modified:   cases/storage_dir.conf
  modified:   cases/storage_dir_vol_resize_delta.conf
  modified:   cases/storage_logical.conf
  modified:   cases/storage_netfs.conf
  new file:   repos/storage/list_volumes.py
  ---
cases/storage_dir.conf  |   16 +
cases/storage_dir_vol_resize_delta.conf |8 +++
cases/storage_logical.conf  |   16 +
cases/storage_netfs.conf|   16 +
repos/storage/list_volumes.py   |   97
+++
5 files changed, 153 insertions(+), 0 deletions(-)
create mode 100644 repos/storage/list_volumes.py
 
 
 
 The testcase works for the pool of dir type only.
 If you want to test pool of all type in one testcase, the testcase is
 not good enough obviously.

The pool will be mappeed to the local filesystem , so I can check the
volumes list in the pool path as a dir type, right?

Info from libvirt.org/formatstorage.html#StoragePoolTarget

Target elements in storage xml is used to describe the mapping of the 
storage pool into the host filesystem. path is one of the  child 
elements.

path
Provides the location at which the pool will be mapped into the 
local filesystem namespace. For a filesystem/directory based pool it
 will be the name of the directory in which volumes will be created. 
For device based pools it will be the name of the directory in which 
devices nodes exist. For the latter /dev/ may seem like the logical 
choice, however, devices nodes there are not guaranteed stable across 
reboots, since they are allocated on demand. It is preferable to use 
a stable location such as one of the /dev/disk/by-{path,id,uuid,label 
locations.

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