Hello everybody,
the modification of the xml-decription of an vm is disabled in libvirt for the combination
of xen/libvirt.
The following patches will enabled it.
a possible use case is the restore of a vm , whose virtuell disk is on an LVM, and it
should use for the restore a snapshot of this LVM
all the best
guido
---
src/libxl/libxl_domain.c | 14 +++++++++++---
src/libxl/libxl_domain.h | 3 ++-
src/libxl/libxl_driver.c | 9 +--------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0e26b91..98992a5 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -630,7 +630,8 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
libxlDriverConfigPtr cfg,
const char *from,
virDomainDefPtr *ret_def,
- libxlSavefileHeaderPtr ret_hdr)
+ libxlSavefileHeaderPtr ret_hdr,
+ const char *xmlin )
{
int fd;
virDomainDefPtr def = NULL;
@@ -675,10 +676,17 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
goto error;
}
- if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
+ if (xmlin != NULL) {
+ if (!(def = virDomainDefParseString(xmlin, cfg->caps, driver->xmlopt,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE |
+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
+ goto error;
+ } else {
+ if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
VIR_DOMAIN_DEF_PARSE_INACTIVE |
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto error;
+ }
VIR_FREE(xml);
@@ -1072,7 +1080,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
managed_save_fd = libxlDomainSaveImageOpen(driver, cfg,
managed_save_path,
- &def, &hdr);
+ &def, &hdr, NULL);
if (managed_save_fd < 0)
goto cleanup;
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index af11a2c..863473d 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -106,7 +106,8 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
libxlDriverConfigPtr cfg,
const char *from,
virDomainDefPtr *ret_def,
- libxlSavefileHeaderPtr ret_hdr)
+ libxlSavefileHeaderPtr ret_hdr,
+ const char *xmlin)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
int
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index cb501cf..4683fe7 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1828,14 +1828,7 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
return -1;
#endif
- virCheckFlags(VIR_DOMAIN_SAVE_PAUSED, -1);
- if (dxml) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("xml modification unsupported"));
- return -1;
- }
-
- fd = libxlDomainSaveImageOpen(driver, cfg, from, &def, &hdr);
+ fd = libxlDomainSaveImageOpen(driver, cfg, from, &def, &hdr, dxml);
if (fd < 0)
goto cleanup;
--
2.6.6
____________
Virus checked by G Data MailSecurity
Version: AVA 25.8250 dated 12.09.2016
Virus news:
www.antiviruslab.com