[libvirt] [PATCH 0/5] Parallels: patchset

Another patchset for Parallels libvirt driver. This patchset includes some minor bugfixing and adds some functions required to start OpenStack Alexander Burluka (5): Parallels: add virNodeGetCPUMap(). Parallels: fix error with video card RAM dimension Parallels: Add video acceleration parameter change ignore. Parallels: Add domainCreateWithFlags() function. Parallels: add events emiting while creating domain. src/parallels/parallels_driver.c | 80 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) -- 1.9.1

That function caused errors in libvirtd logs when OpenStack Nova starts VM instance. --- src/parallels/parallels_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index bb9538f..6534fdb 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -2417,6 +2417,16 @@ parallelsDomainGetVcpus(virDomainPtr domain, } +static int +parallelsNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED, + unsigned char **cpumap, + unsigned int *online, + unsigned int flags) +{ + return nodeGetCPUMap(cpumap, online, flags); +} + + static virDriver parallelsDriver = { .no = VIR_DRV_PARALLELS, .name = "Parallels", @@ -2448,6 +2458,7 @@ static virDriver parallelsDriver = { .domainShutdown = parallelsDomainShutdown, /* 0.10.0 */ .domainCreate = parallelsDomainCreate, /* 0.10.0 */ .domainDefineXML = parallelsDomainDefineXML, /* 0.10.0 */ + .nodeGetCPUMap = parallelsNodeGetCPUMap, /* 1.2.6 */ .connectIsEncrypted = parallelsConnectIsEncrypted, /* 1.2.5 */ .connectIsSecure = parallelsConnectIsSecure, /* 1.2.5 */ .connectIsAlive = parallelsConnectIsAlive, /* 1.2.5 */ -- 1.9.1

Libvirt measures vram in Kbytes, not in bytes, so calculation of Mbytes was incorrect. PCS server can take vram argument with units, so I added K postfix to make params a little bit clearer. --- src/parallels/parallels_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 6534fdb..3806e5e 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1628,13 +1628,13 @@ parallelsApplyVideoParams(parallelsDomObjPtr pdom, } if (old->vram != new->vram) { - if (new->vram % (1 << 20) != 0) { + if (new->vram % (1 << 10) != 0) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Video RAM size should be multiple of 1Mb.")); return -1; } - snprintf(str_vram, 31, "%d", new->vram >> 20); + snprintf(str_vram, 31, "%dK", new->vram); str_vram[31] = '\0'; if (parallelsCmdRun(PRLCTL, "set", pdom->uuid, -- 1.9.1

As long as OpenStack's Nova does not know anything about video card acceleration, 2D and 3D acceleration parameters are unset in input XML generated by Nova. Any change of these parameters is ignored now. --- src/parallels/parallels_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 3806e5e..c19aa96 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1621,10 +1621,8 @@ parallelsApplyVideoParams(parallelsDomObjPtr pdom, old->accel->support2d != new->accel->support2d || old->accel->support3d != new->accel->support3d) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("Changing video acceleration parameters is " - "not supported by parallels driver")); - return -1; + VIR_WARN("Changing video acceleration parameters is " + "not supported by parallels driver"); } if (old->vram != new->vram) { -- 1.9.1

On Wed, Aug 20, 2014 at 07:33:07PM +0400, Alexander Burluka wrote:
As long as OpenStack's Nova does not know anything about video card acceleration, 2D and 3D acceleration parameters are unset in input XML generated by Nova. Any change of these parameters is ignored now. --- src/parallels/parallels_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 3806e5e..c19aa96 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1621,10 +1621,8 @@ parallelsApplyVideoParams(parallelsDomObjPtr pdom, old->accel->support2d != new->accel->support2d || old->accel->support3d != new->accel->support3d) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("Changing video acceleration parameters is " - "not supported by parallels driver")); - return -1; + VIR_WARN("Changing video acceleration parameters is " + "not supported by parallels driver"); }
Afraid this isn't right. It is our policy that any time a bit of XML config is request that the hypervisor is not able to support, we should raise an error of VIR_ERR_CONFIG_UNSUPPORTED. So if anything this patch should merely change the current error code used. s/ARGUMENT/CONFIG/ Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

domainCreateWithFlags function is used by OpenStack Nova to boot instance. --- src/parallels/parallels_driver.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index c19aa96..cd1baa0 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -2425,6 +2425,55 @@ parallelsNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED, } +static int +parallelsDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) +{ + parallelsConnPtr privconn = domain->conn->privateData; + virDomainObjPtr privdom = NULL; + int ret = -1; + + virCheckFlags(VIR_DOMAIN_START_PAUSED | + VIR_DOMAIN_START_AUTODESTROY | + VIR_DOMAIN_START_BYPASS_CACHE | + VIR_DOMAIN_START_FORCE_BOOT, -1); + + parallelsDriverLock(privconn); + privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid); + parallelsDriverUnlock(privconn); + + if (!privdom) { + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); + ret = -1; + goto cleanup; + } + + if (virDomainObjIsActive(privdom)) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is already running")); + ret = -1; + goto cleanup; + } + + ret = parallelsStart(privdom); + if (ret == 0) { + virDomainObjSetState(privdom, VIR_DOMAIN_RUNNING, + VIR_DOMAIN_RUNNING_BOOTED); + } else { + virDomainObjSetState(privdom, VIR_DOMAIN_CRASHED, + VIR_DOMAIN_CRASHED_UNKNOWN); + } + + ret = 0; + + cleanup: + if (privdom) + virObjectUnlock(privdom); + + return ret; +} + + static virDriver parallelsDriver = { .no = VIR_DRV_PARALLELS, .name = "Parallels", @@ -2456,6 +2505,7 @@ static virDriver parallelsDriver = { .domainShutdown = parallelsDomainShutdown, /* 0.10.0 */ .domainCreate = parallelsDomainCreate, /* 0.10.0 */ .domainDefineXML = parallelsDomainDefineXML, /* 0.10.0 */ + .domainCreateWithFlags = parallelsDomainCreateWithFlags, /* 1.2.7 */ .nodeGetCPUMap = parallelsNodeGetCPUMap, /* 1.2.6 */ .connectIsEncrypted = parallelsConnectIsEncrypted, /* 1.2.5 */ .connectIsSecure = parallelsConnectIsSecure, /* 1.2.5 */ -- 1.9.1

--- src/parallels/parallels_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index cd1baa0..174313b 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -2430,6 +2430,7 @@ parallelsDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) { parallelsConnPtr privconn = domain->conn->privateData; virDomainObjPtr privdom = NULL; + virObjectEventPtr event = NULL; int ret = -1; virCheckFlags(VIR_DOMAIN_START_PAUSED | @@ -2457,9 +2458,15 @@ parallelsDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) ret = parallelsStart(privdom); if (ret == 0) { + event = virDomainEventLifecycleNewFromObj(privdom, + VIR_DOMAIN_EVENT_STARTED, + VIR_DOMAIN_EVENT_STARTED_BOOTED); virDomainObjSetState(privdom, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); } else { + event = virDomainEventLifecycleNewFromObj(privdom, + VIR_DOMAIN_EVENT_CRASHED, + VIR_DOMAIN_EVENT_CRASHED_PANICKED); virDomainObjSetState(privdom, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_UNKNOWN); } @@ -2469,6 +2476,8 @@ parallelsDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) cleanup: if (privdom) virObjectUnlock(privdom); + if (event) + virObjectEventStateQueue(privconn->domainEventState, event); return ret; } -- 1.9.1
participants (2)
-
Alexander Burluka
-
Daniel P. Berrange