vmngr / libvirt-old

Libvirt bindings for Node.js®
https://vmngr.com/
MIT License
11 stars 7 forks source link

➕ Added domain descriptions and XML helper functions #3

Closed leonrinkel closed 4 years ago

leonrinkel commented 4 years ago

Hi @libvirtadept, I've created a PR for us to look at what I've came up with regarding your issue #2. I wanted to keep the description interfaces as close as possible to the Libvirt XML schemas, so that the official documentation on the schemas also applies to the interfaces. Also this makes it pretty easy and straightforward for people who are already familiar with the XML schemas. The interfaces etc. are not yet complete though.

The following snippet basically sums up what I intended. The resulting XML can then be used for Hypervisor.domainCreate / .domainDefine. https://github.com/vmngr/libvirt/blob/5878a586785b43913f57318db1291f94a8bcd97d/examples/builder.ts#L43-L66

libvirtadept commented 4 years ago

Hello, @leonrinkel Actually seems good I can review it in more detail little bit later But main idea is realized, wow

libvirtadept commented 4 years ago

Now it is very simple to create domain without a lot of XML things or hand-writed keys in console 😃

libvirtadept commented 4 years ago

I will have a lot of time on weekend to test various scenaries of using this new things

libvirtadept commented 4 years ago

Sorry for delay Returning to testing I've got some work tasks. Now they are done and can test anything.

libvirtadept commented 4 years ago

Hi, Tested xml thing. I guess it is works as expected. I think i can create domain autostart method. Also added setVcpu method to domain builder, i'm collecting PR request

By the way i'm looking for building and running package on windows but can't get how to link libvirt package to node-gyp :(

Tested VNC configuration. Fuck wow, it is actually simpliest and most usefull solution to manage VMs with typescript. vmngr/libvirt already better than any of existing bindings lmao

libvirtadept commented 4 years ago

Leon, what do you think about domain editiing ? Currently possible to re-define (using domainDefineXML) with another config (but need to uuid or id be the same)

leonrinkel commented 4 years ago

Leon, what do you think about domain editiing ? Currently possible to re-define (using domainDefineXML) with another config (but need to uuid or id be the same)

Good point. In addition to domainDescToXml we'll need something like xmlToDomainDesc, as well as Builder.listDisks(), Builder.removeDisk() or even Builder.editDisk() and so on. I'll look into parsing XML rn. That would also allow using existing domains as templates and I think that would be pretty awesome.