[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/8] parallels: add functions to list domains and get info



On 07/27/2012 01:23 PM, Daniel P. Berrange wrote:
On Thu, Jul 26, 2012 at 10:32:01PM +0400, Dmitry Guryanov wrote:

+static virDomainObjPtr
+parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
+{

+    if (!(def->os.type = strdup("hvm")))
+        goto no_memory;
+
+    if (!(def->os.arch = strdup(PARALLELS_DEFAULT_ARCH)))
+        goto no_memory;
How you answer my question in the previous patch, might impact what
you need todo here.
We support only x86_64 and there is a check in configure.ac.

+static char *
+parallelsGetOSType(virDomainPtr domain)
+{
+    parallelsConnPtr privconn = domain->conn->privateData;
+    virDomainObjPtr privdom;
+    parallelsDomObjPtr pdom;
+
+    char *ret = NULL;
+
+    parallelsDriverLock(privconn);
+    privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+    if (privdom == NULL) {
+        parallelsDomNotFoundError(domain);
+        goto cleanup;
+    }
+
+    pdom = privdom->privateData;
+
+    if (!(ret = strdup(pdom->os)))
+        virReportOOMError();
What sort of value is 'pdom->os' holding.  The name of this particular
libvirt method is somewhat misleading and does *not* in fact refer
to the guest operating system name. It is actually just wanting the
value from def->os.type, which is 'hvm' or 'exe' etc
Yes, I thought that this is Guest OS name, need to be changed
to "hvm".

diff --git a/src/parallels/parallels_utils.c b/src/parallels/parallels_utils.c
new file mode 100644
index 0000000..102ccfc
--- /dev/null
+++ b/src/parallels/parallels_utils.c
@@ -0,0 +1,92 @@
+/*
+ * parallels_utils.c: core driver functions for managing
+ * Parallels Virtuozzo Server hosts
+ *
+ * Copyright (C) 2012 Parallels, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include <stdarg.h>
+
+#include "command.h"
+#include "virterror_internal.h"
+#include "memory.h"
+#include "json.h"
+
+#include "parallels_utils.h"
+
+#define VIR_FROM_THIS VIR_FROM_PARALLELS
+
+static int
+parallelsDoCmdRun(char **outbuf, const char *binary, va_list list)
+{
+    virCommandPtr cmd = virCommandNew(binary);
+    const char *arg;
+    char *scmd = NULL;
+    int ret = -1;
+
+    while ((arg = va_arg(list, const char *)) != NULL)
+        virCommandAddArg(cmd, arg);
I'd actually be happy for you to add a 'virCommandNewVAList' API
to src/util/command.{c,h} to contain this code, since we already
have one that takes '...' args

OK

Regards,
Daniel


--
Dmitry Guryanov


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]