mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Support OpenVZ filesystem template config in XML dump
This commit is contained in:
parent
1dea5535b0
commit
9b7fd9c4ae
@ -1,3 +1,8 @@
|
|||||||
|
Mon Nov 10 12:05:42 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/openvz_conf.c: Read filesytem template name from config
|
||||||
|
files. Increase buffer size when parsing vzctl version number
|
||||||
|
|
||||||
Thu Nov 6 20:45:42 CET 2008 Jim Meyering <meyering@redhat.com>
|
Thu Nov 6 20:45:42 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
tweak lstat.c to avoid mingw link failure
|
tweak lstat.c to avoid mingw link failure
|
||||||
|
@ -86,7 +86,7 @@ openvzExtractVersionInfo(const char *cmd, int *retversion)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
char *help = NULL;
|
char *help = NULL;
|
||||||
int len = virFileReadLimFD(newstdout, 512, &help);
|
int len = virFileReadLimFD(newstdout, 4096, &help);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
|
|
||||||
@ -343,6 +343,47 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
openvzReadFSConf(virConnectPtr conn,
|
||||||
|
virDomainDefPtr def,
|
||||||
|
int veid) {
|
||||||
|
int ret;
|
||||||
|
virDomainFSDefPtr fs = NULL;
|
||||||
|
char temp[4096];
|
||||||
|
|
||||||
|
ret = openvzReadConfigParam(veid, "OSTEMPLATE", temp, sizeof(temp));
|
||||||
|
if (ret < 0) {
|
||||||
|
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Cound not read 'OSTEMPLATE' from config for container %d"),
|
||||||
|
veid);
|
||||||
|
goto error;
|
||||||
|
} else if (ret > 0) {
|
||||||
|
if (VIR_ALLOC(fs) < 0)
|
||||||
|
goto no_memory;
|
||||||
|
|
||||||
|
fs->type = VIR_DOMAIN_FS_TYPE_TEMPLATE;
|
||||||
|
fs->src = strdup(temp);
|
||||||
|
fs->dst = strdup("/");
|
||||||
|
|
||||||
|
if (fs->src == NULL || fs->dst == NULL)
|
||||||
|
goto no_memory;
|
||||||
|
|
||||||
|
if (VIR_REALLOC_N(def->fss, def->nfss + 1) < 0)
|
||||||
|
goto no_memory;
|
||||||
|
def->fss[def->nfss++] = fs;
|
||||||
|
fs = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
no_memory:
|
||||||
|
openvzError(conn, VIR_ERR_NO_MEMORY, NULL);
|
||||||
|
error:
|
||||||
|
virDomainFSDefFree(fs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Free all memory associated with a openvz_driver structure */
|
/* Free all memory associated with a openvz_driver structure */
|
||||||
void
|
void
|
||||||
openvzFreeDriver(struct openvz_driver *driver)
|
openvzFreeDriver(struct openvz_driver *driver)
|
||||||
@ -428,6 +469,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
|||||||
/* XXX load rest of VM config data .... */
|
/* XXX load rest of VM config data .... */
|
||||||
|
|
||||||
openvzReadNetworkConf(NULL, dom->def, veid);
|
openvzReadNetworkConf(NULL, dom->def, veid);
|
||||||
|
openvzReadFSConf(NULL, dom->def, veid);
|
||||||
|
|
||||||
if (VIR_REALLOC_N(driver->domains.objs,
|
if (VIR_REALLOC_N(driver->domains.objs,
|
||||||
driver->domains.count + 1) < 0)
|
driver->domains.count + 1) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user