From raghunp at cisco.com Mon Jul 9 06:11:12 2012 From: raghunp at cisco.com (Raghunatha Reddy P (raghunp)) Date: Mon, 9 Jul 2012 06:11:12 +0000 Subject: [Libvirt-cim] regarding configuration to be used to create a VM Message-ID: 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From xiaxia347work at 163.com Mon Jul 9 06:34:08 2012 From: xiaxia347work at 163.com (xiaxia347work) Date: Mon, 9 Jul 2012 14:34:08 +0800 Subject: [Libvirt-cim] regarding configuration to be used to create a VM In-Reply-To: References: Message-ID: <47b71a3.49c6.1386a721989.Coremail.xiaxia347work@163.com> libvirt-cim is used as a bridge to convert standard CIM model call to libvirt functions, here is a example to make a call to create a VM. You can modify it with your resource settings(such as image place,name), save it to a xml file, and using "wbemexec" tool to give a try, such as wbemexec create_vm.xml. Not sure if there is a lib converting OVF files. KVM_VirtualSystemManagementService Management Service KVM_HostSystem RedHat62GAWSWenchao instance of KVM_VirtualSystemSettingData { VirtualSystemIdentifier ="test_created_vm"; }; instance of KVM_DiskResourceAllocationSettingData { VirtualDevice = "hda"; Address = "/var/lib/libvirt/images/test_created_vm.img"; EmulatedType = 0; BusType = "ide"; DriverName = "qemu"; DriverType = "qcow2"; DriverCache = "none"; }; instance of KVM_DiskResourceAllocationSettingData { VirtualDevice = "hdb"; Address = "/var/lib/libvirt/images/test_created_vm_raw.img"; EmulatedType = 0; BusType = "ide"; DriverName = "qemu"; DriverType = "raw"; DriverCache = "none"; }; instance of KVM_ProcResourceAllocationSettingData { VirtualQuantity = 1; }; ------------------ Best Regards Wenchao Xia 2012-07-09 ------------------------------------------------------------- ????"Raghunatha Reddy P (raghunp)" ?????2012-07-09 14:11 ????libvirt-cim at redhat.com ??? ???[Libvirt-cim] regarding configuration to be used to create a VM 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 _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim From xiawenc at linux.vnet.ibm.com Tue Jul 10 05:49:35 2012 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Tue, 10 Jul 2012 13:49:35 +0800 Subject: [Libvirt-cim] libvirt-cim bug fix patch issue In-Reply-To: <20120628141549.GB2733@redhat.com> References: <4FEA69F6.4040501@linux.vnet.ibm.com> <20120628141549.GB2733@redhat.com> Message-ID: <4FFBC26F.6070806@linux.vnet.ibm.com> Hi, Daniel There was a bug fix patch for libvirt-cim about reporting active/inactive state. Could u take a look about it to see if it can be merged? then I can send the fix as an upstream code package Many thanks. -- Best Regards Wenchao Xia From veillard at redhat.com Tue Jul 10 05:56:02 2012 From: veillard at redhat.com (Daniel Veillard) Date: Tue, 10 Jul 2012 13:56:02 +0800 Subject: [Libvirt-cim] [PATCH 1/2] VSMigrationService: Move job state definitions to svpc_types.h In-Reply-To: <1340823482-17151-2-git-send-email-eblima@linux.vnet.ibm.com> References: <1340823482-17151-1-git-send-email-eblima@linux.vnet.ibm.com> <1340823482-17151-2-git-send-email-eblima@linux.vnet.ibm.com> Message-ID: <20120710055602.GM20445@redhat.com> On Wed, Jun 27, 2012 at 03:58:01PM -0300, Eduardo Lima (Etrunko) wrote: > From: "Eduardo Lima (Etrunko)" > > Further job implementations may reuse these values. > > Signed-off-by: Eduardo Lima (Etrunko) > --- > src/Virt_VSMigrationService.c | 14 +++++--------- > src/svpc_types.h | 13 +++++++++++++ > 2 files changed, 18 insertions(+), 9 deletions(-) > > diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c > index 76e3d25..a6b5fc0 100644 > --- a/src/Virt_VSMigrationService.c > +++ b/src/Virt_VSMigrationService.c > @@ -52,10 +52,6 @@ > > #include "config.h" > > -#define CIM_JOBSTATE_STARTING 3 > -#define CIM_JOBSTATE_RUNNING 4 > -#define CIM_JOBSTATE_COMPLETE 7 > - > #define MIGRATE_SHUTDOWN_TIMEOUT 120 > > #define METHOD_RETURN(r, v) do { \ > @@ -1289,19 +1285,19 @@ static CMPI_THREAD_RETURN migration_thread(struct migration_job *job) > CBAttachThread(_BROKER, job->context); > > CU_DEBUG("Migration Job %s started", job->uuid); > - migrate_job_set_state(job, CIM_JOBSTATE_RUNNING, 0, "Running"); > + migrate_job_set_state(job, CIM_JOB_STATE_RUNNING, 0, "Running"); > > s = migrate_vs(job); > > CU_DEBUG("Migration Job %s finished: %i", job->uuid, s.rc); > if (s.rc != CMPI_RC_OK) > migrate_job_set_state(job, > - CIM_JOBSTATE_COMPLETE, > + CIM_JOB_STATE_COMPLETED, > s.rc, > CMGetCharPtr(s.msg)); > else > migrate_job_set_state(job, > - CIM_JOBSTATE_COMPLETE, > + CIM_JOB_STATE_COMPLETED, > 0, > "Completed"); > > @@ -1361,7 +1357,7 @@ static CMPIInstance *_migrate_job_new_instance(const char *cn, > } > > inst = CMNewInstance(_BROKER, op, &s); > - if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(op))) { > + if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(inst))) { > CU_DEBUG("Failed to create instance from ref: %s", > CMGetCharPtr(CMObjectPathToString(op, NULL))); > return NULL; > @@ -1378,7 +1374,7 @@ static CMPIStatus migrate_create_job_instance(const CMPIContext *context, > CMPIInstance *jobinst; > CMPIDateTime *start; > CMPIBoolean autodelete = true; > - uint16_t state = CIM_JOBSTATE_STARTING; > + uint16_t state = CIM_JOB_STATE_STARTING; > char *type = NULL; > > start = CMNewDateTime(_BROKER, &s); > diff --git a/src/svpc_types.h b/src/svpc_types.h > index 90bb608..338a7ef 100644 > --- a/src/svpc_types.h > +++ b/src/svpc_types.h > @@ -167,5 +167,18 @@ enum CIM_op_status { > CIM_OP_STATUS_POWER_MODE = 18, > }; > > +enum CIM_job_state { > + CIM_JOB_STATE_NEW = 2, > + CIM_JOB_STATE_STARTING, > + CIM_JOB_STATE_RUNNING, > + CIM_JOB_STATE_SUSPENDED, > + CIM_JOB_STATE_SHUTTING_DOWN, > + CIM_JOB_STATE_COMPLETED, > + CIM_JOB_STATE_TERMINATED, > + CIM_JOB_STATE_KILLED, > + CIM_JOB_STATE_EXCEPTION, > + CIM_JOB_STATE_SERVICE, > + CIM_JOB_STATE_QUERY_PENDING, > +}; Okay, that looks fairly safe as the values for the enums are preserved. i would just suggest to explicitely set the values instead of relying on C for propagating the right value: + CIM_JOB_STATE_STARTING = 3, + CIM_JOB_STATE_RUNNING = 4, + CIM_JOB_STATE_SUSPENDED = 5, + CIM_JOB_STATE_SHUTTING_DOWN = 6, + CIM_JOB_STATE_COMPLETED = 7, + CIM_JOB_STATE_TERMINATED = 8, + CIM_JOB_STATE_KILLED = 9, + CIM_JOB_STATE_EXCEPTION = 10, + CIM_JOB_STATE_SERVICE = 11, + CIM_JOB_STATE_QUERY_PENDING = 12, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Tue Jul 10 06:02:09 2012 From: veillard at redhat.com (Daniel Veillard) Date: Tue, 10 Jul 2012 14:02:09 +0800 Subject: [Libvirt-cim] [PATCH 2/2] ComputerSystem: Reboot/Shutdown state changes as jobs In-Reply-To: <1340823482-17151-3-git-send-email-eblima@linux.vnet.ibm.com> References: <1340823482-17151-1-git-send-email-eblima@linux.vnet.ibm.com> <1340823482-17151-3-git-send-email-eblima@linux.vnet.ibm.com> Message-ID: <20120710060209.GN20445@redhat.com> On Wed, Jun 27, 2012 at 03:58:02PM -0300, Eduardo Lima (Etrunko) wrote: > From: "Eduardo Lima (Etrunko)" > > For Reboot and Shutdown, th RequestStateChange method returns immediately with typo th -> the > return code 0 (successful) even though the state change is still not completed. > > According to the DMTF specification DSP1052 (Computer System Profile) the > RequestStateChange() method should return 0x1000 and a corresponding job > reference in the return parameters which can be polled for completion. > > Signed-off-by: Eduardo Lima (Etrunko) > --- > schema/ComputerSystem.mof | 9 ++ > src/Virt_ComputerSystem.c | 326 +++++++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 325 insertions(+), 10 deletions(-) > > diff --git a/schema/ComputerSystem.mof b/schema/ComputerSystem.mof > index 10cb8c4..886c085 100644 > --- a/schema/ComputerSystem.mof > +++ b/schema/ComputerSystem.mof > @@ -1,5 +1,14 @@ > // Copyright IBM Corp. 2007 > > +class Xen_ComputerSystemStateChangeJob : CIM_ConcreteJob { > +}; > + > +class KVM_ComputerSystemStateChangeJob : CIM_ConcreteJob { > +}; > + > +class LXC_ComputerSystemStateChangeJob : CIM_ConcreteJob { > +}; > + > [Description ( > "A class derived from CIM_ComputerSystem to represent " > "the Xen virtual machines/domains running on the system."), > diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c > index e6c7e55..9546da2 100644 > --- a/src/Virt_ComputerSystem.c > +++ b/src/Virt_ComputerSystem.c > @@ -30,23 +30,40 @@ > #include > #include > > +#include > #include > +#include > > -#include "cs_util.h" > #include > -#include "misc_util.h" > -#include "infostore.h" > -#include "device_parsing.h" > #include > #include > #include > > +#include "cs_util.h" > +#include "misc_util.h" > +#include "infostore.h" > +#include "device_parsing.h" > +#include "svpc_types.h" > + > #include "Virt_ComputerSystem.h" > #include "Virt_HostSystem.h" > #include "Virt_VirtualSystemSnapshotService.h" > > const static CMPIBroker *_BROKER; > > +typedef struct _state_change_job state_change_job_t; > +struct _state_change_job { > + char uuid[VIR_UUID_STRING_BUFLEN]; > + CMPIContext *context; > + CMPIObjectPath *obj_path; > + CMPIInstance *inst; > + char *dom_name; > + uint16_t dom_state; > + uint16_t status; /* job status */ > +}; > + > +static bool events_registered = false; > + > /* Set the "Name" property of an instance from a domain */ > static int set_name_from_dom(virDomainPtr dom, CMPIInstance *instance) > { > @@ -1189,19 +1206,20 @@ static CMPIStatus __state_change(const char *name, > s = state_change_enable(dom, &info); > else if (state == CIM_STATE_DISABLED) > s = state_change_disable(dom, &info); > - else if (state == CIM_STATE_SHUTDOWN) > - s = state_change_shutdown(dom, &info); > else if (state == CIM_STATE_PAUSED) > s = state_change_pause(dom, &info); > - else if (state == CIM_STATE_REBOOT) > - s = state_change_reboot(dom, &info); > else if (state == CIM_STATE_RESET) > s = state_change_reset(dom, &info); > + else if (state == CIM_STATE_SHUTDOWN || state == CIM_STATE_REBOOT) > + s.rc = CIM_SVPC_RETURN_JOB_STARTED; > else > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_NOT_SUPPORTED, > "State not supported"); > > + if (s.rc != CMPI_RC_OK && s.rc != CIM_SVPC_RETURN_JOB_STARTED) > + goto out; > + > infostore = infostore_open(dom); > if (infostore != NULL) { > infostore_set_u64(infostore, "reqstate", (uint64_t)state); > @@ -1215,6 +1233,265 @@ static CMPIStatus __state_change(const char *name, > return s; > } > > +static CMPIStatus create_state_change_job(const CMPIObjectPath *ref, > + const CMPIContext *context, > + state_change_job_t **job, > + uint16_t state) > +{ > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + CMPIInstance *job_inst; > + CMPIDateTime *start; > + CMPIBoolean autodelete = true; > + CMPIObjectPath *obj_path; > + uuid_t uuid; > + char *type = NULL, *cn = NULL, *ns = NULL; > + > + start = CMNewDateTime(_BROKER, &s); > + if ((s.rc != CMPI_RC_OK) || CMIsNullObject(start)) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to get job start time"); > + goto out; > + } > + > + cn = strdup(CLASSNAME(ref)); > + type = get_typed_class(cn, "ComputerSystemStateChangeJob"); > + > + obj_path = CMNewObjectPath(_BROKER, ns, type, &s); > + if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(obj_path))) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to get new object path"); > + goto out; > + } > + > + job_inst = CMNewInstance(_BROKER, obj_path, &s); > + if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(job_inst))) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to get new instance object"); > + goto out; > + } > + > + /* Alloc job struct */ > + *job = calloc(1, sizeof(**job)); > + if (*job == NULL) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to allocate memory for job structure"); > + goto out; > + } > + > + (*job)->dom_state = state; > + (*job)->status = CIM_JOB_STATE_NEW; > + > + uuid_generate(uuid); > + uuid_unparse(uuid, (*job)->uuid); > + > + /* Set Properties */ > + CMSetProperty(job_inst, "InstanceID", > + (CMPIValue *) (*job)->uuid, CMPI_chars); > + CMSetProperty(job_inst, "Name", > + (CMPIValue *) "ComputerSystemStateChange", CMPI_chars); > + CMSetProperty(job_inst, "StartTime", > + (CMPIValue *) &start, CMPI_dateTime); > + CMSetProperty(job_inst, "JobState", > + (CMPIValue *) &((*job)->status), CMPI_uint16); > + CMSetProperty(job_inst, "Status", > + (CMPIValue *) "New", CMPI_chars); > + CMSetProperty(job_inst, "DeleteOnCompletion", > + (CMPIValue *)&autodelete, CMPI_boolean); > + > + obj_path = CMGetObjectPath(job_inst, &s); > + if ((obj_path == NULL) || (s.rc != CMPI_RC_OK)) { > + cu_statusf(_BROKER, &s, > + CMPI_RC_ERR_FAILED, > + "Failed to get path for ComputerSystemStateChangeJob instance"); > + goto out; > + } > + > + CMSetNameSpace(obj_path, ns); > + > + CU_DEBUG("Creating ComputerSystemStateChangeJob instance: %s", > + CMGetCharPtr(CMObjectPathToString(obj_path, NULL))); > + > + obj_path = CBCreateInstance(_BROKER, context, obj_path, job_inst, &s); > + if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(obj_path))) { > + CU_DEBUG("Failed to create ComputerSystemStateChangeJob instance: %i", s.rc); > + goto out; > + } > + > + ns = strdup(NAMESPACE(ref)); > + CMSetNameSpace(obj_path, ns); > + > + (*job)->obj_path = obj_path; > + (*job)->context = CBPrepareAttachThread(_BROKER, context); > + if ((*job)->context == NULL) { > + CU_DEBUG("Failed to create thread context"); > + cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, > + "Unable to create thread context"); > + goto out; > + } > + > + (*job)->inst = CBGetInstance(_BROKER, (*job)->context, (*job)->obj_path, NULL, &s); > + if (((*job)->inst == NULL) || (s.rc != CMPI_RC_OK)) { > + CU_DEBUG("Failed to get job instance (%i)", s.rc); > + goto out; > + } > + > + out: > + free(type); > + free(cn); > + free(ns); Hum, we rely here on "free(NULL)' to do the right thing, but that's okay for all recent implementations :-) > + return s; > +} > + > +static void state_change_reboot_cb(virConnectPtr conn, > + virDomainPtr dom, > + void *data) > +{ > + state_change_job_t *job = (state_change_job_t *) data; > + job->status = CIM_JOB_STATE_COMPLETED; > + CU_DEBUG("state_change_reboot_cb(): Reboot complete"); > +} > + > +static void state_change_shutdown_cb(virConnectPtr conn, > + virDomainPtr dom, > + int event, > + int detail, > + void *data) > +{ > + state_change_job_t *job = (state_change_job_t *) data; > + if (event == VIR_DOMAIN_EVENT_SHUTDOWN) { > + job->status = CIM_JOB_STATE_COMPLETED; > + CU_DEBUG("state_change_shutdown_cb(): Shutdown complete"); > + } > +} > + > +static CMPI_THREAD_RETURN state_change_thread(void *data) > +{ > + CMPIStatus s; > + state_change_job_t *job = (state_change_job_t *) data; > + virConnectPtr conn = NULL; > + virDomainPtr dom = NULL; > + virDomainInfo info; > + int job_cb = -1; > + > + /* Set job state */ > + CBAttachThread(_BROKER, job->context); > + CU_DEBUG("State change job %s started", job->uuid); > + > + job->status = CIM_JOB_STATE_STARTING; > + CMSetProperty(job->inst, "JobState", > + (CMPIValue *) &(job->status), CMPI_uint16); > + CMSetProperty(job->inst, "Status", > + (CMPIValue *) "Starting", CMPI_chars); > + > + /* Connect to domain event callback */ > + conn = connect_by_classname(_BROKER, CLASSNAME(job->obj_path), &s); > + if (conn == NULL) { > + CU_DEBUG("Unable to connect to '%s' hypervisor", > + CLASSNAME(job->obj_path)); > + goto err; > + } > + > + dom = virDomainLookupByName(conn, job->dom_name); > + if (dom == NULL) { > + CU_DEBUG("Unable to get domain '%s'", job->dom_name); > + goto err; > + } > + > + if (virDomainGetInfo(dom, &info) != 0) { > + CU_DEBUG("Unable to get domain info for '%s'", job->dom_name); > + goto err; > + } > + > + if (job->dom_state == CIM_STATE_REBOOT) { > + job_cb = virConnectDomainEventRegisterAny(conn, NULL, > + VIR_DOMAIN_EVENT_ID_REBOOT, > + VIR_DOMAIN_EVENT_CALLBACK(state_change_reboot_cb), > + job, NULL); > + > + if (job_cb == -1) { > + CU_DEBUG("Unable to connect domain reboot callback"); > + goto err; > + } > + > + s = state_change_reboot(dom, &info); > + > + if (s.rc != CMPI_RC_OK) { > + CU_DEBUG("Unable to trigger domain reboot: '%s'", > + CMGetCharPtr(s.msg)); > + goto err; > + } > + } else if (job->dom_state == CIM_STATE_SHUTDOWN) { > + job_cb = virConnectDomainEventRegisterAny(conn, NULL, > + VIR_DOMAIN_EVENT_ID_LIFECYCLE, > + VIR_DOMAIN_EVENT_CALLBACK(state_change_shutdown_cb), > + job, NULL); > + > + if (job_cb == -1) { > + CU_DEBUG("Unable to connect domain shutdown callback"); > + goto err; > + } > + > + s = state_change_shutdown(dom, &info); > + > + if (s.rc != CMPI_RC_OK) { > + CU_DEBUG("Unable to trigger domain shutdown: '%s'", > + CMGetCharPtr(s.msg)); > + goto err; > + } > + } else { > + CU_DEBUG("Unrecognized state '%d'", job->dom_state); > + goto err; > + } > + > + job->status = CIM_JOB_STATE_RUNNING; > + CMSetProperty(job->inst, "JobState", > + (CMPIValue *) &(job->status), CMPI_uint16); > + CMSetProperty(job->inst, "Status", > + (CMPIValue *) "Running", CMPI_chars); > + > + CU_DEBUG("Entering mainloop implementation"); > + /* Wait for operation (shutdown/reboot) to complete */ > + while (job->status == CIM_JOB_STATE_RUNNING) { > + if (virEventRunDefaultImpl() < 0) { > + virErrorPtr err = virGetLastError(); > + CU_DEBUG("Failed to run event loop: %s\n", > + err && err->message ? err->message : "Unknown error"); > + goto err; > + } > + } > + > + CU_DEBUG("Job completed"); > + CMSetProperty(job->inst, "JobState", > + (CMPIValue *) &(job->status), CMPI_uint16); > + CMSetProperty(job->inst, "Status", > + (CMPIValue *) "Completed", CMPI_chars); > + > + goto out; > + > + err: > + job->status = CIM_JOB_STATE_EXCEPTION; > + CMSetProperty(job->inst, "JobState", > + (CMPIValue *) &(job->status), CMPI_uint16); > + CMSetProperty(job->inst, "Status", > + (CMPIValue *) "Error", CMPI_chars); > + > + out: > + if (job_cb != -1) > + virConnectDomainEventDeregisterAny(conn, job_cb); > + > + virDomainFree(dom); > + virConnectClose(conn); > + > + CBDetachThread(_BROKER, job->context); > + free(job->dom_name); > + free(job); > + return NULL; > +} > + > static CMPIStatus state_change(CMPIMethodMI *self, > const CMPIContext *context, > const CMPIResult *results, > @@ -1244,7 +1521,8 @@ static CMPIStatus state_change(CMPIMethodMI *self, > goto out; > } > > - /* Retain original instance of the guest to use for the PreviousInstance attribute when generating an indication. */ > + /* Retain original instance of the guest to use for the PreviousInstance > + attribute when generating an indication. */ > s = get_domain_by_name(_BROKER, reference, name, &prev_inst); > if (s.rc != CMPI_RC_OK || prev_inst == NULL) { > cu_statusf(_BROKER, &s, > @@ -1256,8 +1534,36 @@ static CMPIStatus state_change(CMPIMethodMI *self, > > s = __state_change(name, state, reference); > > + rc = s.rc; > + > if (s.rc == CMPI_RC_OK) > - rc = 0; > + goto out; > + > + if (s.rc == CIM_SVPC_RETURN_JOB_STARTED) { > + state_change_job_t *job = NULL; > + > + if (events_registered == false) { > + events_registered = true; > + if (virEventRegisterDefaultImpl() != 0) { > + CU_DEBUG("virEventRegisterDefaultImpl() failed"); > + goto out; > + } > + } > + > + s = create_state_change_job(reference, context, &job, state); > + if (s.rc != CMPI_RC_OK) { > + rc = s.rc; > + free(job); > + goto out; > + } > + > + job->dom_name = strdup(name); > + > + _BROKER->xft->newThread(state_change_thread, job, 0); > + > + CMAddArg(argsout, "Job", (CMPIValue *)&(job->obj_path), > + CMPI_ref); > + } > > out: > CMReturnData(results, &rc, CMPI_uint32); Okay, fairly complex but that's DMTF style :-) What i don't see is how/where the object associated to the job are freed is there some generic mechanism handling all of this, or are we missing some kind of routine which would be called asynchronously to free the data associated to the job ? I don't know, if you're sure that everything is deallocated then fine, ACK :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Tue Jul 10 06:05:19 2012 From: veillard at redhat.com (Daniel Veillard) Date: Tue, 10 Jul 2012 14:05:19 +0800 Subject: [Libvirt-cim] [PATCH v2] distinguish running or inactive state In-Reply-To: <1340866524-3639-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1340866524-3639-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <20120710060518.GO20445@redhat.com> On Thu, Jun 28, 2012 at 02:55:24PM +0800, Wenchao Xia wrote: > 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 Okay, you followed Eduardo's sugegstion, looks fine to me too, ACK and pushed, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Tue Jul 10 06:37:06 2012 From: veillard at redhat.com (Daniel Veillard) Date: Tue, 10 Jul 2012 14:37:06 +0800 Subject: [Libvirt-cim] [PATCH] fix spec file for sblim-sfcb and systemctl In-Reply-To: <20120309083258.GA5592@heron.suse.de> References: <20120309071110.GV19825@redhat.com> <20120309083258.GA5592@heron.suse.de> Message-ID: <20120710063706.GQ20445@redhat.com> On Fri, Mar 09, 2012 at 09:32:58AM +0100, Klaus Kaempf wrote: > Daniel, > > thanks for the patch. > > * Daniel Veillard [Mar 09. 2012 08:12]: > > 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 > > I'll test later today. > For reference, you might want to take a look at the spec file of > https://build.opensuse.org/package/files?package=libvirt-cim&project=systemsmanagement%3Awbem > which is a pure-sfcb variant. > > > > > Also I noted that if I built the package with sblim-sfcb installed > > it failed in the make install phase with the following error: > > Thats a bug in the Makefile.am which does an incomplete substitution - > patch attached. > > Regards, > > Klaus > --- > SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer, HRB 16746 (AG N?rnberg) > Maxfeldstra?e 5, 90409 N?rnberg, Germany > diff -wruN -x '*~' ../orig-libvirt-cim-0.6.1/Makefile.am ./Makefile.am > --- ../orig-libvirt-cim-0.6.1/Makefile.am 2012-02-08 14:23:43.000000000 +0100 > +++ ./Makefile.am 2012-02-09 16:45:16.000000000 +0100 > @@ -189,7 +189,7 @@ > $(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_MOFS) > $(install_sh_DATA) -t "$(DESTDIR)$(pkgdatadir)" $(INTEROP_REGS) > if [[ @CIMSERVER@ != pegasus ]]; then \ > - sed -i '/^# --/,/^# --!/d' $(subst schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \ > + sed -i '/^# --/,/^# --!/d' $(subst ./schema,$(DESTDIR)$(pkgdatadir), $(PGINTEROP_REGS)); \ > fi > > uninstall-local: Okay, I also pushed Klaus' patch today, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From xiawenc at linux.vnet.ibm.com Mon Jul 16 10:37:10 2012 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 16 Jul 2012 18:37:10 +0800 Subject: [Libvirt-cim] [PATCH] remove script for bridge network Message-ID: <1342435030-7541-1-git-send-email-xiawenc@linux.vnet.ibm.com> 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 --- 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 From xiawenc at linux.vnet.ibm.com Wed Jul 25 06:43:00 2012 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Wed, 25 Jul 2012 14:43:00 +0800 Subject: [Libvirt-cim] [PATCH] distinguish running or inactive state In-Reply-To: References: <1340863227-23890-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <500F9574.7000301@linux.vnet.ibm.com> Hi, Sharad How many space should I use for the indentation? > > > Wenchao Xia > > 06/27/12 11:00 PM > > > > To > > > > libvirt-cim at redhat.com > > > > cc > > > > veillard at redhat.com, eblima at br.ibm.com, Sharad Mishra/Beaverton/ > > IBM at IBMUS, Wenchao Xia > > > > 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 > > --- > > 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 From xiawenc at linux.vnet.ibm.com Thu Jul 26 05:08:52 2012 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Thu, 26 Jul 2012 13:08:52 +0800 Subject: [Libvirt-cim] [libvirt-cim] [PATCH] remove script for bridge network In-Reply-To: <1342435030-7541-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1342435030-7541-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <5010D0E4.2060607@linux.vnet.ibm.com> Hi, Danial This is a urgent fix for bug in new release, could u help look at it? > 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 > --- > 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; > -- Best Regards Wenchao Xia From snmishra at linux.vnet.ibm.com Thu Jul 26 16:01:37 2012 From: snmishra at linux.vnet.ibm.com (snmishra at linux.vnet.ibm.com) Date: Thu, 26 Jul 2012 09:01:37 -0700 Subject: [Libvirt-cim] [libvirt-cim] [PATCH] remove script for bridge network In-Reply-To: <5010D0E4.2060607@linux.vnet.ibm.com> References: <1342435030-7541-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5010D0E4.2060607@linux.vnet.ibm.com> Message-ID: <20120726090137.Horde.RbYi85ir309QEWnhnr8ElRA@imap.linux.ibm.com> Quoting Wenchao Xia : > Hi, Danial > This is a urgent fix for bug in new release, could u help look at it? > >> 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 >> --- >> 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; There is nothing much left in this function after removing those lines. So, do you still need this funcion or can the remaining code be moved some other place? Also, please make sure that removing "vif-bridge" does not break any other code path. -Sharad Mishra >> > > > -- > Best Regards > > Wenchao Xia > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From xiawenc at linux.vnet.ibm.com Fri Jul 27 02:26:55 2012 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Fri, 27 Jul 2012 10:26:55 +0800 Subject: [Libvirt-cim] [libvirt-cim] [PATCH] remove script for bridge network In-Reply-To: <20120726090137.Horde.RbYi85ir309QEWnhnr8ElRA@imap.linux.ibm.com> References: <1342435030-7541-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5010D0E4.2060607@linux.vnet.ibm.com> <20120726090137.Horde.RbYi85ir309QEWnhnr8ElRA@imap.linux.ibm.com> Message-ID: <5011FC6F.1030402@linux.vnet.ibm.com> ? 2012-7-27 0:01, snmishra at linux.vnet.ibm.com ??: > Quoting Wenchao Xia : > >> Hi, Danial >> This is a urgent fix for bug in new release, could u help look at it? >> >>> 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 >>> --- >>> 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; > > There is nothing much left in this function after removing those lines. > So, do you still need this funcion or can the remaining code be moved > some other place? > It is right to remove the function, but for that this is a bug fix patch I think we could keep the change minimal for now. > Also, please make sure that removing "vif-bridge" does not break any > other code path. Searched the code and don't other one called this function except in VM define, so I think it is OK to removed. I am not sure why this section was added before, I guess it was dong according libvirt document which shows vif-bridge as an example. > > -Sharad Mishra >>> >> >> >> -- >> Best Regards >> >> Wenchao Xia >> >> _______________________________________________ >> Libvirt-cim mailing list >> Libvirt-cim at redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia