Libvirt Version: 0.9.8 Hi: I added a new api for qemu_driver. and both added libvirt.c and remote. I tested it and it worked well. the function of this new api was add a new field in xml config of domain. (I added it like qemudDomainSetMemoryFlags)at the same time, I added a new member to struct virDomainDef. then I tested xml config converted to virDomaindef and virDomainDef converted to xml config both well(just tested this new api). But there was a problem, if I change the memory size or cpu number then apply it with virtManager. the xml config was changed. but there is no field in the xml what I added. I guest the virDomainDef member in virDomainObjPtr wasn't update. I have no idea, can you give me some ideas? thanks! here is my code in qemu_driver.c: static int qemudDomainSetCustomOptions(virDomainPtr dom, char *opt) { struct qemud_driver *driver = dom->conn->privateData; virDomainObjPtr vm; virDomainDefPtr persistentDef = NULL; int ret = -1; qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); qemuDriverUnlock(driver); if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); qemuReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; if (!vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); goto endjob; } if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm))) goto endjob; sa_assert(persistentDef); persistentDef->running_mode = opt; ret = virDomainSaveConfig(driver->configDir, persistentDef); ret = 0; endjob: if (qemuDomainObjEndJob(driver, vm) == 0) vm = NULL; cleanup: if (vm) virDomainObjUnlock(vm); return ret; } xuanmao_001 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120620/8f9cccae/attachment.htm>
[dropping libvirt-users-owner; list traffic should not be cc'd to the list admin interface] On 06/20/2012 07:09 AM, xuanmao_001 wrote:> Libvirt Version: 0.9.8 > > Hi: > I added a new api for qemu_driver. and both added libvirt.c and remote.Would you mind posting this new API, rebased against the latest git (which is currently building towards 0.9.13), to libvir-list at redhat.com, as others might find this addition useful? libvirt-users is not really the right list to discuss patches, so much as it is for general usage questions.> I tested it and it worked well. the function of this new api was add a new field in xml config of domain. (I added it like qemudDomainSetMemoryFlags)at the same time, I added a new member to struct virDomainDef. then I tested xml config converted to virDomaindef and virDomainDef converted to xml config both well(just tested this new api). But there was a problem, if I change the memory size or cpu number then apply it with virtManager. the xml config was changed. but there is no field in the xml what I added. I guest the virDomainDef member in virDomainObjPtr wasn't update.Without posting your entire patch, it's hard to say what you had missing. Also, remember that libvirt promises ABI stability; adding new XML to backports such as an 0.9.8 release fork is okay, but adding new API bumps the .so version, and therefore should only be done on the latest git sources rather than against an old release tarball.> > static int qemudDomainSetCustomOptions(virDomainPtr dom, char *opt)Just going by the name of this function, it sounds like libvirt already supports the ability to add custom options; have you taken a look at: http://libvirt.org/drvqemu.html#qemucommand for use of the <qemu:commandline> XML? Also, what _particular_ custom option are you adding? If it is generically useful, libvirt should support this natively rather than requiring people to go through a custom option. -- Eric Blake eblake at redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 620 bytes Desc: OpenPGP digital signature URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120620/622b0834/attachment.sig>
Maybe Matching Threads
- [PATCH 1/2] libvirt/qemu : allow persistent modification of disks via A(De)ttachDeviceFlags
- [PATCHv11 0/6] libvirt/qemu - persistent modification of devices
- [PATCH 2/2] libvirt: read secrets of disks (RHBZ#1392798)
- Bug#666135: [PATCH] xen-xs: fix uuid of renamed domain
- Re: Fail in virDomainUpdateDeviceFlags (libvirt-4.0.0 + Qemu-kvm 2.9.0 + Ceph 10.2.10)