[libvirt] [PATCH 1/3] parallels: change URI to parallels:///system

Let's change URI to parallels:///system. Parallels Server supports creating VMs from non-privileged accounts, but it's not main usage scenario and it may be forbidden in the future. Also containers, which will be supported by the driver, can be managed only by root, so /system path is more suitable for this driver. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- docs/drvparallels.html.in | 10 +++++----- src/parallels/parallels_driver.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/drvparallels.html.in b/docs/drvparallels.html.in index 40a0fe5..8e1430b 100644 --- a/docs/drvparallels.html.in +++ b/docs/drvparallels.html.in @@ -19,10 +19,10 @@ The libvirt Parallels driver is a single-instance privileged driver, with a driver name of 'parallels'. Some example connection URIs for the libvirt driver are: </p> <pre> -parallels:///default (local access) -parallels+unix:///default (local access) -parallels://example.com/default (remote access, TLS/x509) -parallels+tcp://example.com/default (remote access, SASl/Kerberos) -parallels+ssh://root@example.com/default (remote access, SSH tunnelled) +parallels:///system (local access) +parallels+unix:///system (local access) +parallels://example.com/system (remote access, TLS/x509) +parallels+tcp://example.com/system (remote access, SASl/Kerberos) +parallels+ssh://root@example.com/system (remote access, SSH tunnelled) </pre> </body></html> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 05db54f..53b5a50 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -670,11 +670,11 @@ parallelsOpen(virConnectPtr conn, (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("parallelsOpen: supply a path or use " - "parallels:///session")); + "parallels:///system")); return VIR_DRV_OPEN_ERROR; } - if (STREQ(conn->uri->path, "/session")) + if (STREQ(conn->uri->path, "/system")) ret = parallelsOpenDefault(conn); else return VIR_DRV_OPEN_DECLINED; -- 1.7.1

Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace a lot of checks. Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same as in other drivers. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- src/parallels/parallels_driver.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 53b5a50..d8e7ae8 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -665,21 +665,14 @@ parallelsOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; /* From this point on, the connection is for us. */ - if ( - conn->uri->path[0] == '\0' || - (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("parallelsOpen: supply a path or use " - "parallels:///system")); + if (!STREQ_NULLABLE(conn->uri->path, "/system")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected Parallels URI path '%s', try parallels:///system"), + conn->uri->path); return VIR_DRV_OPEN_ERROR; } - if (STREQ(conn->uri->path, "/system")) - ret = parallelsOpenDefault(conn); - else - return VIR_DRV_OPEN_DECLINED; - - if (ret != VIR_DRV_OPEN_SUCCESS) + if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS) return ret; return VIR_DRV_OPEN_SUCCESS; -- 1.7.1

On Mon, Aug 13, 2012 at 07:50:13PM +0400, Dmitry Guryanov wrote:
Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace a lot of checks.
Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same as in other drivers.
Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- src/parallels/parallels_driver.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 53b5a50..d8e7ae8 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -665,21 +665,14 @@ parallelsOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED;
/* From this point on, the connection is for us. */ - if ( - conn->uri->path[0] == '\0' || - (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("parallelsOpen: supply a path or use " - "parallels:///system")); + if (!STREQ_NULLABLE(conn->uri->path, "/system")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected Parallels URI path '%s', try parallels:///system"), + conn->uri->path); return VIR_DRV_OPEN_ERROR; }
- if (STREQ(conn->uri->path, "/system")) - ret = parallelsOpenDefault(conn); - else - return VIR_DRV_OPEN_DECLINED; - - if (ret != VIR_DRV_OPEN_SUCCESS) + if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS) return ret;
return VIR_DRV_OPEN_SUCCESS;
Okay, semantic is the same except you return OPEN_ERROR instead of OPEN_DECLINED, still sounds fine, ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- docs/drvparallels.html.in | 39 ++++++++++++++++++++ docs/schemas/domaincommon.rng | 1 + .../domain-parallels-vm-simple.xml | 26 +++++++++++++ 3 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 tests/domainschemadata/domain-parallels-vm-simple.xml diff --git a/docs/drvparallels.html.in b/docs/drvparallels.html.in index 8e1430b..0a86451 100644 --- a/docs/drvparallels.html.in +++ b/docs/drvparallels.html.in @@ -25,4 +25,43 @@ parallels://example.com/system (remote access, TLS/x509) parallels+tcp://example.com/system (remote access, SASl/Kerberos) parallels+ssh://root@example.com/system (remote access, SSH tunnelled) </pre> + + <h2><a name="example">Example guest domain XML configuration</a></h2> + + <p> + Parallels driver require at least one hard disk for new domains + at this time. It is used for defining directory, where VM should + be created. + </p> + +<pre> +<domain type='parallels'> + <name>demo</name> + <uuid>54cdecad-4492-4e31-a209-33cc21d64057</uuid> + <description>some description</description> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <source file='/storage/vol1'/> + <target dev='hda'/> + </disk> + <video> + <model type='vga' vram='33554432' heads='1'> + <acceleration accel3d='no' accel2d='no'/> + </model> + </video> + </devices> +</domain> + +</pre> + </body></html> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c85d763..1b94155 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -179,6 +179,7 @@ <value>hyperv</value> <value>vbox</value> <value>phyp</value> + <value>parallels</value> </choice> </attribute> </define> diff --git a/tests/domainschemadata/domain-parallels-vm-simple.xml b/tests/domainschemadata/domain-parallels-vm-simple.xml new file mode 100644 index 0000000..4e21583 --- /dev/null +++ b/tests/domainschemadata/domain-parallels-vm-simple.xml @@ -0,0 +1,26 @@ +<domain type='parallels'> + <name>demo</name> + <uuid>54cdecad-4492-4e31-a209-33cc21d64057</uuid> + <description>some description</description> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <source file='/storage/vol1'/> + <target dev='hda'/> + </disk> + <video> + <model type='vga' vram='33554432' heads='1'> + <acceleration accel3d='no' accel2d='no'/> + </model> + </video> + </devices> +</domain> -- 1.7.1

On Mon, Aug 13, 2012 at 07:50:14PM +0400, Dmitry Guryanov wrote:
Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- docs/drvparallels.html.in | 39 ++++++++++++++++++++ docs/schemas/domaincommon.rng | 1 + .../domain-parallels-vm-simple.xml | 26 +++++++++++++ 3 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 tests/domainschemadata/domain-parallels-vm-simple.xml
diff --git a/docs/drvparallels.html.in b/docs/drvparallels.html.in index 8e1430b..0a86451 100644 --- a/docs/drvparallels.html.in +++ b/docs/drvparallels.html.in @@ -25,4 +25,43 @@ parallels://example.com/system (remote access, TLS/x509) parallels+tcp://example.com/system (remote access, SASl/Kerberos) parallels+ssh://root@example.com/system (remote access, SSH tunnelled) </pre> + + <h2><a name="example">Example guest domain XML configuration</a></h2> + + <p> + Parallels driver require at least one hard disk for new domains + at this time. It is used for defining directory, where VM should + be created. + </p> + +<pre> +<domain type='parallels'> + <name>demo</name> + <uuid>54cdecad-4492-4e31-a209-33cc21d64057</uuid> + <description>some description</description> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <source file='/storage/vol1'/> + <target dev='hda'/> + </disk> + <video> + <model type='vga' vram='33554432' heads='1'> + <acceleration accel3d='no' accel2d='no'/> + </model> + </video> + </devices> +</domain> + +</pre> + </body></html> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c85d763..1b94155 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -179,6 +179,7 @@ <value>hyperv</value> <value>vbox</value> <value>phyp</value> + <value>parallels</value> </choice> </attribute> </define> diff --git a/tests/domainschemadata/domain-parallels-vm-simple.xml b/tests/domainschemadata/domain-parallels-vm-simple.xml new file mode 100644 index 0000000..4e21583 --- /dev/null +++ b/tests/domainschemadata/domain-parallels-vm-simple.xml @@ -0,0 +1,26 @@ +<domain type='parallels'> + <name>demo</name> + <uuid>54cdecad-4492-4e31-a209-33cc21d64057</uuid> + <description>some description</description> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>destroy</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='disk'> + <source file='/storage/vol1'/> + <target dev='hda'/> + </disk> + <video> + <model type='vga' vram='33554432' heads='1'> + <acceleration accel3d='no' accel2d='no'/> + </model> + </video> + </devices> +</domain>
Ahhh ! great :-) I feel better to have the schemas updated and an example in the doc and regression tests, ACK, I just pushed the 3 patches, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Aug 13, 2012 at 07:50:12PM +0400, Dmitry Guryanov wrote:
Let's change URI to parallels:///system. Parallels Server supports creating VMs from non-privileged accounts, but it's not main usage scenario and it may be forbidden in the future.
Also containers, which will be supported by the driver, can be managed only by root, so /system path is more suitable for this driver. [...] diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 05db54f..53b5a50 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -670,11 +670,11 @@ parallelsOpen(virConnectPtr conn, (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("parallelsOpen: supply a path or use " - "parallels:///session")); + "parallels:///system")); return VIR_DRV_OPEN_ERROR; }
- if (STREQ(conn->uri->path, "/session")) + if (STREQ(conn->uri->path, "/system")) ret = parallelsOpenDefault(conn); else return VIR_DRV_OPEN_DECLINED;
Hum, Okay, the rc0 is not a release so we can still break things so better fix this early than late ! ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Dmitry Guryanov