[PATCH] remove script for bridge network
by Wenchao Xia
libvirt0.9.10 will report error if bridge network was defined
with script. This is the fix for it, otherwise VM start would fail.
Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
libxkutil/xmlgen.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 2dcd0d2..31619d8 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -269,18 +269,11 @@ static const char *set_net_source(xmlNodePtr nic,
return NULL;
}
-
+/* libvirt 0.9.10 report error if script is set with brdige */
static const char *bridge_net_to_xml(xmlNodePtr nic, struct net_device *dev)
{
- const char *script = "vif-bridge";
- xmlNodePtr tmp;
const char *msg = NULL;
- tmp = xmlNewChild(nic, NULL, BAD_CAST "script", NULL);
- if (tmp == NULL)
- return XML_ERROR;
- xmlNewProp(tmp, BAD_CAST "path", BAD_CAST script);
-
msg = set_net_source(nic, dev, "bridge");
return msg;
--
1.7.1
12 years, 4 months
Re: [Libvirt-cim] [PATCH] distinguish running or inactive state
by Wenchao Xia
Hi, Sharad
How many space should I use for the indentation?
>
> > Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
> > 06/27/12 11:00 PM
> >
> > To
> >
> > libvirt-cim(a)redhat.com
> >
> > cc
> >
> > veillard(a)redhat.com, eblima(a)br.ibm.com, Sharad Mishra/Beaverton/
> > IBM@IBMUS, Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
> >
> > Subject
> >
> > [Libvirt-cim] [PATCH] distinguish running or inactive state
> >
> > In older version of libvirt-cim, it calls libvirt with current vm
> > state. With
> > ACL patch it changed to call libvirt with inactive vm state. This
> will cause
> > libvirt-cim show different behavior about running vm compared to old
> > libvirt-cim. For eg, if vnc port that was defined as automatically
> allocation,
> > after vm power up, user can't get what port is allocated by the
> system. This
> > patch changed this back as a fix, except for FilterList.
> > v2: expose flags in API.
> >
> > Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
> > ---
> > libxkutil/device_parsing.c | 6 +++---
> > libxkutil/device_parsing.h | 4 +++-
> > src/Virt_AppliedFilterList.c | 6 ++++--
> > src/Virt_Device.c | 4 ++--
> > src/Virt_DevicePool.c | 4 ++--
> > src/Virt_RASD.c | 4 ++--
> > 6 files changed, 16 insertions(+), 12 deletions(-)
> >
> > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
> > index f153c5b..5393290 100644
> > --- a/libxkutil/device_parsing.c
> > +++ b/libxkutil/device_parsing.c
> > @@ -997,13 +997,13 @@ static int _get_proc_device(const char *xml,
> > struct virt_device **list)
> > return 1;
> > };
> >
> > -int get_devices(virDomainPtr dom, struct virt_device **list, int type)
> > +int get_devices(virDomainPtr dom, struct virt_device **list, int type,
> > + unsigned int flags)
>
> fix indentation for "unsigned int flags"
>
> > {
> > char *xml;
> > int ret;
> >
> > - xml = virDomainGetXMLDesc(dom,
> > - VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE);
> > + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE | flags);
> > if (xml == NULL)
> > return 0;
> >
> > diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h
> > index b3b75a9..d652f0f 100644
> > --- a/libxkutil/device_parsing.h
> > +++ b/libxkutil/device_parsing.h
> > @@ -203,7 +203,9 @@ int get_dominfo_from_xml(const char *xml, struct
> > domain **dominfo);
> >
> > void cleanup_dominfo(struct domain **dominfo);
> >
> > -int get_devices(virDomainPtr dom, struct virt_device **list, int type);
> > +/* VIR_DOMAIN_XML_SECURE will always be set besides flags */
> > +int get_devices(virDomainPtr dom, struct virt_device **list, int type,
> > + unsigned int flags);
>
> fix indentation
>
> >
> > void cleanup_virt_device(struct virt_device *dev);
> > void cleanup_virt_devices(struct virt_device **devs, int count);
> > diff --git a/src/Virt_AppliedFilterList.c b/src/Virt_AppliedFilterList.c
> > index 0dfe6a3..c59c11f 100644
> > --- a/src/Virt_AppliedFilterList.c
> > +++ b/src/Virt_AppliedFilterList.c
> > @@ -200,7 +200,8 @@ static CMPIStatus list_to_net(
> > for (i = 0; i < dcount; i++) {
> > /* get domain's network devices */
> > struct virt_device *devices = NULL;
> > - ncount = get_devices(doms[i], &devices,
> CIM_RES_TYPE_NET);
> > + ncount = get_devices(doms[i], &devices,
> CIM_RES_TYPE_NET,
> > +
> VIR_DOMAIN_XML_INACTIVE);
>
> fix indentation
>
> >
> > CU_DEBUG("Found %u network devices", ncount);
> >
> > @@ -300,7 +301,8 @@ static CMPIStatus net_to_list(
> >
> > /* get domain's network devices */
> > struct virt_device *devices = NULL;
> > - int count = get_devices(dom, &devices, CIM_RES_TYPE_NET);
> > + int count = get_devices(dom, &devices, CIM_RES_TYPE_NET,
> > +
> VIR_DOMAIN_XML_INACTIVE);
>
> fix indentation
>
> >
> > CU_DEBUG("Found %u net devices on dom '%s'", count,
> domain_name);
> >
> > diff --git a/src/Virt_Device.c b/src/Virt_Device.c
> > index abe3d6f..e047a94 100644
> > --- a/src/Virt_Device.c
> > +++ b/src/Virt_Device.c
> > @@ -529,7 +529,7 @@ static CMPIStatus _get_devices(const CMPIBroker
> *broker,
> > bool rc;
> > struct virt_device *devs = NULL;
> >
> > - count = get_devices(dom, &devs, type);
> > + count = get_devices(dom, &devs, type, 0);
> > if (count <= 0)
> > goto out;
> >
> > @@ -698,7 +698,7 @@ static struct virt_device
> *find_dom_dev(virDomainPtr dom,
> > int count;
> > int i;
> >
> > - count = get_devices(dom, &list, type);
> > + count = get_devices(dom, &list, type, 0);
> > if (!count) {
> > CU_DEBUG("No devices for %i", type);
> > goto out;
> > diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c
> > index def8454..202e509 100644
> > --- a/src/Virt_DevicePool.c
> > +++ b/src/Virt_DevicePool.c
> > @@ -446,7 +446,7 @@ static char *diskpool_member_of(const CMPIBroker
> *broker,
> > if (dom == NULL)
> > goto out;
> >
> > - count = get_devices(dom, &devs, CIM_RES_TYPE_DISK);
> > + count = get_devices(dom, &devs, CIM_RES_TYPE_DISK, 0);
> >
> > for (i = 0; i < count; i++) {
> > if (STREQ((devs[i].dev.disk.virtual_dev), dev)) {
> > @@ -578,7 +578,7 @@ static char *netpool_member_of(const CMPIBroker
> *broker,
> > if (dom == NULL)
> > goto out;
> >
> > - count = get_devices(dom, &devs, CIM_RES_TYPE_NET);
> > + count = get_devices(dom, &devs, CIM_RES_TYPE_NET, 0);
> >
> > for (i = 0; i < count; i++) {
> > if (STREQ((devs[i].id), dev)) {
> > diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
> > index 3ac4cf5..9493077 100644
> > --- a/src/Virt_RASD.c
> > +++ b/src/Virt_RASD.c
> > @@ -81,7 +81,7 @@ int list_rasds(virConnectPtr conn,
> > if (dom == NULL)
> > return 0;
> >
> > - count = get_devices(dom, list, type);
> > + count = get_devices(dom, list, type, 0);
> >
> > virDomainFree(dom);
> >
> > @@ -965,7 +965,7 @@ static CMPIStatus _get_rasds(const CMPIBroker
> *broker,
> > struct virt_device *devs = NULL;
> > const char *host = NULL;
> >
> > - count = get_devices(dom, &devs, type);
> > + count = get_devices(dom, &devs, type, 0);
> > if (count <= 0)
> > goto out;
> >
> > --
> > 1.7.1
> >
> >
>
--
Best Regards
Wenchao Xia
12 years, 4 months
[PATCH] fix spec file for sblim-sfcb and systemctl
by Daniel Veillard
Right now the spec file is completely tied to tog-pegasus,
this should allow the spec file to be compatible with sblim-sfcb
too. This also switches to systemctl which is now used in Fedora.
I would actually like some feedback on the patch if someone
has an environment to test with sblim-sfcb
Also I noted that if I built the package with sblim-sfcb installed
it failed in the make install phase with the following error:
----------------------------------------------------------
/bin/sh /u/veillard/rpms/BUILD/libvirt-cim-0.6.1/install-sh -c -m 644 -t
"/u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim"
./schema/RegisteredProfile.registration
./schema/ElementConformsToProfile.registration
./schema/ReferencedProfile.registration
if [[ sfcb != pegasus ]]; then \
sed -i '/^# --/,/^# --!/d'
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/RegisteredProfile.registration
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/ElementConformsToProfile.registration
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/ReferencedProfile.registration;
\
fi
sed: can't read
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/RegisteredProfile.registration:
No such file or directory
sed: can't read
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/ElementConformsToProfile.registration:
No such file or directory
sed: can't read
.//u/veillard/rpms/BUILDROOT/libvirt-cim-0.6.1-2.fc18.x86_64/usr/share/libvirt-cim/ReferencedProfile.registration:
No such file or directory
make[2]: *** [install-data-local] Error 2
make[2]: Leaving directory `/home/veillard/rpms/BUILD/libvirt-cim-0.6.1'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/veillard/rpms/BUILD/libvirt-cim-0.6.1'
make: *** [install-recursive] Error 1
----------------------------------------------------------
Any idea ?
thanks,
Daniel
--- libvirt-cim.spec 2012-02-10 13:49:31.679905149 +0800
+++ libvirt-cim.spec 2012-03-09 14:41:45.617781910 +0800
@@ -12,7 +12,8 @@
Requires: libxml2 >= 2.6.0
Requires: libvirt >= 0.9.0
Requires: unzip
-Requires: tog-pegasus
+# either tog-pegasus or sblim-sfcb should provide cim-server
+Requires: cim-server
BuildRequires: libcmpiutil >= 0.5.4
BuildRequires: tog-pegasus-devel
BuildRequires: libvirt-devel >= 0.9.0
@@ -85,8 +86,18 @@
%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name}
-/etc/init.d/tog-pegasus condrestart
+if [ "`systemctl is-active tog-pegasus.service`" = "active" ]
+then
+ systemctl restart tog-pegasus.service
+fi
+
+if [ "`systemctl is-active sblim-sfcb.service`" = "active" ]
+then
+ systemctl restart sblim-sfcb.service
+fi
+if [ -x /usr/sbin/cimserver ]
+then
%{_datadir}/%{name}/provider-register.sh -t pegasus \
-n root/virt \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
@@ -102,8 +113,29 @@
%{_datadir}/%{name}/provider-register.sh -t pegasus \
-n root/cimv2\
-r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true
+fi
+if [ -x /usr/sbin/sfcbd ]
+then
+%{_datadir}/%{name}/provider-register.sh -t sfcb \
+ -n root/virt \
+ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -t sfcb \
+ -n root/virt \
+ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -t sfcb \
+ -n root/interop \
+ -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -t sfcb \
+ -n root/PG_InterOp \
+ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} -v >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -t sfcb \
+ -n root/cimv2\
+ -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true
+fi
%preun
+if [ -x /usr/sbin/cimserver ]
+then
%{_datadir}/%{name}/provider-register.sh -d -t pegasus \
-n root/virt \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
@@ -116,6 +148,22 @@
%{_datadir}/%{name}/provider-register.sh -d -t pegasus \
-n root/cimv2 \
-r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true
+fi
+if [ -x /usr/sbin/sfcbd ]
+then
+%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
+ -n root/virt \
+ -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
+ -n root/interop \
+ -r %{INTEROP_REG} -m %{INTEROP_MOF} >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
+ -n root/PG_InterOp \
+ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true
+%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
+ -n root/cimv2 \
+ -r %{CIMV2_REG} -m %{CIMV2_MOF} >/dev/null 2>&1 || true
+fi
%postun -p /sbin/ldconfig
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
12 years, 5 months
[PATCH v2] distinguish running or inactive state
by Wenchao Xia
In older version of libvirt-cim, it calls libvirt with current vm state. With
ACL patch it changed to call libvirt with inactive vm state. This will cause
libvirt-cim show different behavior about running vm compared to old
libvirt-cim. For eg, if vnc port that was defined as automatically allocation,
after vm power up, user can't get what port is allocated by the system. This
patch changed this back as a fix, except for FilterList.
v2: expose flags in API.
Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
libxkutil/device_parsing.c | 6 +++---
libxkutil/device_parsing.h | 4 +++-
src/Virt_AppliedFilterList.c | 6 ++++--
src/Virt_Device.c | 4 ++--
src/Virt_DevicePool.c | 4 ++--
src/Virt_RASD.c | 4 ++--
6 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index f153c5b..5393290 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -997,13 +997,13 @@ static int _get_proc_device(const char *xml, struct virt_device **list)
return 1;
};
-int get_devices(virDomainPtr dom, struct virt_device **list, int type)
+int get_devices(virDomainPtr dom, struct virt_device **list, int type,
+ unsigned int flags)
{
char *xml;
int ret;
- xml = virDomainGetXMLDesc(dom,
- VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE);
+ xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE | flags);
if (xml == NULL)
return 0;
diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h
index b3b75a9..d652f0f 100644
--- a/libxkutil/device_parsing.h
+++ b/libxkutil/device_parsing.h
@@ -203,7 +203,9 @@ int get_dominfo_from_xml(const char *xml, struct domain **dominfo);
void cleanup_dominfo(struct domain **dominfo);
-int get_devices(virDomainPtr dom, struct virt_device **list, int type);
+/* VIR_DOMAIN_XML_SECURE will always be set besides flags */
+int get_devices(virDomainPtr dom, struct virt_device **list, int type,
+ unsigned int flags);
void cleanup_virt_device(struct virt_device *dev);
void cleanup_virt_devices(struct virt_device **devs, int count);
diff --git a/src/Virt_AppliedFilterList.c b/src/Virt_AppliedFilterList.c
index 0dfe6a3..c59c11f 100644
--- a/src/Virt_AppliedFilterList.c
+++ b/src/Virt_AppliedFilterList.c
@@ -200,7 +200,8 @@ static CMPIStatus list_to_net(
for (i = 0; i < dcount; i++) {
/* get domain's network devices */
struct virt_device *devices = NULL;
- ncount = get_devices(doms[i], &devices, CIM_RES_TYPE_NET);
+ ncount = get_devices(doms[i], &devices, CIM_RES_TYPE_NET,
+ VIR_DOMAIN_XML_INACTIVE);
CU_DEBUG("Found %u network devices", ncount);
@@ -300,7 +301,8 @@ static CMPIStatus net_to_list(
/* get domain's network devices */
struct virt_device *devices = NULL;
- int count = get_devices(dom, &devices, CIM_RES_TYPE_NET);
+ int count = get_devices(dom, &devices, CIM_RES_TYPE_NET,
+ VIR_DOMAIN_XML_INACTIVE);
CU_DEBUG("Found %u net devices on dom '%s'", count, domain_name);
diff --git a/src/Virt_Device.c b/src/Virt_Device.c
index abe3d6f..e047a94 100644
--- a/src/Virt_Device.c
+++ b/src/Virt_Device.c
@@ -529,7 +529,7 @@ static CMPIStatus _get_devices(const CMPIBroker *broker,
bool rc;
struct virt_device *devs = NULL;
- count = get_devices(dom, &devs, type);
+ count = get_devices(dom, &devs, type, 0);
if (count <= 0)
goto out;
@@ -698,7 +698,7 @@ static struct virt_device *find_dom_dev(virDomainPtr dom,
int count;
int i;
- count = get_devices(dom, &list, type);
+ count = get_devices(dom, &list, type, 0);
if (!count) {
CU_DEBUG("No devices for %i", type);
goto out;
diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c
index def8454..202e509 100644
--- a/src/Virt_DevicePool.c
+++ b/src/Virt_DevicePool.c
@@ -446,7 +446,7 @@ static char *diskpool_member_of(const CMPIBroker *broker,
if (dom == NULL)
goto out;
- count = get_devices(dom, &devs, CIM_RES_TYPE_DISK);
+ count = get_devices(dom, &devs, CIM_RES_TYPE_DISK, 0);
for (i = 0; i < count; i++) {
if (STREQ((devs[i].dev.disk.virtual_dev), dev)) {
@@ -578,7 +578,7 @@ static char *netpool_member_of(const CMPIBroker *broker,
if (dom == NULL)
goto out;
- count = get_devices(dom, &devs, CIM_RES_TYPE_NET);
+ count = get_devices(dom, &devs, CIM_RES_TYPE_NET, 0);
for (i = 0; i < count; i++) {
if (STREQ((devs[i].id), dev)) {
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index 3ac4cf5..9493077 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -81,7 +81,7 @@ int list_rasds(virConnectPtr conn,
if (dom == NULL)
return 0;
- count = get_devices(dom, list, type);
+ count = get_devices(dom, list, type, 0);
virDomainFree(dom);
@@ -965,7 +965,7 @@ static CMPIStatus _get_rasds(const CMPIBroker *broker,
struct virt_device *devs = NULL;
const char *host = NULL;
- count = get_devices(dom, &devs, type);
+ count = get_devices(dom, &devs, type, 0);
if (count <= 0)
goto out;
--
1.7.1
12 years, 5 months
[PATCH v3 0/2] [WIP] Make Shutdown and Reboot state changes jobs
by Eduardo Lima (Etrunko)
From: "Eduardo Lima (Etrunko)" <eblima(a)br.ibm.com>
This code is based on the VSMigrationService for the job creation and on
ComputerSystemIndication for the job thread, which will listen for the
respective domain event to mark the job as finished.
Good news here is that the 'Error 100' problem does not happen anymore. I found
it to be an issue with SELinux. By disabling it, that error code will never
happen again.
Now the problem is a random crash happening on the state_change thread, whenever
calls to set properties on the job instance are placed. Looks very likely to be
an issue on the tog-pegasus side, unless I am doing something very wrong in this
case. Would be nice to have some advice from tog-pegasus experts. :)
Differences from v2:
- Back again with the first set of patches, removing the intermediate patch to
deal specifically with shutdown.
- Improve some log messages.
- More detailed states of the job instance (NEW, STARTING, RUNNING, COMPLETED,
EXCEPTION, etc).
- Move event loop registration outside the state_change thread.
- Better error handling on the state_change thread.
Differences from v1:
- Fix conditional causing Reqstate not being set
- Fix domain event id for shutdown
- Now instead of using the domain events for both shutdown and reboot, there is
an intermediate patch, that will deal with the shutdown case by polling for
the domain state until it reflects the desired state.
This workaround won't work for the reboot case, because is is not possible to
monitor the reboot event if not using the domain event callbacks. The third
patch of the series contains the complete solution for both cases.
Eduardo Lima (Etrunko) (2):
VSMigrationService: Move job state definitions to svpc_types.h
ComputerSystem: Reboot/Shutdown state changes as jobs
schema/ComputerSystem.mof | 9 ++
src/Virt_ComputerSystem.c | 326 +++++++++++++++++++++++++++++++++++++++--
src/Virt_VSMigrationService.c | 14 +-
src/svpc_types.h | 13 ++
4 files changed, 343 insertions(+), 19 deletions(-)
--
1.7.10.4
12 years, 5 months
test if mail list is alive
by Wayne Xia
Need to send a patch, have a test, pls ignore
--
Best Regards
Wayne Xia
mail:xiawenc@linux.vnet.ibm.com
tel:86-010-82450803
12 years, 5 months
regarding configuration to be used to create a VM
by Raghunatha Reddy P (raghunp)
Hi All,
We are interested to create/delete/update a VM using libvirt-CIM. Could you please help us to understand what is the standard/common format to be used as input for the libvirt-cim to create a VIM? Can we use OVF to create a VM? If so, are there any libraries which can convert OVF file to libvirt understandable xml format and vice versa?
Thanks in advance for your help.
Best Regards
Raghu
12 years, 5 months