2012/7/25 张光鹏 <zhanggp(a)neusoft.com>
**
Hi,all.
we use libvirt to manage some host and vms on vmware
hypervisor.I have found the libvirt there are some shortcomings .
Such as virsh domxml-to-native and domxml-from-native
.I have reviewed the libvirt source --src/vmx/vmx.c, code as follows :
libvirt0.9.13源码
xml 转化成vmx
vmx转化成xml
/* def:os.arch -> vmx:guestOS */
if (def->os.arch == NULL || STRCASEEQ(def->os.arch, "i686")) {
virBufferAddLit(&buffer, "guestOS = \"other\"\n");
} else if (STRCASEEQ(def->os.arch, "x86_64")) {
virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
} else {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Expecting domain XML attribute 'arch' of entry 'os/type' "
"to be 'i686' or 'x86_64' but found '%s'"),
def->os.arch);
goto cleanup;
}
/* vmx:guestOS -> def:os.arch */
if (virVMXGetConfigString(conf, "guestOS", &guestOS, true) < 0) {
goto cleanup;
}
if (guestOS != NULL && virFileHasSuffix(guestOS, "-64")) {
def->os.arch = strdup("x86_64");
} else {
def->os.arch = strdup("i686");
}
if (def->os.arch == NULL) {
virReportOOMError();
goto cleanup;
}
Vmware support many guestOS types like "windows7srv-64
",If I use 64-bit Windows virtual machine, other-64 this type is not correct.
NIC e1000 system can not be used .
So
I suggest to The libvirt improve the vmware support, especially the mutual transformation
of the xml and vmx format guestOS only one parameter.
Thanks all.
Hi,
This is a known problem. This is not that easy to fix because currently
libvirt does not expose the guest OS type of the virtual machine in its XML
config. Therefore, vmx.c has no place to store this information in the XML
config.
To fix this the XML config hasto be extended with a guest OS tag.
--
Matthias Bolte
http://photron.blogspot.com