On 09.12.2015 16:48, Mikhail Feoktistov wrote:
---
diff from v1.
Remove call of vzDomainSuspend() in case of VIR_DOMAIN_START_PAUSED flag is set.
Now we don't support to create instance in stopped state.
src/vz/vz_driver.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index ea1090a..4498e01 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -979,6 +979,29 @@ vzDomainUndefine(virDomainPtr domain)
return vzDomainUndefineFlags(domain, 0);
}
+static virDomainPtr
+vzDomainCreateXML(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags)
+{
+ virDomainPtr domain;
+ int ret;
This variable seem rather redundant.
+
+ virCheckFlags(0, NULL);
+
+ domain = vzDomainDefineXMLFlags(conn, xml, 0);
+ if (domain == NULL)
+ return domain;
if (!domain) return NULL;
+
+ ret = vzDomainCreate(domain);
+ if (ret != 0) {
if (vzDomainCreate(domain) < 0) {
+ vzDomainUndefine(domain);
+ return NULL;
+ }
+
+ return domain;
+}
+
But those are just small nits. What I find more wrong is that
virDomainCrateXML() is supposed to create a transient domain. That is -
domain that exists only as long as it is running. When shut down, its
definition is lost - unlike for defined domains which definition is kept
around until undefined. Frankly, I don't know vz that well to say if
that's possible with the driver or not. But if it isn't maybe we should
not add implement the API at all as it may confuse users.
Michal