[libvirt] [PATCH python 0/7] Remove unused code from generator
by Daniel P. Berrange
All this functionality is inherited from libxml, but is not required
to generate libvirt python bindings.
Daniel P. Berrange (7):
Removed unused 'reference_keepers' code from generator
Removed unused 'function_post' code from generator
Removed unused 'foreign_encoding_args' code from generator
Removed unused 'py_return_types' code from generator
Removed unused 'classes_ancestor' code from generator
Removed unused 'converter_type' code from generator
Removed unused 'functions_list_exception_test' code from generator
generator.py | 170 +++++++++++------------------------------------------------
1 file changed, 30 insertions(+), 140 deletions(-)
--
2.9.3
7 years, 10 months
[libvirt] [PATCH] domain_conf: vnc: preserve autoport value if no port was specified
by Pavel Hrdina
The issue is that if this graphics definition is provided:
<graphics type='vnc' port='0'/>
it's parsed as:
<graphics type='vnc' autoport='no'>
<listen type='address'/>
</graphics>
but if the resulting XML is parsed again the output is:
<graphics type='vnc' port='-1' autoport='yes'>
<listen type='address'/>
</graphics>
and this should not happen. The XML have to always remain the same
after it was already parsed by libvirt.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1383039
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 2 ++
.../generic-graphics-vnc-autoport-no.xml | 30 ++++++++++++++++++++++
tests/genericxml2xmltest.c | 1 +
3 files changed, 33 insertions(+)
create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-autoport-no.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 26bb0fdd0a..ffd020f641 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11716,6 +11716,8 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
def->data.vnc.port = 0;
def->data.vnc.autoport = true;
+ } else {
+ def->data.vnc.autoport = false;
}
}
diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-autoport-no.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-autoport-no.xml
new file mode 100644
index 0000000000..748e7f489d
--- /dev/null
+++ b/tests/genericxml2xmlindata/generic-graphics-vnc-autoport-no.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' autoport='no'>
+ <listen type='address'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 2ea2396480..488190270f 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -91,6 +91,7 @@ mymain(void)
DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-socket");
DO_TEST_FULL("graphics-vnc-socket-attr-listen-socket-mismatch", 0, false,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE);
+ DO_TEST("graphics-vnc-autoport-no");
DO_TEST_FULL("name-slash-fail", 0, false,
TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE);
--
2.11.0
7 years, 10 months
[libvirt] [PATCH] doc: improve VNC/SPICE password documentation
by Pavel Hrdina
If the passwd attribute is set to empty string it disables VNC/SPICE
access to the guest.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/formatdomain.html.in | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 3f7f87524a..1cb94d0253 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5499,9 +5499,10 @@ qemu-kvm -net nic,model=? /dev/null
should be auto-allocated). The <code>autoport</code> attribute is
the new preferred syntax for indicating auto-allocation of the TCP
port to use. The <code>passwd</code> attribute provides a VNC
- password in clear text. The <code>keymap</code> attribute specifies
- the keymap to use. It is possible to set a limit on the validity of
- the password by giving an timestamp
+ password in clear text, if the <code>passwd</code> is set to empty
+ string the VNC access is disabled. The <code>keymap</code> attribute
+ specifies the keymap to use. It is possible to set a limit on the
+ validity of the password by giving an timestamp
<code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be
in UTC. The <code>connected</code> attribute allows control of
connected client during password changes. VNC accepts
@@ -5540,11 +5541,13 @@ qemu-kvm -net nic,model=? /dev/null
an alternative secure port number. The <code>autoport</code>
attribute is the new preferred syntax for indicating
auto-allocation of needed port numbers. The <code>passwd</code>
- attribute provides a SPICE password in clear text. The
- <code>keymap</code> attribute specifies the keymap to use. It is
- possible to set a limit on the validity of the password by giving
- an timestamp <code>passwdValidTo='2010-04-09T15:51:00'</code>
- assumed to be in UTC.
+ attribute provides a SPICE password in clear text, if the
+ <code>passwd</code> is set to empty string the SPICE access is
+ disabled. The <code>keymap</code> attribute specifies the keymap
+ to use. It is possible to set a limit on the validity of the
+ password by giving an timestamp
+ <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be
+ in UTC.
</p>
<p>
The <code>connected</code> attribute allows control of connected
--
2.11.0
7 years, 10 months
[libvirt] Refactoring of storage pool
by Olga Krishtal
Hi everyone!
Half a year ago we started discussion about filesystem pools:
https://www.redhat.com/archives/libvir-list/2016-April/msg01941.html
https://www.redhat.com/archives/libvir-list/2016-May/msg00208.html
https://www.redhat.com/archives/libvir-list/2016-September/msg00463.html
At the end we have decided not to use copy/paste and try to merge code:
https://www.redhat.com/archives/libvir-list/2016-December/msg00051.html
However, after first try it had became obvious (the discussion is in the link above)
that pools can be describe as a separate object, that later will be used in storage pool,
filesystem pool, vgpu pool, etc. This latter is an extension of previous discussion;
I just want to separate refactoring of storage pools and the implementation of
filesystem pools a bit.
Before sending any patch with such huge refactoring I want to agree about pools
Here is an example of pool structures and prototypes of some management functions
that were discussed before (thanks a lot to John Ferlan for good advice).
I tried to tie everything together and here it is:
/*
* virpool.h: pool utility to manage structures commonly used for pools.
*
*/
/* The dscription of pool element
* For storage pool it used to be virStorageVolDef
* instead of key we use uuid, because key is specific
* for storage pools, and for other pool types (filesystem pools)
* or gpu pool we do nor have key.
* type field is also specific - that is why we put it into
* void* ElementTypeDef.
* ElementTypeDef - stores internal information about pool element(volume, item, etc)
* (the same as privateData for virConnectPtr)
* For example, for storage pool voluems it consists from:
* int type;
* virStorageVolSource source;
* virStorageSource target;
*/
#include "virhash.h"
typedef enum {
VIR_POOL_ELEMENT_VOLUME,
VIR_POOL_ELEMENT_FILESYSTEM,
VIR_POOL_ELEMENT_LAST,
} virPoolElemenType;
VIR_ENUM_DECL(virPoolElementType)
typedef void (*virPoolElementTypeDefFree) (void *PoolElementDef);
typedef struct _virPoolElementDef virPoolElementDef;
typedef virPoolElementDef *virPoolElementDefPtr;
struct _virPoolElementDef {
char *name;
char *uuid;
bool building;
unsigned int in_use;
int type;
void* ElementTypeDef;
virPoolElementTypeDefFree PoolElementDefFree;
};
typedef struct _virPoolElementDefList virPoolElementDefList;
typedef virPoolElementDefList *virPoolElementDefListPtr;
struct _virPoolElementDefList {
size_t count;
virPoolElementDefPtr *elements;
};
/* General information about pool source*/
typedef struct _virPoolSourceHost virPoolSourceHost;
typedef virPoolSourceHost *virPoolSourceHostPtr;
struct _virPoolSourceHost {
char *name;
int port;
};
typedef struct _virPoolAuthDef virPoolAuthDef;
typedef virPoolAuthDef *virPoolAuthDefPtr;
struct _virPoolAuthDef {
char *username;
char *secrettype; /* <secret type='%s' for disk source */
int authType; /* virStorageAuthType */
virSecretLookupTypeDef seclookupdef;
};
typedef enum {
VIR_POOL_SOURCE_DIR,
VIR_POOL_SOURCE_DEVICE,
VIR_POOL_SOURCE_NAME,
VIR_POOL_SOURCE_LAST,
} virPoolSourcePathType;
VIR_ENUM_DECL(virPoolSourcePathType)
typedef struct _virPoolSourcePath virPoolSourcePath;
typedef virPoolSourcePath *virPoolSourcePathPtr;
struct _virPoolSourcePath {
virPoolSourcePathType sourcetype;
char *path;
};
typedef void(*virPoolPrivDataFree) (void *privePoolData);
typedef struct _virPoolSource virPoolSource;
typedef virPoolSource *virPoolSourcePtr;
struct _virPoolSource{
/* One or more host definitions */
size_t nhost;
virPoolSourceHostPtr hosts;
/* Authentication information */
virPoolAuthDefPtr auth;
/* One or more devices */
size_t nsrcpath;
virPoolSourcePathPtr srcpaths;
/* Name of the source */
char *name;
/* Vendor of the source */
char *vendor;
/* Product name of the source */
char *product;
/*Some private data */
void *privatePoolData;
virPoolPrivDataFree privDataFree;
};
typedef struct _virPoolPathPerms virPoolPathPerms;
typedef virPoolPathPerms *virPoolPathPermsPtr;
struct _virPoolPathPerms {
mode_t mode;
uid_t uid;
gid_t gid;
char *label;
}
typedef struct _virPoolTarget virPoolTarget;
typedef virPoolTarget *virPoolTargetPtr;
struct _virPoolTarget{
char *path; /* Optional path to target */
virPoolPathPerms perms; /* Default permissions for path */
};
typedef struct _virPoolDef virPoolDef;
typedef virPoolDef *virPoolDefPtr;
struct _virPoolDef {
char *name;
unsigned char uuid[VIR_UUID_BUFLEN];
virPoolSource source;
virPoolTarget target;
};
typedef struct _virPoolInfo virPoolInfo; // used to be virPoolObj
typedef virPoolInfo *virPoolInfoPtr;
struct _virPoolInfo {
char *configFile;
char *autostartLink;
bool active;
int autostart;
unsigned int asyncjobs;
virPoolDefPtr def;
virPoolDefPtr newDef;
virPoolElementDefList elementsdef;
};
/* Used to be PoolObjList
* Separate struct - in case we will need additional info
* upon the hash table.
*/
typedef struct _virPoolStore virPoolStore;
typedef virPoolStore *virPoolStorePtr;
struct _virPoolStore {
size_t count;
virHashAtomicPtr *pools; //Used to be objects obj
};
/*
* Pool hash and pool elements managment operations
*/
void virPoolElementDefFree (virPoolElementDefPtr def);
void virPoolClearElements(virPoolInfoPtr poolinfo);
void virPoolAuthDefFree(virPoolAuthDefPtr authdef);
virPoolSourcePtr
virPoolSourceNew (virPoolPrivDataFree privDataFree);
void virPoolSourceClear(virPoolSourcePtr source);
void virPoolDefFree(virPoolDefPtr def);
void virPoolInfoFree(virPoolInfoPtr pool);
virPoolStorePtr virPoolStoreNew();
*
* Functions to manage pool as an object.
* */
// It is reference implementation.
#include "virpool.h"
VIR_ENUM_IMPL(virPoolElementType,
VIR_POOL_ELEMNT_LAST,
"volume", "filesystem");
void
virPoolElementDefFree(virPoolElementDefPtr def)
{
if (!def)
return;
VIR_FREE(def->name);
VIR_FREE(def->uuid);
if (def->PoolElementDefFree)
def->PoolElementDefFree(def->ElementTypeDef);
}
void
virPoolClearElements(virPoolInfoPtr poolinfo)
{
size_t i;
for (i = 0; i < poolinfo->elementsdef.count; i++)
virPoolElementDefFree(poolinfo->elementsdef.elements[i]);
VIR_FREE(poolinfo->elementdef.elements);
poolindo->elementsdef.count = 0;
}
/* General functions to work with pool */
VIR_ENUM_IMPL(virPoolSourcePathType,
VIR_POOL_SOURCE_LAST,
"dir", "device", "name");
void
virPoolAuthDefFree(virPoolAuthDefPtr authdef)
{
if (!authdef)
return;
VIR_FREE(authdef->username);
VIR_FREE(authdef->secrettype);
VIR_FREE(authdef);
}
virPoolSourcePtr
virPoolSourceNew(virPoolPrivDataFree privDataFree)
{
virPoolSourcePtr source;
if (VIR_ALLOC(source) < 0)
return -1;
source->privDataFree = privDataFree;
return source;
}
void
virPoolSourceClear(virPoolSourcePtr source)
{
size_t i;
if (!source)
return;
/* Free hosts */
for (i = 0; i < source->nhosts; i++)
VIR_FREE(source->hosts[i].name);
VIR_FREE(source->hosts);
/* Free auth information
* empty at the moment*/
virPoolAuthDefFree(source->auth);
/* Free dev path*/
for (i = 0; i < source->nsrcpath; i++)
VIR_FREE(source->srcpath[i].name);
VIR_FREE(source->srcpath);
VIR_FREE(source->name);
VIR_FREE(source->vendor);
VIR_FREE(source->product);
if (source->privDataFree)
source->privDataFree(source->privatePoolData);
}
void
virPoolDefFree(virPoolDefPtr def)
{
if (!def)
return;
VIR_FREE(def->name);
/*Free other fields*/
virPoolSourceClear(def->source);
VIR_FREE(def->target.path);
VIR_FREE(def->target.perms.lable);
VIR_FREE(def);
}
void
virPoolInfoFree(virPoolInfoPtr pool)
{
if (!pool)
return;
VIR_FREE(pool->configFile);
VIR_FREE(pool->autostartLink);
virPoolDefFree(pool->def);
virPoolDefFree(pool->newDef);
virPoolClearElements(pool);
}
virPoolStorePtr
virPoolStoreNew()
{
virPoolStorePtr poolstore;
if (VIR_ALLOC(poolstore) < 0)
return NULL;
poolstore->count = 0;
poolstore->pools = virHashAtomicNew(0, virPoolInfoFree);
return poolstore;
}
I will be glad to here any ideas and advises.
--
Best regards,
Olga
7 years, 10 months
[libvirt] [PATCH 0/7] perf: add CACHE_L1D perf event support
by Nitesh Konkar
This patch series adds support and documentation for
a generalized hardware cache event called CACHE_L1D
perf event. This perf event is split into cache_l1dra,
cache_l1drm, cache_l1dwa, cache_l1dwm, cache_l1dpa and
cache_l1dpm perf events depending on the config value
set.
Nitesh Konkar (7):
perf: add cache_l1dra perf event support
perf: add cache_l1drm perf event support
perf: add cache_l1dwa perf event support
perf: add cache_l1dwm perf event support
perf: add cache_l1dpa perf event support
perf: add cache_l1dpm perf event support
virsh: Fix manpage typo
docs/formatdomain.html.in | 42 ++++++++++++++++++
docs/news.xml | 6 ++-
docs/schemas/domaincommon.rng | 6 +++
include/libvirt/libvirt-domain.h | 66 +++++++++++++++++++++++++++++
src/libvirt-domain.c | 18 ++++++++
src/qemu/qemu_driver.c | 6 +++
src/remote/remote_protocol.x | 2 +-
src/util/virperf.c | 34 ++++++++++++++-
src/util/virperf.h | 6 +++
tests/genericxml2xmlindata/generic-perf.xml | 6 +++
tools/virsh.pod | 26 ++++++++++--
11 files changed, 210 insertions(+), 8 deletions(-)
--
1.9.3
7 years, 10 months
[libvirt] [PATCH] virnettlssessiontest.c: fix grammar
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
tests/virnettlssessiontest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index 0d2e106..24de212 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -74,9 +74,9 @@ static ssize_t testRead(char *buf, size_t len, void *opaque)
* This is replicating the checks that are done for an
* active TLS session after handshake completes. To
* simulate that we create our TLS contexts, skipping
- * sanity checks. When then get a socketpair, and
+ * sanity checks. We then get a socketpair, and
* initiate a TLS session across them. Finally do
- * do actual cert validation tests
+ * actual cert validation tests
*/
static int testTLSSessionInit(const void *opaque)
{
--
1.9.3
7 years, 10 months
[libvirt] [PATCH] perf: Prevent enabling of already enabled perf event
by Nitesh Konkar
Currently, on every --enable perf_event command,
a new event->fd is created and counting of perf
event counter starts from zero and previous
event->fd is lost. This patch prevents this
behaviour.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
src/util/virperf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 788b817..57c2081 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -230,6 +230,9 @@ virPerfEventEnable(virPerfPtr perf,
if (!event || !event_attr)
return -1;
+ if (event->enabled)
+ return 0;
+
if (event_attr->attrType == 0 && (type == VIR_PERF_EVENT_CMT ||
type == VIR_PERF_EVENT_MBMT ||
type == VIR_PERF_EVENT_MBML)) {
--
1.9.3
7 years, 10 months
[libvirt] [PATCH] docs: Reword virsh manpage for --uuid --name --details options
by Nitesh Konkar
This commit is similar to commit 0977ada8.The virsh manpage
lists options --uuid and --name as mutually exclusive if
option --details is specified when actually the option
--details is mutually exclusive and can't go with options
--uuid and/or --name. This patch rewords the virsh manpage
to state the correct meaning.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
tools/virsh.pod | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 290f508..fb62923 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3634,8 +3634,8 @@ I<--autostart> lists the autostarting pools, I<--no-autostart> lists the pools
with autostarting disabled. If I<--uuid> is specified only pool's UUIDs are printed.
If I<--name> is specified only pool's names are printed. If both I<--name>
and I<--uuid> are specified, pool's UUID and names are printed side by side
-without any header. Options I<--uuid> and I<--name> are mutually exclusive
-if option I<--details> is specified.
+without any header. Option I<--details> is mutually exclusive with options
+I<--uuid> and I<--name>.
You may also want to list pools with specified types using I<type>, the
pool types must be separated by comma, e.g. --type dir,disk. The valid pool
--
1.9.3
7 years, 10 months
[libvirt] [PATCH] virsh: Modify description for LIBVIRT_DEBUG=4 in manpage
by Nitesh Konkar
As LIBVIRT_DEBUG=4 logs only error messages and there
are no levels above it, adjusting the description in
the man page accordingly.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
tools/virsh.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index c1bdbdd..9e45f09 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4565,7 +4565,7 @@ Messages at level WARNING or above
=item * LIBVIRT_DEBUG=4
-Messages at level ERROR or above
+Messages at level ERROR
=back
--
1.9.3
7 years, 10 months
[libvirt] [PATCH] vstorage: fix build
by Olga Krishtal
Fixed errors when we build libvirt with --with-storage-vstorage key
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/storage/storage_backend_vstorage.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_vstorage.c b/src/storage/storage_backend_vstorage.c
index d3a12fb..7a1c468 100644
--- a/src/storage/storage_backend_vstorage.c
+++ b/src/storage/storage_backend_vstorage.c
@@ -9,6 +9,7 @@
#include <mntent.h>
#include <pwd.h>
#include <grp.h>
+#include "storage_util.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE
@@ -131,7 +132,7 @@ virStorageBackendVzPoolStop(virConnectPtr conn ATTRIBUTE_UNUSED,
if ((rc = virStorageBackendVzIsMounted(pool)) != 1)
return rc;
- return virStorageBackendUnmountLocal(pool);
+ return virStorageBackendUmountLocal(pool);
}
--
1.8.3.1
7 years, 10 months