mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
Remove spurious whitespace between function name & open brackets
The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
0211fd6e04
commit
1c04f99970
@ -45,7 +45,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
|||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
char **list;
|
char **list;
|
||||||
virConfValuePtr p = virConfGetValue (conf, key);
|
virConfValuePtr p = virConfGetValue(conf, key);
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
|||||||
key);
|
key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
list[0] = strdup (p->str);
|
list[0] = strdup(p->str);
|
||||||
list[1] = NULL;
|
list[1] = NULL;
|
||||||
if (list[0] == NULL) {
|
if (list[0] == NULL) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
@ -88,7 +88,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
|||||||
VIR_FREE(list);
|
VIR_FREE(list);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
list[i] = strdup (pp->str);
|
list[i] = strdup(pp->str);
|
||||||
if (list[i] == NULL) {
|
if (list[i] == NULL) {
|
||||||
int j;
|
int j;
|
||||||
for (j = 0 ; j < i ; j++)
|
for (j = 0 ; j < i ; j++)
|
||||||
@ -119,15 +119,15 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
|||||||
|
|
||||||
/* A helper function used by each of the following macros. */
|
/* A helper function used by each of the following macros. */
|
||||||
static int
|
static int
|
||||||
checkType (virConfValuePtr p, const char *filename,
|
checkType(virConfValuePtr p, const char *filename,
|
||||||
const char *key, virConfType required_type)
|
const char *key, virConfType required_type)
|
||||||
{
|
{
|
||||||
if (p->type != required_type) {
|
if (p->type != required_type) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("remoteReadConfigFile: %s: %s: invalid type:"
|
_("remoteReadConfigFile: %s: %s: invalid type:"
|
||||||
" got %s; expected %s"), filename, key,
|
" got %s; expected %s"), filename, key,
|
||||||
virConfTypeName (p->type),
|
virConfTypeName(p->type),
|
||||||
virConfTypeName (required_type));
|
virConfTypeName(required_type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -139,12 +139,12 @@ checkType (virConfValuePtr p, const char *filename,
|
|||||||
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
|
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
|
||||||
#define GET_CONF_STR(conf, filename, var_name) \
|
#define GET_CONF_STR(conf, filename, var_name) \
|
||||||
do { \
|
do { \
|
||||||
virConfValuePtr p = virConfGetValue (conf, #var_name); \
|
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||||
if (p) { \
|
if (p) { \
|
||||||
if (checkType (p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
||||||
goto error; \
|
goto error; \
|
||||||
VIR_FREE(data->var_name); \
|
VIR_FREE(data->var_name); \
|
||||||
if (!(data->var_name = strdup (p->str))) { \
|
if (!(data->var_name = strdup(p->str))) { \
|
||||||
virReportOOMError(); \
|
virReportOOMError(); \
|
||||||
goto error; \
|
goto error; \
|
||||||
} \
|
} \
|
||||||
@ -154,9 +154,9 @@ checkType (virConfValuePtr p, const char *filename,
|
|||||||
/* Like GET_CONF_STR, but for integral values. */
|
/* Like GET_CONF_STR, but for integral values. */
|
||||||
#define GET_CONF_INT(conf, filename, var_name) \
|
#define GET_CONF_INT(conf, filename, var_name) \
|
||||||
do { \
|
do { \
|
||||||
virConfValuePtr p = virConfGetValue (conf, #var_name); \
|
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||||
if (p) { \
|
if (p) { \
|
||||||
if (checkType (p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
if (checkType(p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||||
goto error; \
|
goto error; \
|
||||||
data->var_name = p->l; \
|
data->var_name = p->l; \
|
||||||
} \
|
} \
|
||||||
@ -166,11 +166,11 @@ checkType (virConfValuePtr p, const char *filename,
|
|||||||
static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, const char *filename) {
|
static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, const char *filename) {
|
||||||
virConfValuePtr p;
|
virConfValuePtr p;
|
||||||
|
|
||||||
p = virConfGetValue (conf, key);
|
p = virConfGetValue(conf, key);
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (checkType (p, filename, key, VIR_CONF_STRING) < 0)
|
if (checkType(p, filename, key, VIR_CONF_STRING) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!p->str)
|
if (!p->str)
|
||||||
@ -366,11 +366,11 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
|||||||
const char *filename,
|
const char *filename,
|
||||||
virConfPtr conf)
|
virConfPtr conf)
|
||||||
{
|
{
|
||||||
GET_CONF_INT (conf, filename, listen_tcp);
|
GET_CONF_INT(conf, filename, listen_tcp);
|
||||||
GET_CONF_INT (conf, filename, listen_tls);
|
GET_CONF_INT(conf, filename, listen_tls);
|
||||||
GET_CONF_STR (conf, filename, tls_port);
|
GET_CONF_STR(conf, filename, tls_port);
|
||||||
GET_CONF_STR (conf, filename, tcp_port);
|
GET_CONF_STR(conf, filename, tcp_port);
|
||||||
GET_CONF_STR (conf, filename, listen_addr);
|
GET_CONF_STR(conf, filename, listen_addr);
|
||||||
|
|
||||||
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
|
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -393,22 +393,22 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
|||||||
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
|
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
GET_CONF_STR (conf, filename, unix_sock_group);
|
GET_CONF_STR(conf, filename, unix_sock_group);
|
||||||
GET_CONF_STR (conf, filename, unix_sock_ro_perms);
|
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
|
||||||
GET_CONF_STR (conf, filename, unix_sock_rw_perms);
|
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
|
||||||
|
|
||||||
GET_CONF_STR (conf, filename, unix_sock_dir);
|
GET_CONF_STR(conf, filename, unix_sock_dir);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, mdns_adv);
|
GET_CONF_INT(conf, filename, mdns_adv);
|
||||||
GET_CONF_STR (conf, filename, mdns_name);
|
GET_CONF_STR(conf, filename, mdns_name);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, tls_no_sanity_certificate);
|
GET_CONF_INT(conf, filename, tls_no_sanity_certificate);
|
||||||
GET_CONF_INT (conf, filename, tls_no_verify_certificate);
|
GET_CONF_INT(conf, filename, tls_no_verify_certificate);
|
||||||
|
|
||||||
GET_CONF_STR (conf, filename, key_file);
|
GET_CONF_STR(conf, filename, key_file);
|
||||||
GET_CONF_STR (conf, filename, cert_file);
|
GET_CONF_STR(conf, filename, cert_file);
|
||||||
GET_CONF_STR (conf, filename, ca_file);
|
GET_CONF_STR(conf, filename, ca_file);
|
||||||
GET_CONF_STR (conf, filename, crl_file);
|
GET_CONF_STR(conf, filename, crl_file);
|
||||||
|
|
||||||
if (remoteConfigGetStringList(conf, "tls_allowed_dn_list",
|
if (remoteConfigGetStringList(conf, "tls_allowed_dn_list",
|
||||||
&data->tls_allowed_dn_list, filename) < 0)
|
&data->tls_allowed_dn_list, filename) < 0)
|
||||||
@ -420,28 +420,28 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, min_workers);
|
GET_CONF_INT(conf, filename, min_workers);
|
||||||
GET_CONF_INT (conf, filename, max_workers);
|
GET_CONF_INT(conf, filename, max_workers);
|
||||||
GET_CONF_INT (conf, filename, max_clients);
|
GET_CONF_INT(conf, filename, max_clients);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, prio_workers);
|
GET_CONF_INT(conf, filename, prio_workers);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, max_requests);
|
GET_CONF_INT(conf, filename, max_requests);
|
||||||
GET_CONF_INT (conf, filename, max_client_requests);
|
GET_CONF_INT(conf, filename, max_client_requests);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, audit_level);
|
GET_CONF_INT(conf, filename, audit_level);
|
||||||
GET_CONF_INT (conf, filename, audit_logging);
|
GET_CONF_INT(conf, filename, audit_logging);
|
||||||
|
|
||||||
GET_CONF_STR (conf, filename, host_uuid);
|
GET_CONF_STR(conf, filename, host_uuid);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, log_level);
|
GET_CONF_INT(conf, filename, log_level);
|
||||||
GET_CONF_STR (conf, filename, log_filters);
|
GET_CONF_STR(conf, filename, log_filters);
|
||||||
GET_CONF_STR (conf, filename, log_outputs);
|
GET_CONF_STR(conf, filename, log_outputs);
|
||||||
GET_CONF_INT (conf, filename, log_buffer_size);
|
GET_CONF_INT(conf, filename, log_buffer_size);
|
||||||
|
|
||||||
GET_CONF_INT (conf, filename, keepalive_interval);
|
GET_CONF_INT(conf, filename, keepalive_interval);
|
||||||
GET_CONF_INT (conf, filename, keepalive_count);
|
GET_CONF_INT(conf, filename, keepalive_count);
|
||||||
GET_CONF_INT (conf, filename, keepalive_required);
|
GET_CONF_INT(conf, filename, keepalive_required);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -713,23 +713,23 @@ error:
|
|||||||
static void
|
static void
|
||||||
daemonVersion(const char *argv0)
|
daemonVersion(const char *argv0)
|
||||||
{
|
{
|
||||||
printf ("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
|
printf("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
static int
|
static int
|
||||||
daemonSetupPrivs(void)
|
daemonSetupPrivs(void)
|
||||||
{
|
{
|
||||||
chown ("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
|
chown("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
|
||||||
|
|
||||||
if (__init_daemon_priv (PU_RESETGROUPS | PU_CLEARLIMITSET,
|
if (__init_daemon_priv(PU_RESETGROUPS | PU_CLEARLIMITSET,
|
||||||
SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
|
SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
|
||||||
VIR_ERROR(_("additional privileges are required"));
|
VIR_ERROR(_("additional privileges are required"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv_set (PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
|
if (priv_set(PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
|
||||||
PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
|
PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
|
||||||
VIR_ERROR(_("failed to set reduced privileges"));
|
VIR_ERROR(_("failed to set reduced privileges"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -884,42 +884,43 @@ static int migrateProfile(void)
|
|||||||
static void
|
static void
|
||||||
daemonUsage(const char *argv0, bool privileged)
|
daemonUsage(const char *argv0, bool privileged)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf(stderr,
|
||||||
_("\n\
|
_("\n"
|
||||||
Usage:\n\
|
"Usage:\n"
|
||||||
%s [options]\n\
|
" %s [options]\n"
|
||||||
\n\
|
"\n"
|
||||||
Options:\n\
|
"Options:\n"
|
||||||
-v | --verbose Verbose messages.\n\
|
" -v | --verbose Verbose messages.\n"
|
||||||
-d | --daemon Run as a daemon & write PID file.\n\
|
" -d | --daemon Run as a daemon & write PID file.\n"
|
||||||
-l | --listen Listen for TCP/IP connections.\n\
|
" -l | --listen Listen for TCP/IP connections.\n"
|
||||||
-t | --timeout <secs> Exit after timeout period.\n\
|
" -t | --timeout <secs> Exit after timeout period.\n"
|
||||||
-f | --config <file> Configuration file.\n\
|
" -f | --config <file> Configuration file.\n"
|
||||||
| --version Display version information.\n\
|
" | --version Display version information.\n"
|
||||||
-p | --pid-file <file> Change name of PID file.\n\
|
" -p | --pid-file <file> Change name of PID file.\n"
|
||||||
\n\
|
"\n"
|
||||||
libvirt management daemon:\n"), argv0);
|
"libvirt management daemon:\n"),
|
||||||
|
argv0);
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("\n\
|
_("\n"
|
||||||
Default paths:\n\
|
" Default paths:\n"
|
||||||
\n\
|
"\n"
|
||||||
Configuration file (unless overridden by -f):\n\
|
" Configuration file (unless overridden by -f):\n"
|
||||||
%s/libvirt/libvirtd.conf\n\
|
" %s/libvirt/libvirtd.conf\n"
|
||||||
\n\
|
"\n"
|
||||||
Sockets:\n\
|
" Sockets:\n"
|
||||||
%s/run/libvirt/libvirt-sock\n\
|
" %s/run/libvirt/libvirt-sock\n"
|
||||||
%s/run/libvirt/libvirt-sock-ro\n\
|
" %s/run/libvirt/libvirt-sock-ro\n"
|
||||||
\n\
|
"\n"
|
||||||
TLS:\n\
|
" TLS:\n"
|
||||||
CA certificate: %s/pki/CA/caert.pem\n\
|
" CA certificate: %s/pki/CA/caert.pem\n"
|
||||||
Server certificate: %s/pki/libvirt/servercert.pem\n\
|
" Server certificate: %s/pki/libvirt/servercert.pem\n"
|
||||||
Server private key: %s/pki/libvirt/private/serverkey.pem\n\
|
" Server private key: %s/pki/libvirt/private/serverkey.pem\n"
|
||||||
\n\
|
"\n"
|
||||||
PID file (unless overridden by -p):\n\
|
" PID file (unless overridden by -p):\n"
|
||||||
%s/run/libvirtd.pid\n\
|
" %s/run/libvirtd.pid\n"
|
||||||
\n"),
|
"\n"),
|
||||||
SYSCONFDIR,
|
SYSCONFDIR,
|
||||||
LOCALSTATEDIR,
|
LOCALSTATEDIR,
|
||||||
LOCALSTATEDIR,
|
LOCALSTATEDIR,
|
||||||
@ -928,24 +929,24 @@ libvirt management daemon:\n"), argv0);
|
|||||||
SYSCONFDIR,
|
SYSCONFDIR,
|
||||||
LOCALSTATEDIR);
|
LOCALSTATEDIR);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s",
|
||||||
"%s", _("\n\
|
_("\n"
|
||||||
Default paths:\n\
|
" Default paths:\n"
|
||||||
\n\
|
"\n"
|
||||||
Configuration file (unless overridden by -f):\n\
|
" Configuration file (unless overridden by -f):\n"
|
||||||
$XDG_CONFIG_HOME/libvirt/libvirtd.conf\n\
|
" $XDG_CONFIG_HOME/libvirt/libvirtd.conf\n"
|
||||||
\n\
|
"\n"
|
||||||
Sockets:\n\
|
" Sockets:\n"
|
||||||
$XDG_RUNTIME_DIR/libvirt/libvirt-sock\n\
|
" $XDG_RUNTIME_DIR/libvirt/libvirt-sock\n"
|
||||||
\n\
|
"\n"
|
||||||
TLS:\n\
|
" TLS:\n"
|
||||||
CA certificate: $HOME/.pki/libvirt/cacert.pem\n\
|
" CA certificate: $HOME/.pki/libvirt/cacert.pem\n"
|
||||||
Server certificate: $HOME/.pki/libvirt/servercert.pem\n\
|
" Server certificate: $HOME/.pki/libvirt/servercert.pem\n"
|
||||||
Server private key: $HOME/.pki/libvirt/serverkey.pem\n\
|
" Server private key: $HOME/.pki/libvirt/serverkey.pem\n"
|
||||||
\n\
|
"\n"
|
||||||
PID file:\n\
|
" PID file:\n"
|
||||||
$XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n\
|
" $XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n"
|
||||||
\n"));
|
"\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,8 +986,8 @@ int main(int argc, char **argv) {
|
|||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (setlocale (LC_ALL, "") == NULL ||
|
if (setlocale(LC_ALL, "") == NULL ||
|
||||||
bindtextdomain (PACKAGE, LOCALEDIR) == NULL ||
|
bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
|
||||||
textdomain(PACKAGE) == NULL ||
|
textdomain(PACKAGE) == NULL ||
|
||||||
virInitialize() < 0) {
|
virInitialize() < 0) {
|
||||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||||
@ -1081,7 +1082,7 @@ int main(int argc, char **argv) {
|
|||||||
default:
|
default:
|
||||||
VIR_ERROR(_("%s: internal error: unknown flag: %c"),
|
VIR_ERROR(_("%s: internal error: unknown flag: %c"),
|
||||||
argv[0], c);
|
argv[0], c);
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ setPyVirTypedParameter(PyObject *info,
|
|||||||
ignore_value(virStrcpyStatic(temp->field, keystr));
|
ignore_value(virStrcpyStatic(temp->field, keystr));
|
||||||
temp->type = params[i].type;
|
temp->type = params[i].type;
|
||||||
|
|
||||||
switch(params[i].type) {
|
switch (params[i].type) {
|
||||||
case VIR_TYPED_PARAM_INT:
|
case VIR_TYPED_PARAM_INT:
|
||||||
if (libvirt_intUnwrap(value, &temp->value.i) < 0)
|
if (libvirt_intUnwrap(value, &temp->value.i) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1940,21 +1940,21 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
libvirt_virGetVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||||
{
|
{
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
unsigned long libVer, typeVer = 0;
|
unsigned long libVer, typeVer = 0;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple (args, (char *) "|s", &type))
|
if (!PyArg_ParseTuple(args, (char *) "|s", &type))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||||
|
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
c_retval = virGetVersion (&libVer, NULL, NULL);
|
c_retval = virGetVersion(&libVer, NULL, NULL);
|
||||||
else
|
else
|
||||||
c_retval = virGetVersion (&libVer, type, &typeVer);
|
c_retval = virGetVersion(&libVer, type, &typeVer);
|
||||||
|
|
||||||
LIBVIRT_END_ALLOW_THREADS;
|
LIBVIRT_END_ALLOW_THREADS;
|
||||||
|
|
||||||
@ -1962,14 +1962,14 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
return VIR_PY_NONE;
|
return VIR_PY_NONE;
|
||||||
|
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
return PyInt_FromLong (libVer);
|
return PyInt_FromLong(libVer);
|
||||||
else
|
else
|
||||||
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
return Py_BuildValue((char *) "kk", libVer, typeVer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectGetVersion(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args)
|
PyObject *args)
|
||||||
{
|
{
|
||||||
unsigned long hvVersion;
|
unsigned long hvVersion;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
@ -1990,12 +1990,12 @@ libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
if (c_retval == -1)
|
if (c_retval == -1)
|
||||||
return VIR_PY_INT_FAIL;
|
return VIR_PY_INT_FAIL;
|
||||||
|
|
||||||
return PyInt_FromLong (hvVersion);
|
return PyInt_FromLong(hvVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectGetLibVersion(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args)
|
PyObject *args)
|
||||||
{
|
{
|
||||||
unsigned long libVer;
|
unsigned long libVer;
|
||||||
int c_retval;
|
int c_retval;
|
||||||
@ -2016,7 +2016,7 @@ libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
if (c_retval == -1)
|
if (c_retval == -1)
|
||||||
return VIR_PY_INT_FAIL;
|
return VIR_PY_INT_FAIL;
|
||||||
|
|
||||||
return PyInt_FromLong (libVer);
|
return PyInt_FromLong(libVer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@ -4404,7 +4404,7 @@ static PyObject *libvirt_dict = NULL;
|
|||||||
static PyObject *libvirt_dom_class = NULL;
|
static PyObject *libvirt_dom_class = NULL;
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
getLibvirtModuleObject (void) {
|
getLibvirtModuleObject(void) {
|
||||||
if (libvirt_module)
|
if (libvirt_module)
|
||||||
return libvirt_module;
|
return libvirt_module;
|
||||||
|
|
||||||
@ -4421,7 +4421,7 @@ getLibvirtModuleObject (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
getLibvirtDictObject (void) {
|
getLibvirtDictObject(void) {
|
||||||
if (libvirt_dict)
|
if (libvirt_dict)
|
||||||
return libvirt_dict;
|
return libvirt_dict;
|
||||||
|
|
||||||
@ -4438,7 +4438,7 @@ getLibvirtDictObject (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
getLibvirtDomainClassObject (void) {
|
getLibvirtDomainClassObject(void) {
|
||||||
if (libvirt_dom_class)
|
if (libvirt_dom_class)
|
||||||
return libvirt_dom_class;
|
return libvirt_dom_class;
|
||||||
|
|
||||||
@ -4975,7 +4975,7 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
if (cb) {
|
if (cb) {
|
||||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||||
cb (watch, fd, event, opaque);
|
cb(watch, fd, event, opaque);
|
||||||
LIBVIRT_END_ALLOW_THREADS;
|
LIBVIRT_END_ALLOW_THREADS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5002,7 +5002,7 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
opaque = (void *) PyvirVoidPtr_Get(py_opaque);
|
opaque = (void *) PyvirVoidPtr_Get(py_opaque);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||||
cb (timer, opaque);
|
cb(timer, opaque);
|
||||||
LIBVIRT_END_ALLOW_THREADS;
|
LIBVIRT_END_ALLOW_THREADS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1565,7 +1565,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
|
|||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
for ( ; i >= 0; --i) {
|
for (; i >= 0; --i) {
|
||||||
if (ret[i]) {
|
if (ret[i]) {
|
||||||
virBitmapFree(ret[i]->cpumask);
|
virBitmapFree(ret[i]->cpumask);
|
||||||
VIR_FREE(ret[i]);
|
VIR_FREE(ret[i]);
|
||||||
@ -1596,7 +1596,7 @@ virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
|
|||||||
if (!def || !nvcpupin)
|
if (!def || !nvcpupin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(i = 0; i < nvcpupin; i++) {
|
for (i = 0; i < nvcpupin; i++) {
|
||||||
virDomainVcpuPinDefFree(def[i]);
|
virDomainVcpuPinDefFree(def[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3305,7 +3305,7 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* Checking missing model information */
|
/* Checking missing model information */
|
||||||
if (def->nseclabels > 1) {
|
if (def->nseclabels > 1) {
|
||||||
for(; n; n--) {
|
for (; n; n--) {
|
||||||
if (def->seclabels[n - 1]->model == NULL) {
|
if (def->seclabels[n - 1]->model == NULL) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing security model "
|
_("missing security model "
|
||||||
@ -4898,14 +4898,14 @@ virDomainNetDefParseXML(virCapsPtr caps,
|
|||||||
} else if (!script &&
|
} else if (!script &&
|
||||||
xmlStrEqual(cur->name, BAD_CAST "script")) {
|
xmlStrEqual(cur->name, BAD_CAST "script")) {
|
||||||
script = virXMLPropString(cur, "path");
|
script = virXMLPropString(cur, "path");
|
||||||
} else if (xmlStrEqual (cur->name, BAD_CAST "model")) {
|
} else if (xmlStrEqual(cur->name, BAD_CAST "model")) {
|
||||||
model = virXMLPropString(cur, "type");
|
model = virXMLPropString(cur, "type");
|
||||||
} else if (xmlStrEqual (cur->name, BAD_CAST "driver")) {
|
} else if (xmlStrEqual(cur->name, BAD_CAST "driver")) {
|
||||||
backend = virXMLPropString(cur, "name");
|
backend = virXMLPropString(cur, "name");
|
||||||
txmode = virXMLPropString(cur, "txmode");
|
txmode = virXMLPropString(cur, "txmode");
|
||||||
ioeventfd = virXMLPropString(cur, "ioeventfd");
|
ioeventfd = virXMLPropString(cur, "ioeventfd");
|
||||||
event_idx = virXMLPropString(cur, "event_idx");
|
event_idx = virXMLPropString(cur, "event_idx");
|
||||||
} else if (xmlStrEqual (cur->name, BAD_CAST "filterref")) {
|
} else if (xmlStrEqual(cur->name, BAD_CAST "filterref")) {
|
||||||
if (filter) {
|
if (filter) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("Invalid specification of multiple <filterref>s "
|
_("Invalid specification of multiple <filterref>s "
|
||||||
@ -6929,29 +6929,29 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
|
|||||||
char *action = NULL;
|
char *action = NULL;
|
||||||
virDomainWatchdogDefPtr def;
|
virDomainWatchdogDefPtr def;
|
||||||
|
|
||||||
if (VIR_ALLOC (def) < 0) {
|
if (VIR_ALLOC(def) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
model = virXMLPropString (node, "model");
|
model = virXMLPropString(node, "model");
|
||||||
if (model == NULL) {
|
if (model == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("watchdog must contain model name"));
|
_("watchdog must contain model name"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
def->model = virDomainWatchdogModelTypeFromString (model);
|
def->model = virDomainWatchdogModelTypeFromString(model);
|
||||||
if (def->model < 0) {
|
if (def->model < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown watchdog model '%s'"), model);
|
_("unknown watchdog model '%s'"), model);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
action = virXMLPropString (node, "action");
|
action = virXMLPropString(node, "action");
|
||||||
if (action == NULL)
|
if (action == NULL)
|
||||||
def->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
|
def->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
|
||||||
else {
|
else {
|
||||||
def->action = virDomainWatchdogActionTypeFromString (action);
|
def->action = virDomainWatchdogActionTypeFromString(action);
|
||||||
if (def->action < 0) {
|
if (def->action < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown watchdog action '%s'"), action);
|
_("unknown watchdog action '%s'"), action);
|
||||||
@ -6963,13 +6963,13 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE (action);
|
VIR_FREE(action);
|
||||||
VIR_FREE (model);
|
VIR_FREE(model);
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virDomainWatchdogDefFree (def);
|
virDomainWatchdogDefFree(def);
|
||||||
def = NULL;
|
def = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -12952,8 +12952,8 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
|
|||||||
virDomainWatchdogDefPtr def,
|
virDomainWatchdogDefPtr def,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
const char *model = virDomainWatchdogModelTypeToString (def->model);
|
const char *model = virDomainWatchdogModelTypeToString(def->model);
|
||||||
const char *action = virDomainWatchdogActionTypeToString (def->action);
|
const char *action = virDomainWatchdogActionTypeToString(def->action);
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -15371,7 +15371,7 @@ virDomainDeviceDefCopy(virCapsPtr caps,
|
|||||||
char *xmlStr = NULL;
|
char *xmlStr = NULL;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
switch(src->type) {
|
switch (src->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
rc = virDomainDiskDefFormat(&buf, src->data.disk, flags);
|
rc = virDomainDiskDefFormat(&buf, src->data.disk, flags);
|
||||||
break;
|
break;
|
||||||
|
@ -355,7 +355,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Check incoming */
|
/* Check incoming */
|
||||||
if ( !cbList ) {
|
if (!cbList) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
VIR_ENUM_IMPL(virInterface,
|
VIR_ENUM_IMPL(virInterface,
|
||||||
VIR_INTERFACE_TYPE_LAST,
|
VIR_INTERFACE_TYPE_LAST,
|
||||||
"ethernet", "bridge", "bond", "vlan" )
|
"ethernet", "bridge", "bond", "vlan")
|
||||||
|
|
||||||
static virInterfaceDefPtr
|
static virInterfaceDefPtr
|
||||||
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
|
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
|
||||||
|
@ -1376,7 +1376,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
|
|
||||||
forwardDev = virXPathString("string(./@dev)", ctxt);
|
forwardDev = virXPathString("string(./@dev)", ctxt);
|
||||||
forwardManaged = virXPathString("string(./@managed)", ctxt);
|
forwardManaged = virXPathString("string(./@managed)", ctxt);
|
||||||
if(forwardManaged != NULL) {
|
if (forwardManaged != NULL) {
|
||||||
if (STRCASEEQ(forwardManaged, "yes"))
|
if (STRCASEEQ(forwardManaged, "yes"))
|
||||||
def->managed = 1;
|
def->managed = 1;
|
||||||
}
|
}
|
||||||
@ -3124,8 +3124,8 @@ void virNetworkObjUnlock(virNetworkObjPtr obj)
|
|||||||
|
|
||||||
#define MATCH(FLAG) (flags & (FLAG))
|
#define MATCH(FLAG) (flags & (FLAG))
|
||||||
static bool
|
static bool
|
||||||
virNetworkMatch (virNetworkObjPtr netobj,
|
virNetworkMatch(virNetworkObjPtr netobj,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
/* filter by active state */
|
/* filter by active state */
|
||||||
if (MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) &&
|
if (MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) &&
|
||||||
|
@ -135,7 +135,7 @@ static const struct int_map chain_priorities[] = {
|
|||||||
INTMAP_ENTRY(NWFILTER_VLAN_FILTER_PRI, "vlan"),
|
INTMAP_ENTRY(NWFILTER_VLAN_FILTER_PRI, "vlan"),
|
||||||
INTMAP_ENTRY(NWFILTER_IPV4_FILTER_PRI, "ipv4"),
|
INTMAP_ENTRY(NWFILTER_IPV4_FILTER_PRI, "ipv4"),
|
||||||
INTMAP_ENTRY(NWFILTER_IPV6_FILTER_PRI, "ipv6"),
|
INTMAP_ENTRY(NWFILTER_IPV6_FILTER_PRI, "ipv6"),
|
||||||
INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp" ),
|
INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp"),
|
||||||
INTMAP_ENTRY(NWFILTER_RARP_FILTER_PRI, "rarp"),
|
INTMAP_ENTRY(NWFILTER_RARP_FILTER_PRI, "rarp"),
|
||||||
INTMAP_ENTRY_LAST,
|
INTMAP_ENTRY_LAST,
|
||||||
};
|
};
|
||||||
@ -259,8 +259,8 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
while (intmap[i].val && !found) {
|
while (intmap[i].val && !found) {
|
||||||
if ( (casecmp && STRCASEEQ(intmap[i].val, str)) ||
|
if ((casecmp && STRCASEEQ(intmap[i].val, str)) ||
|
||||||
STREQ (intmap[i].val, str) ) {
|
STREQ(intmap[i].val, str)) {
|
||||||
*result = intmap[i].attr;
|
*result = intmap[i].attr;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -938,7 +938,7 @@ tcpFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
|
|||||||
*sep = '\0';
|
*sep = '\0';
|
||||||
|
|
||||||
if (parseStringItems(tcpFlags, s_mask , &mask , ',') == 0 &&
|
if (parseStringItems(tcpFlags, s_mask , &mask , ',') == 0 &&
|
||||||
parseStringItems(tcpFlags, s_flags, &flags, ',') == 0 ) {
|
parseStringItems(tcpFlags, s_flags, &flags, ',') == 0) {
|
||||||
item->u.tcpFlags.mask = mask & 0x3f;
|
item->u.tcpFlags.mask = mask & 0x3f;
|
||||||
item->u.tcpFlags.flags = flags & 0x3f;
|
item->u.tcpFlags.flags = flags & 0x3f;
|
||||||
rc = true;
|
rc = true;
|
||||||
|
@ -492,7 +492,7 @@ PowerPCDecode(virCPUDefPtr cpu,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
VIR_FREE(cpuCandidate);
|
VIR_FREE(cpuCandidate);
|
||||||
goto out;
|
goto out;
|
||||||
}else if(ret == 1) {
|
} else if (ret == 1) {
|
||||||
cpuCandidate->model = cpu_model;
|
cpuCandidate->model = cpu_model;
|
||||||
cpuCandidate->vendor = cpu_vendor;
|
cpuCandidate->vendor = cpu_vendor;
|
||||||
virCPUDefFree(cpuModel);
|
virCPUDefFree(cpuModel);
|
||||||
@ -530,7 +530,7 @@ out:
|
|||||||
static uint32_t ppc_mfpvr(void)
|
static uint32_t ppc_mfpvr(void)
|
||||||
{
|
{
|
||||||
uint32_t pvr;
|
uint32_t pvr;
|
||||||
asm ("mfpvr %0"
|
asm("mfpvr %0"
|
||||||
: "=r"(pvr));
|
: "=r"(pvr));
|
||||||
return pvr;
|
return pvr;
|
||||||
}
|
}
|
||||||
|
@ -548,16 +548,16 @@ x86VendorLoad(xmlXPathContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vendor->cpuid.function = 0;
|
vendor->cpuid.function = 0;
|
||||||
vendor->cpuid.ebx = (string[0] ) |
|
vendor->cpuid.ebx = (string[0]) |
|
||||||
(string[1] << 8) |
|
(string[1] << 8) |
|
||||||
(string[2] << 16) |
|
(string[2] << 16) |
|
||||||
(string[3] << 24);
|
(string[3] << 24);
|
||||||
vendor->cpuid.edx = (string[4] ) |
|
vendor->cpuid.edx = (string[4]) |
|
||||||
(string[5] << 8) |
|
(string[5] << 8) |
|
||||||
(string[6] << 16) |
|
(string[6] << 16) |
|
||||||
(string[7] << 24);
|
(string[7] << 24);
|
||||||
vendor->cpuid.ecx = (string[8] ) |
|
vendor->cpuid.ecx = (string[8]) |
|
||||||
(string[9] << 8) |
|
(string[9] << 8) |
|
||||||
(string[10] << 16) |
|
(string[10] << 16) |
|
||||||
(string[11] << 24);
|
(string[11] << 24);
|
||||||
|
|
||||||
|
@ -3769,7 +3769,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spec->cpuAllocation->reservation->value = params[i].value.l;
|
spec->cpuAllocation->reservation->value = params[i].value.l;
|
||||||
} else if(STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_LIMIT)) {
|
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_LIMIT)) {
|
||||||
if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
|
if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -3783,7 +3783,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spec->cpuAllocation->limit->value = params[i].value.l;
|
spec->cpuAllocation->limit->value = params[i].value.l;
|
||||||
} else if(STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_SHARES)) {
|
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_SHARES)) {
|
||||||
if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 ||
|
if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 ||
|
||||||
esxVI_Int_Alloc(&sharesInfo->shares) < 0) {
|
esxVI_Int_Alloc(&sharesInfo->shares) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -2440,7 +2440,7 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!inverse && powerState_ == powerState) ||
|
if ((!inverse && powerState_ == powerState) ||
|
||||||
( inverse && powerState_ != powerState)) {
|
(inverse && powerState_ != powerState)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,7 +242,7 @@
|
|||||||
esxVI_##_type##_Serialize(esxVI_##_type *item, \
|
esxVI_##_type##_Serialize(esxVI_##_type *item, \
|
||||||
const char *element, virBufferPtr output) \
|
const char *element, virBufferPtr output) \
|
||||||
{ \
|
{ \
|
||||||
if (element == NULL || output == NULL ) { \
|
if (element == NULL || output == NULL) { \
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||||
_("Invalid argument")); \
|
_("Invalid argument")); \
|
||||||
return -1; \
|
return -1; \
|
||||||
|
@ -165,7 +165,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
ws_xml_destroy_doc(response);
|
ws_xml_destroy_doc(response);
|
||||||
response = NULL;
|
response = NULL;
|
||||||
|
|
||||||
while (enumContext != NULL && *enumContext != '\0' ) {
|
while (enumContext != NULL && *enumContext != '\0') {
|
||||||
response = wsmc_action_pull(priv->client, resourceUri, options,
|
response = wsmc_action_pull(priv->client, resourceUri, options,
|
||||||
filter, enumContext);
|
filter, enumContext);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ netcf_error:
|
|||||||
{
|
{
|
||||||
ncf_close(driverState->netcf);
|
ncf_close(driverState->netcf);
|
||||||
}
|
}
|
||||||
virMutexDestroy (&driverState->lock);
|
virMutexDestroy(&driverState->lock);
|
||||||
mutex_error:
|
mutex_error:
|
||||||
VIR_FREE(driverState);
|
VIR_FREE(driverState);
|
||||||
alloc_error:
|
alloc_error:
|
||||||
|
746
src/libvirt.c
746
src/libvirt.c
File diff suppressed because it is too large
Load Diff
@ -372,7 +372,7 @@ libxlMakeDomCreateInfo(virDomainDefPtr def, libxl_domain_create_info *c_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
virUUIDFormat(def->uuid, uuidstr);
|
||||||
if (libxl_uuid_from_string(&c_info->uuid, uuidstr) ) {
|
if (libxl_uuid_from_string(&c_info->uuid, uuidstr)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("libxenlight failed to parse UUID '%s'"), uuidstr);
|
_("libxenlight failed to parse UUID '%s'"), uuidstr);
|
||||||
goto error;
|
goto error;
|
||||||
@ -920,7 +920,7 @@ libxlMakeCapabilities(libxl_ctx *ctx)
|
|||||||
const libxl_version_info *ver_info;
|
const libxl_version_info *ver_info;
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
|
|
||||||
regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||||
|
|
||||||
if (libxl_get_physinfo(ctx, &phy_info) != 0) {
|
if (libxl_get_physinfo(ctx, &phy_info) != 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
@ -659,7 +659,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
|||||||
|
|
||||||
memset(&d_config, 0, sizeof(d_config));
|
memset(&d_config, 0, sizeof(d_config));
|
||||||
|
|
||||||
if (libxlBuildDomainConfig(driver, vm->def, &d_config) < 0 )
|
if (libxlBuildDomainConfig(driver, vm->def, &d_config) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (libxlFreeMem(priv, &d_config) < 0) {
|
if (libxlFreeMem(priv, &d_config) < 0) {
|
||||||
@ -3562,7 +3562,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
|
|||||||
|
|
||||||
if (nparams)
|
if (nparams)
|
||||||
*nparams = 0;
|
*nparams = 0;
|
||||||
switch(sched_id) {
|
switch (sched_id) {
|
||||||
case XEN_SCHEDULER_SEDF:
|
case XEN_SCHEDULER_SEDF:
|
||||||
ret = strdup("sedf");
|
ret = strdup("sedf");
|
||||||
break;
|
break;
|
||||||
|
@ -164,8 +164,8 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
|||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "group");
|
p = virConfGetValue(conf, "group");
|
||||||
CHECK_TYPE ("group", VIR_CONF_STRING);
|
CHECK_TYPE("group", VIR_CONF_STRING);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (!(tmp = strdup(p->str))) {
|
if (!(tmp = strdup(p->str))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
@ -184,7 +184,7 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
|||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
/* Avoid error from non-existant or unreadable file. */
|
/* Avoid error from non-existant or unreadable file. */
|
||||||
if (access (filename, R_OK) == -1)
|
if (access(filename, R_OK) == -1)
|
||||||
goto done;
|
goto done;
|
||||||
conf = virConfReadFile(filename, 0);
|
conf = virConfReadFile(filename, 0);
|
||||||
if (!conf)
|
if (!conf)
|
||||||
@ -199,11 +199,11 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue(conf, "log_with_libvirtd");
|
p = virConfGetValue(conf, "log_with_libvirtd");
|
||||||
CHECK_TYPE ("log_with_libvirtd", VIR_CONF_LONG);
|
CHECK_TYPE("log_with_libvirtd", VIR_CONF_LONG);
|
||||||
if (p) driver->log_libvirtd = p->l;
|
if (p) driver->log_libvirtd = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_driver");
|
p = virConfGetValue(conf, "security_driver");
|
||||||
CHECK_TYPE ("security_driver", VIR_CONF_STRING);
|
CHECK_TYPE("security_driver", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
if (!(driver->securityDriverName = strdup(p->str))) {
|
if (!(driver->securityDriverName = strdup(p->str))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -212,12 +212,12 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_default_confined");
|
p = virConfGetValue(conf, "security_default_confined");
|
||||||
CHECK_TYPE ("security_default_confined", VIR_CONF_LONG);
|
CHECK_TYPE("security_default_confined", VIR_CONF_LONG);
|
||||||
if (p) driver->securityDefaultConfined = p->l;
|
if (p) driver->securityDefaultConfined = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_require_confined");
|
p = virConfGetValue(conf, "security_require_confined");
|
||||||
CHECK_TYPE ("security_require_confined", VIR_CONF_LONG);
|
CHECK_TYPE("security_require_confined", VIR_CONF_LONG);
|
||||||
if (p) driver->securityRequireConfined = p->l;
|
if (p) driver->securityRequireConfined = p->l;
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static int lxcContainerSetStdio(int control, int ttyfd, int handshakefd)
|
|||||||
|
|
||||||
/* Just in case someone forget to set FD_CLOEXEC, explicitly
|
/* Just in case someone forget to set FD_CLOEXEC, explicitly
|
||||||
* close all FDs before executing the container */
|
* close all FDs before executing the container */
|
||||||
open_max = sysconf (_SC_OPEN_MAX);
|
open_max = sysconf(_SC_OPEN_MAX);
|
||||||
for (i = 0; i < open_max; i++)
|
for (i = 0; i < open_max; i++)
|
||||||
if (i != ttyfd && i != control && i != handshakefd) {
|
if (i != ttyfd && i != control && i != handshakefd) {
|
||||||
int tmpfd = i;
|
int tmpfd = i;
|
||||||
@ -1456,7 +1456,7 @@ static int lxcContainerMountCGroups(struct lxcContainerCGroup *mounts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virAsprintf(&opts,
|
if (virAsprintf(&opts,
|
||||||
"mode=755,size=65536%s",(sec_mount_options ? sec_mount_options : "")) < 0 ) {
|
"mode=755,size=65536%s",(sec_mount_options ? sec_mount_options : "")) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1721,7 +1721,7 @@ static int lxcContainerDropCapabilities(bool keepReboot ATTRIBUTE_UNUSED)
|
|||||||
CAP_AUDIT_CONTROL, /* No messing with auditing status */
|
CAP_AUDIT_CONTROL, /* No messing with auditing status */
|
||||||
CAP_MAC_ADMIN, /* No messing with LSM config */
|
CAP_MAC_ADMIN, /* No messing with LSM config */
|
||||||
keepReboot ? -1 : CAP_SYS_BOOT, /* No use of reboot */
|
keepReboot ? -1 : CAP_SYS_BOOT, /* No use of reboot */
|
||||||
-1 /* sentinal */)) < 0) {
|
-1)) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to remove capabilities: %d"), ret);
|
_("Failed to remove capabilities: %d"), ret);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1758,7 +1758,7 @@ static int lxcContainerDropCapabilities(bool keepReboot ATTRIBUTE_UNUSED)
|
|||||||
*
|
*
|
||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int lxcContainerChild( void *data )
|
static int lxcContainerChild(void *data)
|
||||||
{
|
{
|
||||||
lxc_child_argv_t *argv = data;
|
lxc_child_argv_t *argv = data;
|
||||||
virDomainDefPtr vmDef = argv->config;
|
virDomainDefPtr vmDef = argv->config;
|
||||||
|
@ -878,7 +878,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
virTypedParameterPtr param = ¶ms[i];
|
virTypedParameterPtr param = ¶ms[i];
|
||||||
val = 0;
|
val = 0;
|
||||||
|
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 0: /* fill memory hard limit here */
|
case 0: /* fill memory hard limit here */
|
||||||
rc = virCgroupGetMemoryHardLimit(cgroup, &val);
|
rc = virCgroupGetMemoryHardLimit(cgroup, &val);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
@ -350,7 +350,7 @@ networkStartup(int privileged) {
|
|||||||
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
} else {
|
} else {
|
||||||
char *userdir = virGetUserCacheDirectory();
|
char *userdir = virGetUserCacheDirectory();
|
||||||
@ -2037,7 +2037,7 @@ networkCheckRouteCollision(virNetworkObjPtr network)
|
|||||||
|
|
||||||
VIR_DEBUG("%s output:\n%s", PROC_NET_ROUTE, buf);
|
VIR_DEBUG("%s output:\n%s", PROC_NET_ROUTE, buf);
|
||||||
|
|
||||||
if (!STRPREFIX (buf, "Iface"))
|
if (!STRPREFIX(buf, "Iface"))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* First line is just headings, skip it */
|
/* First line is just headings, skip it */
|
||||||
@ -3366,7 +3366,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef) {
|
|||||||
(netdef->forwardType == VIR_NETWORK_FORWARD_VEPA) ||
|
(netdef->forwardType == VIR_NETWORK_FORWARD_VEPA) ||
|
||||||
(netdef->forwardType == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
|
(netdef->forwardType == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
|
||||||
netdef->forwardIfs[ii].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
|
netdef->forwardIfs[ii].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
|
||||||
if(vfname[ii]) {
|
if (vfname[ii]) {
|
||||||
netdef->forwardIfs[ii].device.dev = strdup(vfname[ii]);
|
netdef->forwardIfs[ii].device.dev = strdup(vfname[ii]);
|
||||||
if (!netdef->forwardIfs[ii].device.dev) {
|
if (!netdef->forwardIfs[ii].device.dev) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
@ -1005,7 +1005,7 @@ static int udevProcessStorage(struct udev_device *device,
|
|||||||
const char* devnode;
|
const char* devnode;
|
||||||
|
|
||||||
devnode = udev_device_get_devnode(device);
|
devnode = udev_device_get_devnode(device);
|
||||||
if(!devnode) {
|
if (!devnode) {
|
||||||
VIR_DEBUG("No devnode for '%s'", udev_device_get_devpath(device));
|
VIR_DEBUG("No devnode for '%s'", udev_device_get_devpath(device));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -839,7 +839,7 @@ int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Convert to KB. */
|
/* Convert to KB. */
|
||||||
nodeinfo->memory = physmem_total () / 1024;
|
nodeinfo->memory = physmem_total() / 1024;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_FCLOSE(cpuinfo);
|
VIR_FORCE_FCLOSE(cpuinfo);
|
||||||
@ -1161,7 +1161,7 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
for (i = 0; i < *nparams && i < NODE_MEMORY_PARAMETERS_NUM; i++) {
|
for (i = 0; i < *nparams && i < NODE_MEMORY_PARAMETERS_NUM; i++) {
|
||||||
virTypedParameterPtr param = ¶ms[i];
|
virTypedParameterPtr param = ¶ms[i];
|
||||||
|
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
if (nodeGetMemoryParameterValue("pages_to_scan",
|
if (nodeGetMemoryParameterValue("pages_to_scan",
|
||||||
&pages_to_scan) < 0)
|
&pages_to_scan) < 0)
|
||||||
|
@ -1640,7 +1640,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check that all tools are available for applying the filters (late) */
|
/* check that all tools are available for applying the filters (late) */
|
||||||
if ( !techdriver->canApplyBasicRules()) {
|
if (!techdriver->canApplyBasicRules()) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("IP parameter must be provided since "
|
_("IP parameter must be provided since "
|
||||||
"snooping the IP address does not work "
|
"snooping the IP address does not work "
|
||||||
|
@ -216,7 +216,7 @@ nwfilterDriverStartup(int privileged)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
} else {
|
} else {
|
||||||
base = virGetUserConfigDirectory();
|
base = virGetUserConfigDirectory();
|
||||||
|
@ -898,7 +898,7 @@ iptablesRenameTmpRootChain(virBufferPtr buf,
|
|||||||
};
|
};
|
||||||
|
|
||||||
PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
||||||
PRINT_IPT_ROOT_CHAIN( chain, chainPrefix, ifname);
|
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||||
|
|
||||||
virBufferAsprintf(buf,
|
virBufferAsprintf(buf,
|
||||||
"$IPT -E %s %s" CMD_SEPARATOR,
|
"$IPT -E %s %s" CMD_SEPARATOR,
|
||||||
@ -2141,14 +2141,14 @@ ebtablesCreateRuleInstance(char chainPrefix,
|
|||||||
INST_ITEM(stpHdrFilter, dataFlags, "--stp-flags")
|
INST_ITEM(stpHdrFilter, dataFlags, "--stp-flags")
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataRootPri, dataRootPriHi,
|
INST_ITEM_RANGE(stpHdrFilter, dataRootPri, dataRootPriHi,
|
||||||
"--stp-root-pri");
|
"--stp-root-pri");
|
||||||
INST_ITEM_MASK( stpHdrFilter, dataRootAddr, dataRootAddrMask,
|
INST_ITEM_MASK(stpHdrFilter, dataRootAddr, dataRootAddrMask,
|
||||||
"--stp-root-addr");
|
"--stp-root-addr");
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataRootCost, dataRootCostHi,
|
INST_ITEM_RANGE(stpHdrFilter, dataRootCost, dataRootCostHi,
|
||||||
"--stp-root-cost");
|
"--stp-root-cost");
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataSndrPrio, dataSndrPrioHi,
|
INST_ITEM_RANGE(stpHdrFilter, dataSndrPrio, dataSndrPrioHi,
|
||||||
"--stp-sender-prio");
|
"--stp-sender-prio");
|
||||||
INST_ITEM_MASK( stpHdrFilter, dataSndrAddr, dataSndrAddrMask,
|
INST_ITEM_MASK(stpHdrFilter, dataSndrAddr, dataSndrAddrMask,
|
||||||
"--stp-sender-addr");
|
"--stp-sender-addr");
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataPort, dataPortHi, "--stp-port");
|
INST_ITEM_RANGE(stpHdrFilter, dataPort, dataPortHi, "--stp-port");
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataAge, dataAgeHi, "--stp-msg-age");
|
INST_ITEM_RANGE(stpHdrFilter, dataAge, dataAgeHi, "--stp-msg-age");
|
||||||
INST_ITEM_RANGE(stpHdrFilter, dataMaxAge, dataMaxAgeHi,
|
INST_ITEM_RANGE(stpHdrFilter, dataMaxAge, dataMaxAgeHi,
|
||||||
@ -3093,10 +3093,10 @@ ebtablesRenameTmpSubChain(virBufferPtr buf,
|
|||||||
|
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
|
PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
|
||||||
PRINT_CHAIN( chain, chainPrefix, ifname, protocol);
|
PRINT_CHAIN(chain, chainPrefix, ifname, protocol);
|
||||||
} else {
|
} else {
|
||||||
PRINT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
PRINT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
||||||
PRINT_ROOT_CHAIN( chain, chainPrefix, ifname);
|
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf,
|
virBufferAsprintf(buf,
|
||||||
@ -3571,7 +3571,7 @@ iptablesCheckBridgeNFCallEnabled(bool isIPv6)
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
if (isIPv6 &&
|
if (isIPv6 &&
|
||||||
(now - lastReportIPv6) > BRIDGE_NF_CALL_ALERT_INTERVAL ) {
|
(now - lastReportIPv6) > BRIDGE_NF_CALL_ALERT_INTERVAL) {
|
||||||
pathname = PROC_BRIDGE_NF_CALL_IP6TABLES;
|
pathname = PROC_BRIDGE_NF_CALL_IP6TABLES;
|
||||||
} else if (now - lastReport > BRIDGE_NF_CALL_ALERT_INTERVAL) {
|
} else if (now - lastReport > BRIDGE_NF_CALL_ALERT_INTERVAL) {
|
||||||
pathname = PROC_BRIDGE_NF_CALL_IPTABLES;
|
pathname = PROC_BRIDGE_NF_CALL_IPTABLES;
|
||||||
@ -3686,7 +3686,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||||||
|
|
||||||
/* scan the rules to see which chains need to be created */
|
/* scan the rules to see which chains need to be created */
|
||||||
for (i = 0; i < nruleInstances; i++) {
|
for (i = 0; i < nruleInstances; i++) {
|
||||||
sa_assert (inst);
|
sa_assert(inst);
|
||||||
if (inst[i]->ruleType == RT_EBTABLES) {
|
if (inst[i]->ruleType == RT_EBTABLES) {
|
||||||
const char *name = inst[i]->neededProtocolChain;
|
const char *name = inst[i]->neededProtocolChain;
|
||||||
if (inst[i]->chainprefix == CHAINPREFIX_HOST_IN_TEMP) {
|
if (inst[i]->chainprefix == CHAINPREFIX_HOST_IN_TEMP) {
|
||||||
@ -3743,7 +3743,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||||||
commands for creating and connecting ebtables chains */
|
commands for creating and connecting ebtables chains */
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < nruleInstances; i++) {
|
for (i = 0; i < nruleInstances; i++) {
|
||||||
sa_assert (inst);
|
sa_assert(inst);
|
||||||
switch (inst[i]->ruleType) {
|
switch (inst[i]->ruleType) {
|
||||||
case RT_EBTABLES:
|
case RT_EBTABLES:
|
||||||
while (j < nEbtChains &&
|
while (j < nEbtChains &&
|
||||||
@ -3801,7 +3801,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||||||
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
||||||
|
|
||||||
for (i = 0; i < nruleInstances; i++) {
|
for (i = 0; i < nruleInstances; i++) {
|
||||||
sa_assert (inst);
|
sa_assert(inst);
|
||||||
if (inst[i]->ruleType == RT_IPTABLES)
|
if (inst[i]->ruleType == RT_IPTABLES)
|
||||||
iptablesInstCommand(&buf,
|
iptablesInstCommand(&buf,
|
||||||
inst[i]->commandTemplate,
|
inst[i]->commandTemplate,
|
||||||
@ -4079,7 +4079,7 @@ ebiptablesAllTeardown(const char *ifname)
|
|||||||
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
||||||
|
|
||||||
iptablesUnlinkRootChains(&buf, ifname);
|
iptablesUnlinkRootChains(&buf, ifname);
|
||||||
iptablesClearVirtInPost (&buf, ifname);
|
iptablesClearVirtInPost(&buf, ifname);
|
||||||
iptablesRemoveRootChains(&buf, ifname);
|
iptablesRemoveRootChains(&buf, ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4087,7 +4087,7 @@ ebiptablesAllTeardown(const char *ifname)
|
|||||||
NWFILTER_SET_IP6TABLES_SHELLVAR(&buf);
|
NWFILTER_SET_IP6TABLES_SHELLVAR(&buf);
|
||||||
|
|
||||||
iptablesUnlinkRootChains(&buf, ifname);
|
iptablesUnlinkRootChains(&buf, ifname);
|
||||||
iptablesClearVirtInPost (&buf, ifname);
|
iptablesClearVirtInPost(&buf, ifname);
|
||||||
iptablesRemoveRootChains(&buf, ifname);
|
iptablesRemoveRootChains(&buf, ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ printString(void *payload ATTRIBUTE_UNUSED, const void *name, void *data)
|
|||||||
{
|
{
|
||||||
struct printString *ps = data;
|
struct printString *ps = data;
|
||||||
|
|
||||||
if ((STREQ((char *)name, NWFILTER_STD_VAR_IP ) && !ps->reportIP ) ||
|
if ((STREQ((char *)name, NWFILTER_STD_VAR_IP) && !ps->reportIP) ||
|
||||||
(STREQ((char *)name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC))
|
(STREQ((char *)name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1182,13 +1182,13 @@ virNWFilterDomainFWUpdateCB(void *payload,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_TEAR_NEW:
|
case STEP_TEAR_NEW:
|
||||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||||
cb->err = virNWFilterRollbackUpdateFilter(net);
|
cb->err = virNWFilterRollbackUpdateFilter(net);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_TEAR_OLD:
|
case STEP_TEAR_OLD:
|
||||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||||
cb->err = virNWFilterTearOldFilter(net);
|
cb->err = virNWFilterTearOldFilter(net);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -504,8 +504,8 @@ learnIPAddressThread(void *arg)
|
|||||||
/* skip mcast addresses (224.0.0.0 - 239.255.255.255),
|
/* skip mcast addresses (224.0.0.0 - 239.255.255.255),
|
||||||
* class E (240.0.0.0 - 255.255.255.255, includes eth.
|
* class E (240.0.0.0 - 255.255.255.255, includes eth.
|
||||||
* bcast) and zero address in DHCP Requests */
|
* bcast) and zero address in DHCP Requests */
|
||||||
if ( (ntohl(vmaddr) & 0xe0000000) == 0xe0000000 ||
|
if ((ntohl(vmaddr) & 0xe0000000) == 0xe0000000 ||
|
||||||
vmaddr == 0) {
|
vmaddr == 0) {
|
||||||
vmaddr = 0;
|
vmaddr = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||||||
if (howDetect == 0)
|
if (howDetect == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !techdriver->canApplyBasicRules()) {
|
if (!techdriver->canApplyBasicRules()) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("IP parameter must be provided since "
|
_("IP parameter must be provided since "
|
||||||
"snooping the IP address does not work "
|
"snooping the IP address does not work "
|
||||||
|
@ -285,7 +285,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
|||||||
|
|
||||||
/*parse string*/
|
/*parse string*/
|
||||||
do {
|
do {
|
||||||
char *next = strchrnul (p, ',');
|
char *next = strchrnul(p, ',');
|
||||||
if (STRPREFIX(p, "ifname=")) {
|
if (STRPREFIX(p, "ifname=")) {
|
||||||
/* skip in libvirt */
|
/* skip in libvirt */
|
||||||
} else if (STRPREFIX(p, "host_ifname=")) {
|
} else if (STRPREFIX(p, "host_ifname=")) {
|
||||||
@ -456,7 +456,7 @@ openvzReadFSConf(virDomainDefPtr def,
|
|||||||
} else {
|
} else {
|
||||||
/* Ensure that we can multiply by 1024 without overflowing. */
|
/* Ensure that we can multiply by 1024 without overflowing. */
|
||||||
if (barrier > ULLONG_MAX / 1024 ||
|
if (barrier > ULLONG_MAX / 1024 ||
|
||||||
limit > ULLONG_MAX / 1024 ) {
|
limit > ULLONG_MAX / 1024) {
|
||||||
virReportSystemError(VIR_ERR_OVERFLOW, "%s",
|
virReportSystemError(VIR_ERR_OVERFLOW, "%s",
|
||||||
_("Unable to parse quota"));
|
_("Unable to parse quota"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -985,7 +985,7 @@ openvz_readline(int fd, char *ptr, int maxlen)
|
|||||||
char c;
|
char c;
|
||||||
|
|
||||||
for (n = 1; n < maxlen; n++) {
|
for (n = 1; n < maxlen; n++) {
|
||||||
if ( (rc = read(fd, &c, 1)) == 1) {
|
if ((rc = read(fd, &c, 1)) == 1) {
|
||||||
*ptr++ = c;
|
*ptr++ = c;
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
break;
|
break;
|
||||||
|
@ -1403,7 +1403,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
|||||||
} else {
|
} else {
|
||||||
/* If scheme isn't 'openvz', then its for another driver */
|
/* If scheme isn't 'openvz', then its for another driver */
|
||||||
if (conn->uri->scheme == NULL ||
|
if (conn->uri->scheme == NULL ||
|
||||||
STRNEQ (conn->uri->scheme, "openvz"))
|
STRNEQ(conn->uri->scheme, "openvz"))
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
/* If server name is given, its for remote driver */
|
/* If server name is given, its for remote driver */
|
||||||
@ -1412,7 +1412,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
/* If path isn't /system, then they typoed, so tell them correct path */
|
/* If path isn't /system, then they typoed, so tell them correct path */
|
||||||
if (conn->uri->path == NULL ||
|
if (conn->uri->path == NULL ||
|
||||||
STRNEQ (conn->uri->path, "/system")) {
|
STRNEQ(conn->uri->path, "/system")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected OpenVZ URI path '%s', try openvz:///system"),
|
_("unexpected OpenVZ URI path '%s', try openvz:///system"),
|
||||||
conn->uri->path);
|
conn->uri->path);
|
||||||
@ -1601,7 +1601,7 @@ out:
|
|||||||
VIR_FORCE_CLOSE(outfd);
|
VIR_FORCE_CLOSE(outfd);
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
for ( ; got >= 0 ; got--)
|
for (; got >= 0 ; got--)
|
||||||
VIR_FREE(names[got]);
|
VIR_FREE(names[got]);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -1636,8 +1636,8 @@ Version: 2.2
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf (line, "%d %llu %llu %llu",
|
if (sscanf(line, "%d %llu %llu %llu",
|
||||||
&readvps, &usertime, &nicetime, &systime) == 4
|
&readvps, &usertime, &nicetime, &systime) == 4
|
||||||
&& readvps == vpsid) { /*found vpsid*/
|
&& readvps == vpsid) { /*found vpsid*/
|
||||||
/* convert jiffies to nanoseconds */
|
/* convert jiffies to nanoseconds */
|
||||||
*cpuTime = (1000ull * 1000ull * 1000ull
|
*cpuTime = (1000ull * 1000ull * 1000ull
|
||||||
@ -1942,9 +1942,9 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
openvzDomainInterfaceStats (virDomainPtr dom,
|
openvzDomainInterfaceStats(virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainInterfaceStats *stats)
|
struct _virDomainInterfaceStats *stats)
|
||||||
{
|
{
|
||||||
struct openvz_driver *driver = dom->conn->privateData;
|
struct openvz_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -1972,7 +1972,7 @@ openvzDomainInterfaceStats (virDomainPtr dom,
|
|||||||
/* Check the path is one of the domain's network interfaces. */
|
/* Check the path is one of the domain's network interfaces. */
|
||||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||||
if (vm->def->nets[i]->ifname &&
|
if (vm->def->nets[i]->ifname &&
|
||||||
STREQ (vm->def->nets[i]->ifname, path)) {
|
STREQ(vm->def->nets[i]->ifname, path)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +1089,7 @@ parallelsDomainGetAutostart(virDomainPtr domain, int *autostart)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (*parallelsChangeStateFunc) (virDomainObjPtr privdom);
|
typedef int (*parallelsChangeStateFunc)(virDomainObjPtr privdom);
|
||||||
#define PARALLELS_UUID(x) (((parallelsDomObjPtr)(x->privateData))->uuid)
|
#define PARALLELS_UUID(x) (((parallelsDomObjPtr)(x->privateData))->uuid)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1283,7 +1283,7 @@ parallelsApplySerialParams(virDomainChrDefPtr *oldserials, int nold,
|
|||||||
!STREQ_NULLABLE(oldserial->source.data.file.path,
|
!STREQ_NULLABLE(oldserial->source.data.file.path,
|
||||||
newserial->source.data.file.path))
|
newserial->source.data.file.path))
|
||||||
goto error;
|
goto error;
|
||||||
if(newserial->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
if (newserial->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
||||||
(!STREQ_NULLABLE(oldserial->source.data.nix.path,
|
(!STREQ_NULLABLE(oldserial->source.data.nix.path,
|
||||||
newserial->source.data.nix.path) ||
|
newserial->source.data.nix.path) ||
|
||||||
oldserial->source.data.nix.listen == newserial->source.data.nix.listen)) {
|
oldserial->source.data.nix.listen == newserial->source.data.nix.listen)) {
|
||||||
|
@ -825,7 +825,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache)
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Really, this never fails - look at the man-page. */
|
/* Really, this never fails - look at the man-page. */
|
||||||
uname (&utsname);
|
uname(&utsname);
|
||||||
|
|
||||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||||
1, 1)) == NULL)
|
1, 1)) == NULL)
|
||||||
@ -1558,7 +1558,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
uname_normalize (struct utsname *ut)
|
uname_normalize(struct utsname *ut)
|
||||||
{
|
{
|
||||||
uname(ut);
|
uname(ut);
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
|||||||
if (vm->def->blkio.weight != 0) {
|
if (vm->def->blkio.weight != 0) {
|
||||||
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
||||||
rc = virCgroupSetBlkioWeight(cgroup, vm->def->blkio.weight);
|
rc = virCgroupSetBlkioWeight(cgroup, vm->def->blkio.weight);
|
||||||
if(rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
_("Unable to set io weight for domain %s"),
|
_("Unable to set io weight for domain %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
@ -391,7 +391,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
|||||||
if (vm->def->cputune.shares != 0) {
|
if (vm->def->cputune.shares != 0) {
|
||||||
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||||
rc = virCgroupSetCpuShares(cgroup, vm->def->cputune.shares);
|
rc = virCgroupSetCpuShares(cgroup, vm->def->cputune.shares);
|
||||||
if(rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
_("Unable to set io cpu shares for domain %s"),
|
_("Unable to set io cpu shares for domain %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
|
@ -122,7 +122,7 @@ VIR_ENUM_IMPL(qemuDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
uname_normalize (struct utsname *ut)
|
uname_normalize(struct utsname *ut)
|
||||||
{
|
{
|
||||||
uname(ut);
|
uname(ut);
|
||||||
|
|
||||||
@ -1837,7 +1837,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf,
|
|||||||
static int
|
static int
|
||||||
qemuSafeSerialParamValue(const char *value)
|
qemuSafeSerialParamValue(const char *value)
|
||||||
{
|
{
|
||||||
if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen (value)) {
|
if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen(value)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("driver serial '%s' contains unsafe characters"),
|
_("driver serial '%s' contains unsafe characters"),
|
||||||
value);
|
value);
|
||||||
@ -2686,9 +2686,9 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
|
|||||||
fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
|
fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
|
||||||
if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
|
if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
|
||||||
virBufferAddLit(&opt, ",security_model=mapped");
|
virBufferAddLit(&opt, ",security_model=mapped");
|
||||||
} else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
|
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
|
||||||
virBufferAddLit(&opt, ",security_model=passthrough");
|
virBufferAddLit(&opt, ",security_model=passthrough");
|
||||||
} else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
|
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
|
||||||
virBufferAddLit(&opt, ",security_model=none");
|
virBufferAddLit(&opt, ",security_model=none");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3631,7 +3631,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
|
|||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
bool telnet;
|
bool telnet;
|
||||||
|
|
||||||
switch(dev->type) {
|
switch (dev->type) {
|
||||||
case VIR_DOMAIN_CHR_TYPE_NULL:
|
case VIR_DOMAIN_CHR_TYPE_NULL:
|
||||||
virBufferAsprintf(&buf, "null,id=char%s", alias);
|
virBufferAsprintf(&buf, "null,id=char%s", alias);
|
||||||
break;
|
break;
|
||||||
@ -5728,7 +5728,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
char *addr;
|
char *addr;
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
switch(channel->targetType) {
|
switch (channel->targetType) {
|
||||||
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
|
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
|
||||||
if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
|
if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
|
||||||
!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||||
@ -5796,7 +5796,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
virDomainChrDefPtr console = def->consoles[i];
|
virDomainChrDefPtr console = def->consoles[i];
|
||||||
char *devstr;
|
char *devstr;
|
||||||
|
|
||||||
switch(console->targetType) {
|
switch (console->targetType) {
|
||||||
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
|
||||||
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
@ -8408,7 +8408,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
|||||||
if (!(def->os.machine = strndup(val, params - val)))
|
if (!(def->os.machine = strndup(val, params - val)))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
while(params++) {
|
while (params++) {
|
||||||
/* prepared for more "-machine" parameters */
|
/* prepared for more "-machine" parameters */
|
||||||
char *tmp = params;
|
char *tmp = params;
|
||||||
params = strchr(params, ',');
|
params = strchr(params, ',');
|
||||||
@ -8581,7 +8581,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
|||||||
}
|
}
|
||||||
} else if (STREQ(arg, "-watchdog")) {
|
} else if (STREQ(arg, "-watchdog")) {
|
||||||
WANT_VALUE();
|
WANT_VALUE();
|
||||||
int model = virDomainWatchdogModelTypeFromString (val);
|
int model = virDomainWatchdogModelTypeFromString(val);
|
||||||
|
|
||||||
if (model != -1) {
|
if (model != -1) {
|
||||||
virDomainWatchdogDefPtr wd;
|
virDomainWatchdogDefPtr wd;
|
||||||
@ -8593,7 +8593,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
|||||||
}
|
}
|
||||||
} else if (STREQ(arg, "-watchdog-action") && def->watchdog) {
|
} else if (STREQ(arg, "-watchdog-action") && def->watchdog) {
|
||||||
WANT_VALUE();
|
WANT_VALUE();
|
||||||
int action = virDomainWatchdogActionTypeFromString (val);
|
int action = virDomainWatchdogActionTypeFromString(val);
|
||||||
|
|
||||||
if (action != -1)
|
if (action != -1)
|
||||||
def->watchdog->action = action;
|
def->watchdog->action = action;
|
||||||
|
@ -134,12 +134,12 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
/* Just check the file is readable before opening it, otherwise
|
/* Just check the file is readable before opening it, otherwise
|
||||||
* libvirt emits an error.
|
* libvirt emits an error.
|
||||||
*/
|
*/
|
||||||
if (access (filename, R_OK) == -1) {
|
if (access(filename, R_OK) == -1) {
|
||||||
VIR_INFO("Could not read qemu config file %s", filename);
|
VIR_INFO("Could not read qemu config file %s", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = virConfReadFile (filename, 0);
|
conf = virConfReadFile(filename, 0);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -153,20 +153,20 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
return -1; \
|
return -1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_auto_unix_socket");
|
p = virConfGetValue(conf, "vnc_auto_unix_socket");
|
||||||
CHECK_TYPE ("vnc_auto_unix_socket", VIR_CONF_LONG);
|
CHECK_TYPE("vnc_auto_unix_socket", VIR_CONF_LONG);
|
||||||
if (p) driver->vncAutoUnixSocket = p->l;
|
if (p) driver->vncAutoUnixSocket = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_tls");
|
p = virConfGetValue(conf, "vnc_tls");
|
||||||
CHECK_TYPE ("vnc_tls", VIR_CONF_LONG);
|
CHECK_TYPE("vnc_tls", VIR_CONF_LONG);
|
||||||
if (p) driver->vncTLS = p->l;
|
if (p) driver->vncTLS = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_tls_x509_verify");
|
p = virConfGetValue(conf, "vnc_tls_x509_verify");
|
||||||
CHECK_TYPE ("vnc_tls_x509_verify", VIR_CONF_LONG);
|
CHECK_TYPE("vnc_tls_x509_verify", VIR_CONF_LONG);
|
||||||
if (p) driver->vncTLSx509verify = p->l;
|
if (p) driver->vncTLSx509verify = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_tls_x509_cert_dir");
|
p = virConfGetValue(conf, "vnc_tls_x509_cert_dir");
|
||||||
CHECK_TYPE ("vnc_tls_x509_cert_dir", VIR_CONF_STRING);
|
CHECK_TYPE("vnc_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->vncTLSx509certdir);
|
VIR_FREE(driver->vncTLSx509certdir);
|
||||||
if (!(driver->vncTLSx509certdir = strdup(p->str))) {
|
if (!(driver->vncTLSx509certdir = strdup(p->str))) {
|
||||||
@ -176,8 +176,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_listen");
|
p = virConfGetValue(conf, "vnc_listen");
|
||||||
CHECK_TYPE ("vnc_listen", VIR_CONF_STRING);
|
CHECK_TYPE("vnc_listen", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->vncListen);
|
VIR_FREE(driver->vncListen);
|
||||||
if (!(driver->vncListen = strdup(p->str))) {
|
if (!(driver->vncListen = strdup(p->str))) {
|
||||||
@ -187,8 +187,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_password");
|
p = virConfGetValue(conf, "vnc_password");
|
||||||
CHECK_TYPE ("vnc_password", VIR_CONF_STRING);
|
CHECK_TYPE("vnc_password", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->vncPassword);
|
VIR_FREE(driver->vncPassword);
|
||||||
if (!(driver->vncPassword = strdup(p->str))) {
|
if (!(driver->vncPassword = strdup(p->str))) {
|
||||||
@ -198,7 +198,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_driver");
|
p = virConfGetValue(conf, "security_driver");
|
||||||
if (p && p->type == VIR_CONF_LIST) {
|
if (p && p->type == VIR_CONF_LIST) {
|
||||||
size_t len;
|
size_t len;
|
||||||
virConfValuePtr pp;
|
virConfValuePtr pp;
|
||||||
@ -228,7 +228,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
driver->securityDriverNames[len] = NULL;
|
driver->securityDriverNames[len] = NULL;
|
||||||
} else {
|
} else {
|
||||||
CHECK_TYPE ("security_driver", VIR_CONF_STRING);
|
CHECK_TYPE("security_driver", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
if (VIR_ALLOC_N(driver->securityDriverNames, 2) < 0 ||
|
if (VIR_ALLOC_N(driver->securityDriverNames, 2) < 0 ||
|
||||||
!(driver->securityDriverNames[0] = strdup(p->str))) {
|
!(driver->securityDriverNames[0] = strdup(p->str))) {
|
||||||
@ -240,21 +240,21 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_default_confined");
|
p = virConfGetValue(conf, "security_default_confined");
|
||||||
CHECK_TYPE ("security_default_confined", VIR_CONF_LONG);
|
CHECK_TYPE("security_default_confined", VIR_CONF_LONG);
|
||||||
if (p) driver->securityDefaultConfined = p->l;
|
if (p) driver->securityDefaultConfined = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "security_require_confined");
|
p = virConfGetValue(conf, "security_require_confined");
|
||||||
CHECK_TYPE ("security_require_confined", VIR_CONF_LONG);
|
CHECK_TYPE("security_require_confined", VIR_CONF_LONG);
|
||||||
if (p) driver->securityRequireConfined = p->l;
|
if (p) driver->securityRequireConfined = p->l;
|
||||||
|
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_sasl");
|
p = virConfGetValue(conf, "vnc_sasl");
|
||||||
CHECK_TYPE ("vnc_sasl", VIR_CONF_LONG);
|
CHECK_TYPE("vnc_sasl", VIR_CONF_LONG);
|
||||||
if (p) driver->vncSASL = p->l;
|
if (p) driver->vncSASL = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_sasl_dir");
|
p = virConfGetValue(conf, "vnc_sasl_dir");
|
||||||
CHECK_TYPE ("vnc_sasl_dir", VIR_CONF_STRING);
|
CHECK_TYPE("vnc_sasl_dir", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->vncSASLdir);
|
VIR_FREE(driver->vncSASLdir);
|
||||||
if (!(driver->vncSASLdir = strdup(p->str))) {
|
if (!(driver->vncSASLdir = strdup(p->str))) {
|
||||||
@ -264,12 +264,12 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "spice_tls");
|
p = virConfGetValue(conf, "spice_tls");
|
||||||
CHECK_TYPE ("spice_tls", VIR_CONF_LONG);
|
CHECK_TYPE("spice_tls", VIR_CONF_LONG);
|
||||||
if (p) driver->spiceTLS = p->l;
|
if (p) driver->spiceTLS = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "spice_tls_x509_cert_dir");
|
p = virConfGetValue(conf, "spice_tls_x509_cert_dir");
|
||||||
CHECK_TYPE ("spice_tls_x509_cert_dir", VIR_CONF_STRING);
|
CHECK_TYPE("spice_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->spiceTLSx509certdir);
|
VIR_FREE(driver->spiceTLSx509certdir);
|
||||||
if (!(driver->spiceTLSx509certdir = strdup(p->str))) {
|
if (!(driver->spiceTLSx509certdir = strdup(p->str))) {
|
||||||
@ -279,8 +279,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "spice_listen");
|
p = virConfGetValue(conf, "spice_listen");
|
||||||
CHECK_TYPE ("spice_listen", VIR_CONF_STRING);
|
CHECK_TYPE("spice_listen", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->spiceListen);
|
VIR_FREE(driver->spiceListen);
|
||||||
if (!(driver->spiceListen = strdup(p->str))) {
|
if (!(driver->spiceListen = strdup(p->str))) {
|
||||||
@ -290,8 +290,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "spice_password");
|
p = virConfGetValue(conf, "spice_password");
|
||||||
CHECK_TYPE ("spice_password", VIR_CONF_STRING);
|
CHECK_TYPE("spice_password", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->spicePassword);
|
VIR_FREE(driver->spicePassword);
|
||||||
if (!(driver->spicePassword = strdup(p->str))) {
|
if (!(driver->spicePassword = strdup(p->str))) {
|
||||||
@ -301,8 +301,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "remote_display_port_min");
|
p = virConfGetValue(conf, "remote_display_port_min");
|
||||||
CHECK_TYPE ("remote_display_port_min", VIR_CONF_LONG);
|
CHECK_TYPE("remote_display_port_min", VIR_CONF_LONG);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (p->l < QEMU_REMOTE_PORT_MIN) {
|
if (p->l < QEMU_REMOTE_PORT_MIN) {
|
||||||
/* if the port is too low, we can't get the display name
|
/* if the port is too low, we can't get the display name
|
||||||
@ -317,8 +317,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
driver->remotePortMin = p->l;
|
driver->remotePortMin = p->l;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "remote_display_port_max");
|
p = virConfGetValue(conf, "remote_display_port_max");
|
||||||
CHECK_TYPE ("remote_display_port_max", VIR_CONF_LONG);
|
CHECK_TYPE("remote_display_port_max", VIR_CONF_LONG);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (p->l > QEMU_REMOTE_PORT_MAX ||
|
if (p->l > QEMU_REMOTE_PORT_MAX ||
|
||||||
p->l < driver->remotePortMin) {
|
p->l < driver->remotePortMin) {
|
||||||
@ -342,8 +342,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "user");
|
p = virConfGetValue(conf, "user");
|
||||||
CHECK_TYPE ("user", VIR_CONF_STRING);
|
CHECK_TYPE("user", VIR_CONF_STRING);
|
||||||
if (!(user = strdup(p && p->str ? p->str : QEMU_USER))) {
|
if (!(user = strdup(p && p->str ? p->str : QEMU_USER))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
@ -357,8 +357,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
VIR_FREE(user);
|
VIR_FREE(user);
|
||||||
|
|
||||||
|
|
||||||
p = virConfGetValue (conf, "group");
|
p = virConfGetValue(conf, "group");
|
||||||
CHECK_TYPE ("group", VIR_CONF_STRING);
|
CHECK_TYPE("group", VIR_CONF_STRING);
|
||||||
if (!(group = strdup(p && p->str ? p->str : QEMU_GROUP))) {
|
if (!(group = strdup(p && p->str ? p->str : QEMU_GROUP))) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
@ -372,13 +372,13 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
VIR_FREE(group);
|
VIR_FREE(group);
|
||||||
|
|
||||||
|
|
||||||
p = virConfGetValue (conf, "dynamic_ownership");
|
p = virConfGetValue(conf, "dynamic_ownership");
|
||||||
CHECK_TYPE ("dynamic_ownership", VIR_CONF_LONG);
|
CHECK_TYPE("dynamic_ownership", VIR_CONF_LONG);
|
||||||
if (p) driver->dynamicOwnership = p->l;
|
if (p) driver->dynamicOwnership = p->l;
|
||||||
|
|
||||||
|
|
||||||
p = virConfGetValue (conf, "cgroup_controllers");
|
p = virConfGetValue(conf, "cgroup_controllers");
|
||||||
CHECK_TYPE ("cgroup_controllers", VIR_CONF_LIST);
|
CHECK_TYPE("cgroup_controllers", VIR_CONF_LIST);
|
||||||
if (p) {
|
if (p) {
|
||||||
virConfValuePtr pp;
|
virConfValuePtr pp;
|
||||||
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
|
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
|
||||||
@ -412,8 +412,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "cgroup_device_acl");
|
p = virConfGetValue(conf, "cgroup_device_acl");
|
||||||
CHECK_TYPE ("cgroup_device_acl", VIR_CONF_LIST);
|
CHECK_TYPE("cgroup_device_acl", VIR_CONF_LIST);
|
||||||
if (p) {
|
if (p) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
virConfValuePtr pp;
|
virConfValuePtr pp;
|
||||||
@ -430,7 +430,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
driver->cgroupDeviceACL[i] = strdup (pp->str);
|
driver->cgroupDeviceACL[i] = strdup(pp->str);
|
||||||
if (driver->cgroupDeviceACL[i] == NULL) {
|
if (driver->cgroupDeviceACL[i] == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
@ -441,8 +441,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
driver->cgroupDeviceACL[i] = NULL;
|
driver->cgroupDeviceACL[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "save_image_format");
|
p = virConfGetValue(conf, "save_image_format");
|
||||||
CHECK_TYPE ("save_image_format", VIR_CONF_STRING);
|
CHECK_TYPE("save_image_format", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->saveImageFormat);
|
VIR_FREE(driver->saveImageFormat);
|
||||||
if (!(driver->saveImageFormat = strdup(p->str))) {
|
if (!(driver->saveImageFormat = strdup(p->str))) {
|
||||||
@ -452,8 +452,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "dump_image_format");
|
p = virConfGetValue(conf, "dump_image_format");
|
||||||
CHECK_TYPE ("dump_image_format", VIR_CONF_STRING);
|
CHECK_TYPE("dump_image_format", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->dumpImageFormat);
|
VIR_FREE(driver->dumpImageFormat);
|
||||||
if (!(driver->dumpImageFormat = strdup(p->str))) {
|
if (!(driver->dumpImageFormat = strdup(p->str))) {
|
||||||
@ -463,8 +463,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "auto_dump_path");
|
p = virConfGetValue(conf, "auto_dump_path");
|
||||||
CHECK_TYPE ("auto_dump_path", VIR_CONF_STRING);
|
CHECK_TYPE("auto_dump_path", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->autoDumpPath);
|
VIR_FREE(driver->autoDumpPath);
|
||||||
if (!(driver->autoDumpPath = strdup(p->str))) {
|
if (!(driver->autoDumpPath = strdup(p->str))) {
|
||||||
@ -474,16 +474,16 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "auto_dump_bypass_cache");
|
p = virConfGetValue(conf, "auto_dump_bypass_cache");
|
||||||
CHECK_TYPE ("auto_dump_bypass_cache", VIR_CONF_LONG);
|
CHECK_TYPE("auto_dump_bypass_cache", VIR_CONF_LONG);
|
||||||
if (p) driver->autoDumpBypassCache = true;
|
if (p) driver->autoDumpBypassCache = true;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "auto_start_bypass_cache");
|
p = virConfGetValue(conf, "auto_start_bypass_cache");
|
||||||
CHECK_TYPE ("auto_start_bypass_cache", VIR_CONF_LONG);
|
CHECK_TYPE("auto_start_bypass_cache", VIR_CONF_LONG);
|
||||||
if (p) driver->autoStartBypassCache = true;
|
if (p) driver->autoStartBypassCache = true;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "hugetlbfs_mount");
|
p = virConfGetValue(conf, "hugetlbfs_mount");
|
||||||
CHECK_TYPE ("hugetlbfs_mount", VIR_CONF_STRING);
|
CHECK_TYPE("hugetlbfs_mount", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
VIR_FREE(driver->hugetlbfs_mount);
|
VIR_FREE(driver->hugetlbfs_mount);
|
||||||
if (!(driver->hugetlbfs_mount = strdup(p->str))) {
|
if (!(driver->hugetlbfs_mount = strdup(p->str))) {
|
||||||
@ -493,8 +493,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "mac_filter");
|
p = virConfGetValue(conf, "mac_filter");
|
||||||
CHECK_TYPE ("mac_filter", VIR_CONF_LONG);
|
CHECK_TYPE("mac_filter", VIR_CONF_LONG);
|
||||||
if (p && p->l) {
|
if (p && p->l) {
|
||||||
driver->macFilter = p->l;
|
driver->macFilter = p->l;
|
||||||
if (!(driver->ebtables = ebtablesContextNew("qemu"))) {
|
if (!(driver->ebtables = ebtablesContextNew("qemu"))) {
|
||||||
@ -515,24 +515,24 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = virConfGetValue (conf, "relaxed_acs_check");
|
p = virConfGetValue(conf, "relaxed_acs_check");
|
||||||
CHECK_TYPE ("relaxed_acs_check", VIR_CONF_LONG);
|
CHECK_TYPE("relaxed_acs_check", VIR_CONF_LONG);
|
||||||
if (p) driver->relaxedACS = p->l;
|
if (p) driver->relaxedACS = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "vnc_allow_host_audio");
|
p = virConfGetValue(conf, "vnc_allow_host_audio");
|
||||||
CHECK_TYPE ("vnc_allow_host_audio", VIR_CONF_LONG);
|
CHECK_TYPE("vnc_allow_host_audio", VIR_CONF_LONG);
|
||||||
if (p) driver->vncAllowHostAudio = p->l;
|
if (p) driver->vncAllowHostAudio = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "clear_emulator_capabilities");
|
p = virConfGetValue(conf, "clear_emulator_capabilities");
|
||||||
CHECK_TYPE ("clear_emulator_capabilities", VIR_CONF_LONG);
|
CHECK_TYPE("clear_emulator_capabilities", VIR_CONF_LONG);
|
||||||
if (p) driver->clearEmulatorCapabilities = p->l;
|
if (p) driver->clearEmulatorCapabilities = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "allow_disk_format_probing");
|
p = virConfGetValue(conf, "allow_disk_format_probing");
|
||||||
CHECK_TYPE ("allow_disk_format_probing", VIR_CONF_LONG);
|
CHECK_TYPE("allow_disk_format_probing", VIR_CONF_LONG);
|
||||||
if (p) driver->allowDiskFormatProbing = p->l;
|
if (p) driver->allowDiskFormatProbing = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "set_process_name");
|
p = virConfGetValue(conf, "set_process_name");
|
||||||
CHECK_TYPE ("set_process_name", VIR_CONF_LONG);
|
CHECK_TYPE("set_process_name", VIR_CONF_LONG);
|
||||||
if (p) driver->setProcessName = p->l;
|
if (p) driver->setProcessName = p->l;
|
||||||
|
|
||||||
p = virConfGetValue(conf, "max_processes");
|
p = virConfGetValue(conf, "max_processes");
|
||||||
@ -543,8 +543,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
CHECK_TYPE("max_files", VIR_CONF_LONG);
|
CHECK_TYPE("max_files", VIR_CONF_LONG);
|
||||||
if (p) driver->maxFiles = p->l;
|
if (p) driver->maxFiles = p->l;
|
||||||
|
|
||||||
p = virConfGetValue (conf, "lock_manager");
|
p = virConfGetValue(conf, "lock_manager");
|
||||||
CHECK_TYPE ("lock_manager", VIR_CONF_STRING);
|
CHECK_TYPE("lock_manager", VIR_CONF_STRING);
|
||||||
if (p && p->str) {
|
if (p && p->str) {
|
||||||
char *lockConf;
|
char *lockConf;
|
||||||
virLockManagerPluginUnref(driver->lockManager);
|
virLockManagerPluginUnref(driver->lockManager);
|
||||||
@ -575,7 +575,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||||||
CHECK_TYPE("seccomp_sandbox", VIR_CONF_LONG);
|
CHECK_TYPE("seccomp_sandbox", VIR_CONF_LONG);
|
||||||
if (p) driver->seccompSandbox = p->l;
|
if (p) driver->seccompSandbox = p->l;
|
||||||
|
|
||||||
virConfFree (conf);
|
virConfFree(conf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ qemudStartup(int privileged) {
|
|||||||
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
if (virAsprintf(&qemu_driver->stateDir,
|
if (virAsprintf(&qemu_driver->stateDir,
|
||||||
@ -1085,15 +1085,15 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_driver->privileged) {
|
if (qemu_driver->privileged) {
|
||||||
if (STRNEQ (conn->uri->path, "/system") &&
|
if (STRNEQ(conn->uri->path, "/system") &&
|
||||||
STRNEQ (conn->uri->path, "/session")) {
|
STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected QEMU URI path '%s', try qemu:///system"),
|
_("unexpected QEMU URI path '%s', try qemu:///system"),
|
||||||
conn->uri->path);
|
conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ (conn->uri->path, "/session")) {
|
if (STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected QEMU URI path '%s', try qemu:///session"),
|
_("unexpected QEMU URI path '%s', try qemu:///session"),
|
||||||
conn->uri->path);
|
conn->uri->path);
|
||||||
@ -1121,7 +1121,7 @@ static int qemudClose(virConnectPtr conn) {
|
|||||||
|
|
||||||
/* Which features are supported by this driver? */
|
/* Which features are supported by this driver? */
|
||||||
static int
|
static int
|
||||||
qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
qemudSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||||
{
|
{
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case VIR_DRV_FEATURE_MIGRATION_V2:
|
case VIR_DRV_FEATURE_MIGRATION_V2:
|
||||||
@ -8704,9 +8704,9 @@ cleanup:
|
|||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
static int
|
static int
|
||||||
qemudDomainInterfaceStats (virDomainPtr dom,
|
qemudDomainInterfaceStats(virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainInterfaceStats *stats)
|
struct _virDomainInterfaceStats *stats)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -8734,7 +8734,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
|
|||||||
/* Check the path is one of the domain's network interfaces. */
|
/* Check the path is one of the domain's network interfaces. */
|
||||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||||
if (vm->def->nets[i]->ifname &&
|
if (vm->def->nets[i]->ifname &&
|
||||||
STREQ (vm->def->nets[i]->ifname, path)) {
|
STREQ(vm->def->nets[i]->ifname, path)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -8753,9 +8753,9 @@ cleanup:
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int
|
static int
|
||||||
qemudDomainInterfaceStats (virDomainPtr dom,
|
qemudDomainInterfaceStats(virDomainPtr dom,
|
||||||
const char *path ATTRIBUTE_UNUSED,
|
const char *path ATTRIBUTE_UNUSED,
|
||||||
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
|
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("interface stats not implemented on this platform"));
|
_("interface stats not implemented on this platform"));
|
||||||
@ -8991,7 +8991,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < *nparams && i < QEMU_NB_BANDWIDTH_PARAM; i++) {
|
for (i = 0; i < *nparams && i < QEMU_NB_BANDWIDTH_PARAM; i++) {
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 0: /* inbound.average */
|
case 0: /* inbound.average */
|
||||||
if (virTypedParameterAssign(¶ms[i],
|
if (virTypedParameterAssign(¶ms[i],
|
||||||
VIR_DOMAIN_BANDWIDTH_IN_AVERAGE,
|
VIR_DOMAIN_BANDWIDTH_IN_AVERAGE,
|
||||||
@ -9060,10 +9060,10 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudDomainMemoryStats (virDomainPtr dom,
|
qemudDomainMemoryStats(virDomainPtr dom,
|
||||||
struct _virDomainMemoryStat *stats,
|
struct _virDomainMemoryStat *stats,
|
||||||
unsigned int nr_stats,
|
unsigned int nr_stats,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -9119,11 +9119,11 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudDomainBlockPeek (virDomainPtr dom,
|
qemudDomainBlockPeek(virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
unsigned long long offset, size_t size,
|
unsigned long long offset, size_t size,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -9187,10 +9187,10 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudDomainMemoryPeek (virDomainPtr dom,
|
qemudDomainMemoryPeek(virDomainPtr dom,
|
||||||
unsigned long long offset, size_t size,
|
unsigned long long offset, size_t size,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -9570,16 +9570,16 @@ cleanup:
|
|||||||
*
|
*
|
||||||
* This starts an empty VM listening on a TCP port.
|
* This starts an empty VM listening on a TCP port.
|
||||||
*/
|
*/
|
||||||
static int ATTRIBUTE_NONNULL (5)
|
static int ATTRIBUTE_NONNULL(5)
|
||||||
qemudDomainMigratePrepare2 (virConnectPtr dconn,
|
qemudDomainMigratePrepare2(virConnectPtr dconn,
|
||||||
char **cookie ATTRIBUTE_UNUSED,
|
char **cookie ATTRIBUTE_UNUSED,
|
||||||
int *cookielen ATTRIBUTE_UNUSED,
|
int *cookielen ATTRIBUTE_UNUSED,
|
||||||
const char *uri_in,
|
const char *uri_in,
|
||||||
char **uri_out,
|
char **uri_out,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
const char *dname,
|
const char *dname,
|
||||||
unsigned long resource ATTRIBUTE_UNUSED,
|
unsigned long resource ATTRIBUTE_UNUSED,
|
||||||
const char *dom_xml)
|
const char *dom_xml)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dconn->privateData;
|
struct qemud_driver *driver = dconn->privateData;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -9629,13 +9629,13 @@ cleanup:
|
|||||||
|
|
||||||
/* Perform is the second step, and it runs on the source host. */
|
/* Perform is the second step, and it runs on the source host. */
|
||||||
static int
|
static int
|
||||||
qemudDomainMigratePerform (virDomainPtr dom,
|
qemudDomainMigratePerform(virDomainPtr dom,
|
||||||
const char *cookie,
|
const char *cookie,
|
||||||
int cookielen,
|
int cookielen,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
const char *dname,
|
const char *dname,
|
||||||
unsigned long resource)
|
unsigned long resource)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -9685,13 +9685,13 @@ cleanup:
|
|||||||
|
|
||||||
/* Finish is the third and final step, and it runs on the destination host. */
|
/* Finish is the third and final step, and it runs on the destination host. */
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
qemudDomainMigrateFinish2 (virConnectPtr dconn,
|
qemudDomainMigrateFinish2(virConnectPtr dconn,
|
||||||
const char *dname,
|
const char *dname,
|
||||||
const char *cookie ATTRIBUTE_UNUSED,
|
const char *cookie ATTRIBUTE_UNUSED,
|
||||||
int cookielen ATTRIBUTE_UNUSED,
|
int cookielen ATTRIBUTE_UNUSED,
|
||||||
const char *uri ATTRIBUTE_UNUSED,
|
const char *uri ATTRIBUTE_UNUSED,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
int retcode)
|
int retcode)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dconn->privateData;
|
struct qemud_driver *driver = dconn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -10043,11 +10043,11 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudNodeDeviceGetPciInfo (virNodeDevicePtr dev,
|
qemudNodeDeviceGetPciInfo(virNodeDevicePtr dev,
|
||||||
unsigned *domain,
|
unsigned *domain,
|
||||||
unsigned *bus,
|
unsigned *bus,
|
||||||
unsigned *slot,
|
unsigned *slot,
|
||||||
unsigned *function)
|
unsigned *function)
|
||||||
{
|
{
|
||||||
virNodeDeviceDefPtr def = NULL;
|
virNodeDeviceDefPtr def = NULL;
|
||||||
virNodeDevCapsDefPtr cap;
|
virNodeDevCapsDefPtr cap;
|
||||||
@ -10089,7 +10089,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudNodeDeviceDettach (virNodeDevicePtr dev)
|
qemudNodeDeviceDettach(virNodeDevicePtr dev)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dev->conn->privateData;
|
struct qemud_driver *driver = dev->conn->privateData;
|
||||||
pciDevice *pci;
|
pciDevice *pci;
|
||||||
@ -10120,7 +10120,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudNodeDeviceReAttach (virNodeDevicePtr dev)
|
qemudNodeDeviceReAttach(virNodeDevicePtr dev)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dev->conn->privateData;
|
struct qemud_driver *driver = dev->conn->privateData;
|
||||||
pciDevice *pci;
|
pciDevice *pci;
|
||||||
@ -10164,7 +10164,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudNodeDeviceReset (virNodeDevicePtr dev)
|
qemudNodeDeviceReset(virNodeDevicePtr dev)
|
||||||
{
|
{
|
||||||
struct qemud_driver *driver = dev->conn->privateData;
|
struct qemud_driver *driver = dev->conn->privateData;
|
||||||
pciDevice *pci;
|
pciDevice *pci;
|
||||||
@ -13580,7 +13580,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
|||||||
for (i = 0; i < QEMU_NB_BLOCK_IO_TUNE_PARAM && i < *nparams; i++) {
|
for (i = 0; i < QEMU_NB_BLOCK_IO_TUNE_PARAM && i < *nparams; i++) {
|
||||||
virTypedParameterPtr param = ¶ms[i];
|
virTypedParameterPtr param = ¶ms[i];
|
||||||
|
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
if (virTypedParameterAssign(param,
|
if (virTypedParameterAssign(param,
|
||||||
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC,
|
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC,
|
||||||
|
@ -268,7 +268,7 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
|
|||||||
if (!virtPort)
|
if (!virtPort)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
switch(virtPort->virtPortType) {
|
switch (virtPort->virtPortType) {
|
||||||
case VIR_NETDEV_VPORT_PROFILE_NONE:
|
case VIR_NETDEV_VPORT_PROFILE_NONE:
|
||||||
case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
|
case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
|
||||||
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
|
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
|
||||||
|
@ -491,7 +491,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
|||||||
/* Tell clang that "cont" is non-NULL.
|
/* Tell clang that "cont" is non-NULL.
|
||||||
This is because disk->info.addr.driver.controller is unsigned,
|
This is because disk->info.addr.driver.controller is unsigned,
|
||||||
and hence the above loop must iterate at least once. */
|
and hence the above loop must iterate at least once. */
|
||||||
sa_assert (cont);
|
sa_assert(cont);
|
||||||
|
|
||||||
if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -715,7 +715,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
|||||||
*/
|
*/
|
||||||
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||||
driver->privileged ||
|
driver->privileged ||
|
||||||
(!qemuCapsGet (priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
(!qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
||||||
if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
|
if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
|
||||||
priv->caps)) < 0)
|
priv->caps)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1097,7 +1097,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
|||||||
usbDevice *usb;
|
usbDevice *usb;
|
||||||
qemuCgroupData data;
|
qemuCgroupData data;
|
||||||
|
|
||||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
|
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to find cgroup for %s"),
|
_("Unable to find cgroup for %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
@ -2415,7 +2415,7 @@ int qemuDomainDetachHostDevice(struct qemud_driver *driver,
|
|||||||
idx = virDomainHostdevFind(vm->def, hostdev, &detach);
|
idx = virDomainHostdevFind(vm->def, hostdev, &detach);
|
||||||
|
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
switch(subsys->type) {
|
switch (subsys->type) {
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("host pci device %.4x:%.2x:%.2x.%.1x not found"),
|
_("host pci device %.4x:%.2x:%.2x.%.1x not found"),
|
||||||
|
@ -1794,7 +1794,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
|||||||
* URI when passing it to the qemu monitor, so bad
|
* URI when passing it to the qemu monitor, so bad
|
||||||
* characters in hostname part don't matter.
|
* characters in hostname part don't matter.
|
||||||
*/
|
*/
|
||||||
if (!STRPREFIX (uri_in, "tcp:")) {
|
if (!STRPREFIX(uri_in, "tcp:")) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("only tcp URIs are supported for KVM/QEMU"
|
_("only tcp URIs are supported for KVM/QEMU"
|
||||||
" migrations"));
|
" migrations"));
|
||||||
@ -1802,7 +1802,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the port number. */
|
/* Get the port number. */
|
||||||
p = strrchr (uri_in, ':');
|
p = strrchr(uri_in, ':');
|
||||||
if (p == strchr(uri_in, ':')) {
|
if (p == strchr(uri_in, ':')) {
|
||||||
/* Generate a port */
|
/* Generate a port */
|
||||||
this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
|
this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
|
||||||
@ -1817,8 +1817,8 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
p++; /* definitely has a ':' in it, see above */
|
p++; /* definitely has a ':' in it, see above */
|
||||||
this_port = virParseNumber (&p);
|
this_port = virParseNumber(&p);
|
||||||
if (this_port == -1 || p-uri_in != strlen (uri_in)) {
|
if (this_port == -1 || p-uri_in != strlen(uri_in)) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", _("URI ended with incorrect ':port'"));
|
"%s", _("URI ended with incorrect ':port'"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3338,7 +3338,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
|
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
|
||||||
|
|
||||||
event = virDomainEventNewFromObj(vm,
|
event = virDomainEventNewFromObj(vm,
|
||||||
VIR_DOMAIN_EVENT_RESUMED,
|
VIR_DOMAIN_EVENT_RESUMED,
|
||||||
|
@ -132,7 +132,7 @@ char *qemuMonitorEscapeArg(const char *in)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; in[i] != '\0'; i++) {
|
for (i = 0; in[i] != '\0'; i++) {
|
||||||
switch(in[i]) {
|
switch (in[i]) {
|
||||||
case '\r':
|
case '\r':
|
||||||
case '\n':
|
case '\n':
|
||||||
case '"':
|
case '"':
|
||||||
@ -149,7 +149,7 @@ char *qemuMonitorEscapeArg(const char *in)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = j = 0; in[i] != '\0'; i++) {
|
for (i = j = 0; in[i] != '\0'; i++) {
|
||||||
switch(in[i]) {
|
switch (in[i]) {
|
||||||
case '\r':
|
case '\r':
|
||||||
out[j++] = '\\';
|
out[j++] = '\\';
|
||||||
out[j++] = 'r';
|
out[j++] = 'r';
|
||||||
@ -187,7 +187,7 @@ char *qemuMonitorUnescapeArg(const char *in)
|
|||||||
next = in[i];
|
next = in[i];
|
||||||
if (in[i] == '\\') {
|
if (in[i] == '\\') {
|
||||||
++i;
|
++i;
|
||||||
switch(in[i]) {
|
switch (in[i]) {
|
||||||
case 'r':
|
case 'r':
|
||||||
next = '\r';
|
next = '\r';
|
||||||
break;
|
break;
|
||||||
|
@ -609,10 +609,10 @@ static int parseMemoryStat(char **text, unsigned int tag,
|
|||||||
char *dummy;
|
char *dummy;
|
||||||
unsigned long long value;
|
unsigned long long value;
|
||||||
|
|
||||||
if (STRPREFIX (*text, search)) {
|
if (STRPREFIX(*text, search)) {
|
||||||
*text += strlen(search);
|
*text += strlen(search);
|
||||||
if (virStrToLong_ull (*text, &dummy, 10, &value)) {
|
if (virStrToLong_ull(*text, &dummy, 10, &value)) {
|
||||||
VIR_DEBUG ("error reading %s: %s", search, *text);
|
VIR_DEBUG("error reading %s: %s", search, *text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ static int qemuMonitorParseBalloonInfo(char *text,
|
|||||||
*/
|
*/
|
||||||
if (*p == ',')
|
if (*p == ',')
|
||||||
p++;
|
p++;
|
||||||
p = strchr (p, ',');
|
p = strchr(p, ',');
|
||||||
if (!p) break;
|
if (!p) break;
|
||||||
}
|
}
|
||||||
return nr_stats_found;
|
return nr_stats_found;
|
||||||
@ -877,7 +877,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||||||
const char *p, *eol;
|
const char *p, *eol;
|
||||||
int devnamelen = strlen(dev_name);
|
int devnamelen = strlen(dev_name);
|
||||||
|
|
||||||
if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
|
if (qemuMonitorHMPCommand(mon, "info blockstats", &info) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* If the command isn't supported then qemu prints the supported
|
/* If the command isn't supported then qemu prints the supported
|
||||||
@ -919,58 +919,58 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||||||
if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
|
if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
|
||||||
p += strlen(QEMU_DRIVE_HOST_PREFIX);
|
p += strlen(QEMU_DRIVE_HOST_PREFIX);
|
||||||
|
|
||||||
if (STREQLEN (p, dev_name, devnamelen)
|
if (STREQLEN(p, dev_name, devnamelen)
|
||||||
&& p[devnamelen] == ':' && p[devnamelen+1] == ' ') {
|
&& p[devnamelen] == ':' && p[devnamelen+1] == ' ') {
|
||||||
|
|
||||||
eol = strchr (p, '\n');
|
eol = strchr(p, '\n');
|
||||||
if (!eol)
|
if (!eol)
|
||||||
eol = p + strlen (p);
|
eol = p + strlen(p);
|
||||||
|
|
||||||
p += devnamelen+2; /* Skip to first label. */
|
p += devnamelen+2; /* Skip to first label. */
|
||||||
|
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (STRPREFIX (p, "rd_bytes=")) {
|
if (STRPREFIX(p, "rd_bytes=")) {
|
||||||
p += strlen("rd_bytes=");
|
p += strlen("rd_bytes=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, rd_bytes) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, rd_bytes) == -1)
|
||||||
VIR_DEBUG ("error reading rd_bytes: %s", p);
|
VIR_DEBUG("error reading rd_bytes: %s", p);
|
||||||
} else if (STRPREFIX (p, "wr_bytes=")) {
|
} else if (STRPREFIX(p, "wr_bytes=")) {
|
||||||
p += strlen("wr_bytes=");
|
p += strlen("wr_bytes=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, wr_bytes) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, wr_bytes) == -1)
|
||||||
VIR_DEBUG ("error reading wr_bytes: %s", p);
|
VIR_DEBUG("error reading wr_bytes: %s", p);
|
||||||
} else if (STRPREFIX (p, "rd_operations=")) {
|
} else if (STRPREFIX(p, "rd_operations=")) {
|
||||||
p += strlen("rd_operations=");
|
p += strlen("rd_operations=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, rd_req) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, rd_req) == -1)
|
||||||
VIR_DEBUG ("error reading rd_req: %s", p);
|
VIR_DEBUG("error reading rd_req: %s", p);
|
||||||
} else if (STRPREFIX (p, "wr_operations=")) {
|
} else if (STRPREFIX(p, "wr_operations=")) {
|
||||||
p += strlen("wr_operations=");
|
p += strlen("wr_operations=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, wr_req) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, wr_req) == -1)
|
||||||
VIR_DEBUG ("error reading wr_req: %s", p);
|
VIR_DEBUG("error reading wr_req: %s", p);
|
||||||
} else if (rd_total_times &&
|
} else if (rd_total_times &&
|
||||||
STRPREFIX (p, "rd_total_time_ns=")) {
|
STRPREFIX(p, "rd_total_time_ns=")) {
|
||||||
p += strlen("rd_total_time_ns=");
|
p += strlen("rd_total_time_ns=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, rd_total_times) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, rd_total_times) == -1)
|
||||||
VIR_DEBUG ("error reading rd_total_times: %s", p);
|
VIR_DEBUG("error reading rd_total_times: %s", p);
|
||||||
} else if (wr_total_times &&
|
} else if (wr_total_times &&
|
||||||
STRPREFIX (p, "wr_total_time_ns=")) {
|
STRPREFIX(p, "wr_total_time_ns=")) {
|
||||||
p += strlen("wr_total_time_ns=");
|
p += strlen("wr_total_time_ns=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, wr_total_times) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, wr_total_times) == -1)
|
||||||
VIR_DEBUG ("error reading wr_total_times: %s", p);
|
VIR_DEBUG("error reading wr_total_times: %s", p);
|
||||||
} else if (flush_req &&
|
} else if (flush_req &&
|
||||||
STRPREFIX (p, "flush_operations=")) {
|
STRPREFIX(p, "flush_operations=")) {
|
||||||
p += strlen("flush_operations=");
|
p += strlen("flush_operations=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, flush_req) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, flush_req) == -1)
|
||||||
VIR_DEBUG ("error reading flush_req: %s", p);
|
VIR_DEBUG("error reading flush_req: %s", p);
|
||||||
} else if (flush_total_times &&
|
} else if (flush_total_times &&
|
||||||
STRPREFIX (p, "flush_total_time_ns=")) {
|
STRPREFIX(p, "flush_total_time_ns=")) {
|
||||||
p += strlen("flush_total_time_ns=");
|
p += strlen("flush_total_time_ns=");
|
||||||
if (virStrToLong_ll (p, &dummy, 10, flush_total_times) == -1)
|
if (virStrToLong_ll(p, &dummy, 10, flush_total_times) == -1)
|
||||||
VIR_DEBUG ("error reading flush_total_times: %s", p);
|
VIR_DEBUG("error reading flush_total_times: %s", p);
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG ("unknown block stat near %s", p);
|
VIR_DEBUG("unknown block stat near %s", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next label. */
|
/* Skip to next label. */
|
||||||
p = strchr (p, ' ');
|
p = strchr(p, ' ');
|
||||||
if (!p || p >= eol) break;
|
if (!p || p >= eol) break;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -979,14 +979,14 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next line. */
|
/* Skip to next line. */
|
||||||
p = strchr (p, '\n');
|
p = strchr(p, '\n');
|
||||||
if (!p) break;
|
if (!p) break;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we reach here then the device was not found. */
|
/* If we reach here then the device was not found. */
|
||||||
virReportError (VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("no stats found for device %s"), dev_name);
|
_("no stats found for device %s"), dev_name);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(info);
|
VIR_FREE(info);
|
||||||
@ -1001,7 +1001,7 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
|||||||
int num = 0;
|
int num = 0;
|
||||||
const char *p, *eol;
|
const char *p, *eol;
|
||||||
|
|
||||||
if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
|
if (qemuMonitorHMPCommand(mon, "info blockstats", &info) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* If the command isn't supported then qemu prints the supported
|
/* If the command isn't supported then qemu prints the supported
|
||||||
@ -1023,9 +1023,9 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
|||||||
*/
|
*/
|
||||||
p = info;
|
p = info;
|
||||||
|
|
||||||
eol = strchr (p, '\n');
|
eol = strchr(p, '\n');
|
||||||
if (!eol)
|
if (!eol)
|
||||||
eol = p + strlen (p);
|
eol = p + strlen(p);
|
||||||
|
|
||||||
/* Skip the device name and following ":", and spaces (e.g.
|
/* Skip the device name and following ":", and spaces (e.g.
|
||||||
* "floppy0: ")
|
* "floppy0: ")
|
||||||
@ -1033,17 +1033,17 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
|||||||
p = strchr(p, ' ');
|
p = strchr(p, ' ');
|
||||||
|
|
||||||
while (p && p < eol) {
|
while (p && p < eol) {
|
||||||
if (STRPREFIX (p, " rd_bytes=") ||
|
if (STRPREFIX(p, " rd_bytes=") ||
|
||||||
STRPREFIX (p, " wr_bytes=") ||
|
STRPREFIX(p, " wr_bytes=") ||
|
||||||
STRPREFIX (p, " rd_operations=") ||
|
STRPREFIX(p, " rd_operations=") ||
|
||||||
STRPREFIX (p, " wr_operations=") ||
|
STRPREFIX(p, " wr_operations=") ||
|
||||||
STRPREFIX (p, " rd_total_time_ns=") ||
|
STRPREFIX(p, " rd_total_time_ns=") ||
|
||||||
STRPREFIX (p, " wr_total_time_ns=") ||
|
STRPREFIX(p, " wr_total_time_ns=") ||
|
||||||
STRPREFIX (p, " flush_operations=") ||
|
STRPREFIX(p, " flush_operations=") ||
|
||||||
STRPREFIX (p, " flush_total_time_ns=")) {
|
STRPREFIX(p, " flush_total_time_ns=")) {
|
||||||
num++;
|
num++;
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG ("unknown block stat near %s", p);
|
VIR_DEBUG("unknown block stat near %s", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next label. */
|
/* Skip to next label. */
|
||||||
@ -3232,7 +3232,7 @@ qemuMonitorTextParseBlockIoThrottle(const char *result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next label. */
|
/* Skip to next label. */
|
||||||
p = strchr (p, ' ');
|
p = strchr(p, ' ');
|
||||||
if (!p || p >= eol)
|
if (!p || p >= eol)
|
||||||
break;
|
break;
|
||||||
p++;
|
p++;
|
||||||
@ -3242,7 +3242,7 @@ qemuMonitorTextParseBlockIoThrottle(const char *result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to next line. */
|
/* Skip to next line. */
|
||||||
p = strchr (p, '\n');
|
p = strchr(p, '\n');
|
||||||
if (!p)
|
if (!p)
|
||||||
break;
|
break;
|
||||||
p++;
|
p++;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -754,14 +754,14 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
|||||||
struct pollfd fds[1];
|
struct pollfd fds[1];
|
||||||
sigset_t oldmask, blockedsigs;
|
sigset_t oldmask, blockedsigs;
|
||||||
|
|
||||||
sigemptyset (&blockedsigs);
|
sigemptyset(&blockedsigs);
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
sigaddset (&blockedsigs, SIGWINCH);
|
sigaddset(&blockedsigs, SIGWINCH);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGCHLD
|
#ifdef SIGCHLD
|
||||||
sigaddset (&blockedsigs, SIGCHLD);
|
sigaddset(&blockedsigs, SIGCHLD);
|
||||||
#endif
|
#endif
|
||||||
sigaddset (&blockedsigs, SIGPIPE);
|
sigaddset(&blockedsigs, SIGPIPE);
|
||||||
|
|
||||||
virNetClientLock(client);
|
virNetClientLock(client);
|
||||||
|
|
||||||
@ -1510,14 +1510,14 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
|
|||||||
* after the call (RHBZ#567931). Same for SIGCHLD and SIGPIPE
|
* after the call (RHBZ#567931). Same for SIGCHLD and SIGPIPE
|
||||||
* at the suggestion of Paolo Bonzini and Daniel Berrange.
|
* at the suggestion of Paolo Bonzini and Daniel Berrange.
|
||||||
*/
|
*/
|
||||||
sigemptyset (&blockedsigs);
|
sigemptyset(&blockedsigs);
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
sigaddset (&blockedsigs, SIGWINCH);
|
sigaddset(&blockedsigs, SIGWINCH);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGCHLD
|
#ifdef SIGCHLD
|
||||||
sigaddset (&blockedsigs, SIGCHLD);
|
sigaddset(&blockedsigs, SIGCHLD);
|
||||||
#endif
|
#endif
|
||||||
sigaddset (&blockedsigs, SIGPIPE);
|
sigaddset(&blockedsigs, SIGPIPE);
|
||||||
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
||||||
|
|
||||||
repoll:
|
repoll:
|
||||||
|
@ -147,7 +147,7 @@ int virNetSASLContextCheckIdentity(virNetSASLContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (*wildcards) {
|
while (*wildcards) {
|
||||||
int rv = fnmatch (*wildcards, identity, 0);
|
int rv = fnmatch(*wildcards, identity, 0);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto cleanup; /* Successful match */
|
goto cleanup; /* Successful match */
|
||||||
|
@ -1196,7 +1196,7 @@ virNetServerClientDispatchHandshake(virNetServerClientPtr client)
|
|||||||
/* Carry on waiting for more handshake. Update
|
/* Carry on waiting for more handshake. Update
|
||||||
the events just in case handshake data flow
|
the events just in case handshake data flow
|
||||||
direction has changed */
|
direction has changed */
|
||||||
virNetServerClientUpdateEvent (client);
|
virNetServerClientUpdateEvent(client);
|
||||||
} else {
|
} else {
|
||||||
/* Fatal error in handshake */
|
/* Fatal error in handshake */
|
||||||
client->wantClose = true;
|
client->wantClose = true;
|
||||||
|
@ -453,7 +453,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
|
|||||||
if (e != 0) {
|
if (e != 0) {
|
||||||
virReportError(VIR_ERR_SYSTEM_ERROR,
|
virReportError(VIR_ERR_SYSTEM_ERROR,
|
||||||
_("Unable to resolve address '%s' service '%s': %s"),
|
_("Unable to resolve address '%s' service '%s': %s"),
|
||||||
nodename, service, gai_strerror (e));
|
nodename, service, gai_strerror(e));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ virNetTLSContextCheckCertDNWhitelist(const char *dname,
|
|||||||
const char *const*wildcards)
|
const char *const*wildcards)
|
||||||
{
|
{
|
||||||
while (*wildcards) {
|
while (*wildcards) {
|
||||||
int ret = fnmatch (*wildcards, dname, 0);
|
int ret = fnmatch(*wildcards, dname, 0);
|
||||||
if (ret == 0) /* Successful match */
|
if (ret == 0) /* Successful match */
|
||||||
return 1;
|
return 1;
|
||||||
if (ret != FNM_NOMATCH) {
|
if (ret != FNM_NOMATCH) {
|
||||||
@ -600,7 +600,7 @@ static int virNetTLSContextLoadCredentials(virNetTLSContextPtr ctxt,
|
|||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
virReportError(VIR_ERR_SYSTEM_ERROR,
|
virReportError(VIR_ERR_SYSTEM_ERROR,
|
||||||
_("Unable to set x509 CA certificate: %s: %s"),
|
_("Unable to set x509 CA certificate: %s: %s"),
|
||||||
cacert, gnutls_strerror (err));
|
cacert, gnutls_strerror(err));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(seclabel->type) {
|
switch (seclabel->type) {
|
||||||
case VIR_DOMAIN_SECLABEL_STATIC:
|
case VIR_DOMAIN_SECLABEL_STATIC:
|
||||||
if (seclabel->label == NULL) {
|
if (seclabel->label == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -546,7 +546,7 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
switch (seclabel->type) {
|
switch (seclabel->type) {
|
||||||
case VIR_DOMAIN_SECLABEL_STATIC:
|
case VIR_DOMAIN_SECLABEL_STATIC:
|
||||||
if (!(ctx = context_new(seclabel->label)) ) {
|
if (!(ctx = context_new(seclabel->label))) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("unable to allocate socket security context '%s'"),
|
_("unable to allocate socket security context '%s'"),
|
||||||
seclabel->label);
|
seclabel->label);
|
||||||
|
@ -121,7 +121,7 @@ virSecurityStackVerify(virSecurityManagerPtr mgr,
|
|||||||
virSecurityStackItemPtr item = priv->itemsHead;
|
virSecurityStackItemPtr item = priv->itemsHead;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
for(; item; item = item->next) {
|
for (; item; item = item->next) {
|
||||||
if (virSecurityManagerVerify(item->securityManager, def) < 0) {
|
if (virSecurityManagerVerify(item->securityManager, def) < 0) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -678,7 +678,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
|
|||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
|
|
||||||
/* Really, this never fails - look at the man-page. */
|
/* Really, this never fails - look at the man-page. */
|
||||||
uname (&utsname);
|
uname(&utsname);
|
||||||
if ((ctl->arch = strdup(utsname.machine)) == NULL) {
|
if ((ctl->arch = strdup(utsname.machine)) == NULL) {
|
||||||
vah_error(ctl, 0, _("could not allocate memory"));
|
vah_error(ctl, 0, _("could not allocate memory"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -692,7 +692,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
|
|||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
xmlFreeDoc (xml);
|
xmlFreeDoc(xml);
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -105,7 +105,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return the geometry of the disk and then exit */
|
/* return the geometry of the disk and then exit */
|
||||||
if(cmd == DISK_GEOMETRY) {
|
if (cmd == DISK_GEOMETRY) {
|
||||||
printf("%d%c%d%c%d%c",
|
printf("%d%c%d%c%d%c",
|
||||||
dev->hw_geom.cylinders, '\0',
|
dev->hw_geom.cylinders, '\0',
|
||||||
dev->hw_geom.heads, '\0',
|
dev->hw_geom.heads, '\0',
|
||||||
@ -158,7 +158,7 @@ int main(int argc, char **argv)
|
|||||||
type, '\0',
|
type, '\0',
|
||||||
content, '\0',
|
content, '\0',
|
||||||
part->geom.start * dev->sector_size, '\0',
|
part->geom.start * dev->sector_size, '\0',
|
||||||
(part->geom.end + 1 ) * dev->sector_size, '\0',
|
(part->geom.end + 1) * dev->sector_size, '\0',
|
||||||
part->geom.length * dev->sector_size, '\0');
|
part->geom.length * dev->sector_size, '\0');
|
||||||
} else {
|
} else {
|
||||||
printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c",
|
printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c",
|
||||||
@ -166,7 +166,7 @@ int main(int argc, char **argv)
|
|||||||
type, '\0',
|
type, '\0',
|
||||||
content, '\0',
|
content, '\0',
|
||||||
part->geom.start * dev->sector_size, '\0',
|
part->geom.start * dev->sector_size, '\0',
|
||||||
(part->geom.end + 1 ) * dev->sector_size, '\0',
|
(part->geom.end + 1) * dev->sector_size, '\0',
|
||||||
part->geom.length * dev->sector_size, '\0');
|
part->geom.length * dev->sector_size, '\0');
|
||||||
}
|
}
|
||||||
part = ped_disk_next_partition(disk, part);
|
part = ped_disk_next_partition(disk, part);
|
||||||
|
@ -128,7 +128,7 @@ enum {
|
|||||||
#define READ_BLOCK_SIZE_DEFAULT (1024 * 1024)
|
#define READ_BLOCK_SIZE_DEFAULT (1024 * 1024)
|
||||||
#define WRITE_BLOCK_SIZE_DEFAULT (4 * 1024)
|
#define WRITE_BLOCK_SIZE_DEFAULT (4 * 1024)
|
||||||
|
|
||||||
static int ATTRIBUTE_NONNULL (2)
|
static int ATTRIBUTE_NONNULL(2)
|
||||||
virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
||||||
virStorageVolDefPtr inputvol,
|
virStorageVolDefPtr inputvol,
|
||||||
int fd,
|
int fd,
|
||||||
@ -1625,18 +1625,18 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
|
|||||||
size_t buf_len = 0;
|
size_t buf_len = 0;
|
||||||
/* Be careful: even when it returns -1,
|
/* Be careful: even when it returns -1,
|
||||||
this use of getdelim allocates memory. */
|
this use of getdelim allocates memory. */
|
||||||
ssize_t tok_len = getdelim (&buf, &buf_len, 0, fp);
|
ssize_t tok_len = getdelim(&buf, &buf_len, 0, fp);
|
||||||
v[n_tok] = buf;
|
v[n_tok] = buf;
|
||||||
if (tok_len < 0) {
|
if (tok_len < 0) {
|
||||||
/* Maybe EOF, maybe an error.
|
/* Maybe EOF, maybe an error.
|
||||||
If n_tok > 0, then we know it's an error. */
|
If n_tok > 0, then we know it's an error. */
|
||||||
if (n_tok && func (pool, n_tok, v, data) < 0)
|
if (n_tok && func(pool, n_tok, v, data) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++n_tok;
|
++n_tok;
|
||||||
if (n_tok == n_columns) {
|
if (n_tok == n_columns) {
|
||||||
if (func (pool, n_tok, v, data) < 0)
|
if (func(pool, n_tok, v, data) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
n_tok = 0;
|
n_tok = 0;
|
||||||
for (i = 0; i < n_columns; i++) {
|
for (i = 0; i < n_columns; i++) {
|
||||||
|
@ -365,7 +365,7 @@ virStorageBackendDiskFindLabel(const char* device)
|
|||||||
/* if parted succeeds we have a valid partition table */
|
/* if parted succeeds we have a valid partition table */
|
||||||
ret = virCommandRun(cmd, NULL);
|
ret = virCommandRun(cmd, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (strstr (output, "unrecognised disk label"))
|
if (strstr(output, "unrecognised disk label"))
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
else {
|
else {
|
||||||
int check;
|
int check;
|
||||||
|
|
||||||
check = virStorageBackendDiskFindLabel (
|
check = virStorageBackendDiskFindLabel(
|
||||||
pool->def->source.devices[0].path);
|
pool->def->source.devices[0].path);
|
||||||
if (check > 0) {
|
if (check > 0) {
|
||||||
ok_to_mklabel = true;
|
ok_to_mklabel = true;
|
||||||
|
@ -406,16 +406,16 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
|
|||||||
pool->def->target.path,
|
pool->def->target.path,
|
||||||
NULL);
|
NULL);
|
||||||
else if (glusterfs)
|
else if (glusterfs)
|
||||||
cmd = virCommandNewArgList( MOUNT,
|
cmd = virCommandNewArgList(MOUNT,
|
||||||
"-t",
|
"-t",
|
||||||
(pool->def->type == VIR_STORAGE_POOL_FS ?
|
(pool->def->type == VIR_STORAGE_POOL_FS ?
|
||||||
virStoragePoolFormatFileSystemTypeToString(pool->def->source.format) :
|
virStoragePoolFormatFileSystemTypeToString(pool->def->source.format) :
|
||||||
virStoragePoolFormatFileSystemNetTypeToString(pool->def->source.format)),
|
virStoragePoolFormatFileSystemNetTypeToString(pool->def->source.format)),
|
||||||
src,
|
src,
|
||||||
"-o",
|
"-o",
|
||||||
"direct-io-mode=1",
|
"direct-io-mode=1",
|
||||||
pool->def->target.path,
|
pool->def->target.path,
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else
|
||||||
cmd = virCommandNewArgList(MOUNT,
|
cmd = virCommandNewArgList(MOUNT,
|
||||||
"-t",
|
"-t",
|
||||||
|
@ -287,7 +287,7 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if (dmt != NULL) {
|
if (dmt != NULL) {
|
||||||
dm_task_destroy (dmt);
|
dm_task_destroy(dmt);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ storageDriverStartup(int privileged)
|
|||||||
storageDriverLock(driverState);
|
storageDriverLock(driverState);
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
} else {
|
} else {
|
||||||
base = virGetUserConfigDirectory();
|
base = virGetUserConfigDirectory();
|
||||||
|
@ -336,7 +336,7 @@ testDomainGenerateIfname(virDomainDefPtr domdef) {
|
|||||||
/* Generate network interface names */
|
/* Generate network interface names */
|
||||||
for (i = 0 ; i < domdef->nnets ; i++) {
|
for (i = 0 ; i < domdef->nnets ; i++) {
|
||||||
if (domdef->nets[i]->ifname &&
|
if (domdef->nets[i]->ifname &&
|
||||||
STREQ (domdef->nets[i]->ifname, ifname)) {
|
STREQ(domdef->nets[i]->ifname, ifname)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1175,7 +1175,7 @@ static int testClose(virConnectPtr conn)
|
|||||||
testDriverUnlock(privconn);
|
testDriverUnlock(privconn);
|
||||||
virMutexDestroy(&privconn->lock);
|
virMutexDestroy(&privconn->lock);
|
||||||
|
|
||||||
VIR_FREE (privconn);
|
VIR_FREE(privconn);
|
||||||
conn->privateData = NULL;
|
conn->privateData = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1218,7 +1218,7 @@ static int testNodeGetInfo(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *testGetCapabilities (virConnectPtr conn)
|
static char *testGetCapabilities(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = conn->privateData;
|
testConnPtr privconn = conn->privateData;
|
||||||
char *xml;
|
char *xml;
|
||||||
@ -1416,9 +1416,9 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testListDomains (virConnectPtr conn,
|
static int testListDomains(virConnectPtr conn,
|
||||||
int *ids,
|
int *ids,
|
||||||
int maxids)
|
int maxids)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = conn->privateData;
|
testConnPtr privconn = conn->privateData;
|
||||||
int n;
|
int n;
|
||||||
@ -1430,7 +1430,7 @@ static int testListDomains (virConnectPtr conn,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testDestroyDomain (virDomainPtr domain)
|
static int testDestroyDomain(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = domain->conn->privateData;
|
testConnPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr privdom;
|
virDomainObjPtr privdom;
|
||||||
@ -1467,7 +1467,7 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testResumeDomain (virDomainPtr domain)
|
static int testResumeDomain(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = domain->conn->privateData;
|
testConnPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr privdom;
|
virDomainObjPtr privdom;
|
||||||
@ -1508,7 +1508,7 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testPauseDomain (virDomainPtr domain)
|
static int testPauseDomain(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = domain->conn->privateData;
|
testConnPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr privdom;
|
virDomainObjPtr privdom;
|
||||||
@ -1597,14 +1597,14 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testShutdownDomain (virDomainPtr domain)
|
static int testShutdownDomain(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
return testShutdownDomainFlags(domain, 0);
|
return testShutdownDomainFlags(domain, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar behaviour as shutdown */
|
/* Similar behaviour as shutdown */
|
||||||
static int testRebootDomain (virDomainPtr domain,
|
static int testRebootDomain(virDomainPtr domain,
|
||||||
unsigned int action ATTRIBUTE_UNUSED)
|
unsigned int action ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = domain->conn->privateData;
|
testConnPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr privdom;
|
virDomainObjPtr privdom;
|
||||||
@ -1673,8 +1673,8 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testGetDomainInfo (virDomainPtr domain,
|
static int testGetDomainInfo(virDomainPtr domain,
|
||||||
virDomainInfoPtr info)
|
virDomainInfoPtr info)
|
||||||
{
|
{
|
||||||
testConnPtr privconn = domain->conn->privateData;
|
testConnPtr privconn = domain->conn->privateData;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -2851,7 +2851,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
|
|||||||
|
|
||||||
for (i = 0 ; i < privdom->def->nnets ; i++) {
|
for (i = 0 ; i < privdom->def->nnets ; i++) {
|
||||||
if (privdom->def->nets[i]->ifname &&
|
if (privdom->def->nets[i]->ifname &&
|
||||||
STREQ (privdom->def->nets[i]->ifname, path)) {
|
STREQ(privdom->def->nets[i]->ifname, path)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5051,7 +5051,7 @@ cleanup:
|
|||||||
|
|
||||||
static int testStorageVolumeTypeForPool(int pooltype) {
|
static int testStorageVolumeTypeForPool(int pooltype) {
|
||||||
|
|
||||||
switch(pooltype) {
|
switch (pooltype) {
|
||||||
case VIR_STORAGE_POOL_DIR:
|
case VIR_STORAGE_POOL_DIR:
|
||||||
case VIR_STORAGE_POOL_FS:
|
case VIR_STORAGE_POOL_FS:
|
||||||
case VIR_STORAGE_POOL_NETFS:
|
case VIR_STORAGE_POOL_NETFS:
|
||||||
|
@ -65,7 +65,7 @@ virCapsPtr umlCapsInit(void) {
|
|||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
|
|
||||||
/* Really, this never fails - look at the man-page. */
|
/* Really, this never fails - look at the man-page. */
|
||||||
uname (&utsname);
|
uname(&utsname);
|
||||||
|
|
||||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||||
0, 0)) == NULL)
|
0, 0)) == NULL)
|
||||||
|
@ -455,7 +455,7 @@ umlStartup(int privileged)
|
|||||||
"%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
|
"%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
if (virAsprintf(¨_driver->monitorDir,
|
if (virAsprintf(¨_driver->monitorDir,
|
||||||
@ -1173,7 +1173,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
|
|||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
} else {
|
} else {
|
||||||
if (conn->uri->scheme == NULL ||
|
if (conn->uri->scheme == NULL ||
|
||||||
STRNEQ (conn->uri->scheme, "uml"))
|
STRNEQ(conn->uri->scheme, "uml"))
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
/* Allow remote driver to deal with URIs with hostname server */
|
/* Allow remote driver to deal with URIs with hostname server */
|
||||||
@ -1183,15 +1183,15 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
/* Check path and tell them correct path if they made a mistake */
|
/* Check path and tell them correct path if they made a mistake */
|
||||||
if (uml_driver->privileged) {
|
if (uml_driver->privileged) {
|
||||||
if (STRNEQ (conn->uri->path, "/system") &&
|
if (STRNEQ(conn->uri->path, "/system") &&
|
||||||
STRNEQ (conn->uri->path, "/session")) {
|
STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected UML URI path '%s', try uml:///system"),
|
_("unexpected UML URI path '%s', try uml:///system"),
|
||||||
conn->uri->path);
|
conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ (conn->uri->path, "/session")) {
|
if (STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected UML URI path '%s', try uml:///session"),
|
_("unexpected UML URI path '%s', try uml:///session"),
|
||||||
conn->uri->path);
|
conn->uri->path);
|
||||||
|
@ -366,7 +366,7 @@ int virBitmapParse(const char *str,
|
|||||||
cur++;
|
cur++;
|
||||||
virSkipSpaces(&cur);
|
virSkipSpaces(&cur);
|
||||||
neg = false;
|
neg = false;
|
||||||
} else if(*cur == 0 || *cur == sep) {
|
} else if (*cur == 0 || *cur == sep) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
@ -269,7 +269,7 @@ virFork(pid_t *pid)
|
|||||||
if (*pid < 0) {
|
if (*pid < 0) {
|
||||||
/* attempt to restore signal mask, but ignore failure, to
|
/* attempt to restore signal mask, but ignore failure, to
|
||||||
avoid obscuring the fork failure */
|
avoid obscuring the fork failure */
|
||||||
ignore_value (pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
||||||
virReportSystemError(saved_errno,
|
virReportSystemError(saved_errno,
|
||||||
"%s", _("cannot fork child process"));
|
"%s", _("cannot fork child process"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -492,7 +492,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
|
|||||||
"lst" is guaranteed to be non-NULL. This stops it
|
"lst" is guaranteed to be non-NULL. This stops it
|
||||||
from issuing an invalid NULL-dereference warning about
|
from issuing an invalid NULL-dereference warning about
|
||||||
"prev = lst; while (prev->next..." below. */
|
"prev = lst; while (prev->next..." below. */
|
||||||
sa_assert (lst);
|
sa_assert(lst);
|
||||||
|
|
||||||
if (CUR != ',') {
|
if (CUR != ',') {
|
||||||
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
||||||
@ -880,9 +880,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
|
|||||||
* Returns 0 on success, or -1 on failure.
|
* Returns 0 on success, or -1 on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virConfSetValue (virConfPtr conf,
|
virConfSetValue(virConfPtr conf,
|
||||||
const char *setting,
|
const char *setting,
|
||||||
virConfValuePtr value)
|
virConfValuePtr value)
|
||||||
{
|
{
|
||||||
virConfEntryPtr cur, prev = NULL;
|
virConfEntryPtr cur, prev = NULL;
|
||||||
|
|
||||||
@ -961,7 +961,7 @@ virConfWriteFile(const char *filename, virConfPtr conf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
virConfError(NULL, VIR_ERR_WRITE_FAILED, _("failed to open file"));
|
virConfError(NULL, VIR_ERR_WRITE_FAILED, _("failed to open file"));
|
||||||
|
@ -247,7 +247,7 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...)
|
|||||||
|
|
||||||
command_idx = n;
|
command_idx = n;
|
||||||
|
|
||||||
if(action == ADD || action == REMOVE) {
|
if (action == ADD || action == REMOVE) {
|
||||||
if (!(argv[n++] = strdup("--insert")))
|
if (!(argv[n++] = strdup("--insert")))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ static void virEventPollCleanupTimeouts(void) {
|
|||||||
/* Remove deleted entries, shuffling down remaining
|
/* Remove deleted entries, shuffling down remaining
|
||||||
* entries as needed to form contiguous series
|
* entries as needed to form contiguous series
|
||||||
*/
|
*/
|
||||||
for (i = 0 ; i < eventLoop.timeoutsCount ; ) {
|
for (i = 0 ; i < eventLoop.timeoutsCount ;) {
|
||||||
if (!eventLoop.timeouts[i].deleted) {
|
if (!eventLoop.timeouts[i].deleted) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
@ -551,7 +551,7 @@ static void virEventPollCleanupHandles(void) {
|
|||||||
/* Remove deleted entries, shuffling down remaining
|
/* Remove deleted entries, shuffling down remaining
|
||||||
* entries as needed to form contiguous series
|
* entries as needed to form contiguous series
|
||||||
*/
|
*/
|
||||||
for (i = 0 ; i < eventLoop.handlesCount ; ) {
|
for (i = 0 ; i < eventLoop.handlesCount ;) {
|
||||||
if (!eventLoop.handles[i].deleted) {
|
if (!eventLoop.handles[i].deleted) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
@ -717,13 +717,13 @@ int
|
|||||||
virEventPollToNativeEvents(int events)
|
virEventPollToNativeEvents(int events)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if(events & VIR_EVENT_HANDLE_READABLE)
|
if (events & VIR_EVENT_HANDLE_READABLE)
|
||||||
ret |= POLLIN;
|
ret |= POLLIN;
|
||||||
if(events & VIR_EVENT_HANDLE_WRITABLE)
|
if (events & VIR_EVENT_HANDLE_WRITABLE)
|
||||||
ret |= POLLOUT;
|
ret |= POLLOUT;
|
||||||
if(events & VIR_EVENT_HANDLE_ERROR)
|
if (events & VIR_EVENT_HANDLE_ERROR)
|
||||||
ret |= POLLERR;
|
ret |= POLLERR;
|
||||||
if(events & VIR_EVENT_HANDLE_HANGUP)
|
if (events & VIR_EVENT_HANDLE_HANGUP)
|
||||||
ret |= POLLHUP;
|
ret |= POLLHUP;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -732,15 +732,15 @@ int
|
|||||||
virEventPollFromNativeEvents(int events)
|
virEventPollFromNativeEvents(int events)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if(events & POLLIN)
|
if (events & POLLIN)
|
||||||
ret |= VIR_EVENT_HANDLE_READABLE;
|
ret |= VIR_EVENT_HANDLE_READABLE;
|
||||||
if(events & POLLOUT)
|
if (events & POLLOUT)
|
||||||
ret |= VIR_EVENT_HANDLE_WRITABLE;
|
ret |= VIR_EVENT_HANDLE_WRITABLE;
|
||||||
if(events & POLLERR)
|
if (events & POLLERR)
|
||||||
ret |= VIR_EVENT_HANDLE_ERROR;
|
ret |= VIR_EVENT_HANDLE_ERROR;
|
||||||
if(events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
|
if (events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
|
||||||
ret |= VIR_EVENT_HANDLE_ERROR;
|
ret |= VIR_EVENT_HANDLE_ERROR;
|
||||||
if(events & POLLHUP)
|
if (events & POLLHUP)
|
||||||
ret |= VIR_EVENT_HANDLE_HANGUP;
|
ret |= VIR_EVENT_HANDLE_HANGUP;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -356,13 +356,13 @@ virLogDumpAllFD(const char *msg, int len)
|
|||||||
int fd = (intptr_t) virLogOutputs[i].data;
|
int fd = (intptr_t) virLogOutputs[i].data;
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
ignore_value (safewrite(fd, msg, len));
|
ignore_value(safewrite(fd, msg, len));
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
ignore_value (safewrite(STDERR_FILENO, msg, len));
|
ignore_value(safewrite(STDERR_FILENO, msg, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -384,36 +384,36 @@ virLogEmergencyDumpAll(int signum)
|
|||||||
switch (signum) {
|
switch (signum) {
|
||||||
#ifdef SIGFPE
|
#ifdef SIGFPE
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
virLogDumpAllFD( "Caught signal Floating-point exception", -1);
|
virLogDumpAllFD("Caught signal Floating-point exception", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGSEGV
|
#ifdef SIGSEGV
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
virLogDumpAllFD( "Caught Segmentation violation", -1);
|
virLogDumpAllFD("Caught Segmentation violation", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGILL
|
#ifdef SIGILL
|
||||||
case SIGILL:
|
case SIGILL:
|
||||||
virLogDumpAllFD( "Caught illegal instruction", -1);
|
virLogDumpAllFD("Caught illegal instruction", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGABRT
|
#ifdef SIGABRT
|
||||||
case SIGABRT:
|
case SIGABRT:
|
||||||
virLogDumpAllFD( "Caught abort signal", -1);
|
virLogDumpAllFD("Caught abort signal", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
case SIGBUS:
|
case SIGBUS:
|
||||||
virLogDumpAllFD( "Caught bus error", -1);
|
virLogDumpAllFD("Caught bus error", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGUSR2
|
#ifdef SIGUSR2
|
||||||
case SIGUSR2:
|
case SIGUSR2:
|
||||||
virLogDumpAllFD( "Caught User-defined signal 2", -1);
|
virLogDumpAllFD("Caught User-defined signal 2", -1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
virLogDumpAllFD( "Caught unexpected signal", -1);
|
virLogDumpAllFD("Caught unexpected signal", -1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((virLogBuffer == NULL) || (virLogSize <= 0)) {
|
if ((virLogBuffer == NULL) || (virLogSize <= 0)) {
|
||||||
|
@ -1857,7 +1857,7 @@ pciGetPciConfigAddressFromSysfsDeviceLink(const char *device_link,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_path = canonicalize_file_name (device_link);
|
device_path = canonicalize_file_name(device_link);
|
||||||
if (device_path == NULL) {
|
if (device_path == NULL) {
|
||||||
memset(errbuf, '\0', sizeof(errbuf));
|
memset(errbuf, '\0', sizeof(errbuf));
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -56,16 +56,16 @@ linuxDomainInterfaceStats(const char *path,
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char line[256], *colon;
|
char line[256], *colon;
|
||||||
|
|
||||||
fp = fopen ("/proc/net/dev", "r");
|
fp = fopen("/proc/net/dev", "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
_("Could not open /proc/net/dev"));
|
_("Could not open /proc/net/dev"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
path_len = strlen (path);
|
path_len = strlen(path);
|
||||||
|
|
||||||
while (fgets (line, sizeof(line), fp)) {
|
while (fgets(line, sizeof(line), fp)) {
|
||||||
long long dummy;
|
long long dummy;
|
||||||
long long rx_bytes;
|
long long rx_bytes;
|
||||||
long long rx_packets;
|
long long rx_packets;
|
||||||
@ -80,23 +80,23 @@ linuxDomainInterfaceStats(const char *path,
|
|||||||
* " eth0:..."
|
* " eth0:..."
|
||||||
* Split it at the colon.
|
* Split it at the colon.
|
||||||
*/
|
*/
|
||||||
colon = strchr (line, ':');
|
colon = strchr(line, ':');
|
||||||
if (!colon) continue;
|
if (!colon) continue;
|
||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
if (colon-path_len >= line &&
|
if (colon-path_len >= line &&
|
||||||
STREQ (colon-path_len, path)) {
|
STREQ(colon-path_len, path)) {
|
||||||
/* IMPORTANT NOTE!
|
/* IMPORTANT NOTE!
|
||||||
* /proc/net/dev vif<domid>.nn sees the network from the point
|
* /proc/net/dev vif<domid>.nn sees the network from the point
|
||||||
* of view of dom0 / hypervisor. So bytes TRANSMITTED by dom0
|
* of view of dom0 / hypervisor. So bytes TRANSMITTED by dom0
|
||||||
* are bytes RECEIVED by the domain. That's why the TX/RX fields
|
* are bytes RECEIVED by the domain. That's why the TX/RX fields
|
||||||
* appear to be swapped here.
|
* appear to be swapped here.
|
||||||
*/
|
*/
|
||||||
if (sscanf (colon+1,
|
if (sscanf(colon+1,
|
||||||
"%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld",
|
"%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld",
|
||||||
&tx_bytes, &tx_packets, &tx_errs, &tx_drop,
|
&tx_bytes, &tx_packets, &tx_errs, &tx_drop,
|
||||||
&dummy, &dummy, &dummy, &dummy,
|
&dummy, &dummy, &dummy, &dummy,
|
||||||
&rx_bytes, &rx_packets, &rx_errs, &rx_drop,
|
&rx_bytes, &rx_packets, &rx_errs, &rx_drop,
|
||||||
&dummy, &dummy, &dummy, &dummy) != 16)
|
&dummy, &dummy, &dummy, &dummy) != 16)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
stats->rx_bytes = rx_bytes;
|
stats->rx_bytes = rx_bytes;
|
||||||
@ -107,7 +107,7 @@ linuxDomainInterfaceStats(const char *path,
|
|||||||
stats->tx_packets = tx_packets;
|
stats->tx_packets = tx_packets;
|
||||||
stats->tx_errs = tx_errs;
|
stats->tx_errs = tx_errs;
|
||||||
stats->tx_drop = tx_drop;
|
stats->tx_drop = tx_drop;
|
||||||
VIR_FORCE_FCLOSE (fp);
|
VIR_FORCE_FCLOSE(fp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ cowGetBackingStore(char **res,
|
|||||||
return BACKING_STORE_OK;
|
return BACKING_STORE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
*res = strndup ((const char*)buf + 4+4, COW_FILENAME_MAXLEN);
|
*res = strndup((const char*)buf + 4+4, COW_FILENAME_MAXLEN);
|
||||||
if (*res == NULL) {
|
if (*res == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return BACKING_STORE_ERROR;
|
return BACKING_STORE_ERROR;
|
||||||
@ -459,23 +459,23 @@ cleanup:
|
|||||||
static unsigned long
|
static unsigned long
|
||||||
qedGetHeaderUL(const unsigned char *loc)
|
qedGetHeaderUL(const unsigned char *loc)
|
||||||
{
|
{
|
||||||
return ( ((unsigned long)loc[3] << 24)
|
return (((unsigned long)loc[3] << 24) |
|
||||||
| ((unsigned long)loc[2] << 16)
|
((unsigned long)loc[2] << 16) |
|
||||||
| ((unsigned long)loc[1] << 8)
|
((unsigned long)loc[1] << 8) |
|
||||||
| ((unsigned long)loc[0] << 0));
|
((unsigned long)loc[0] << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long long
|
static unsigned long long
|
||||||
qedGetHeaderULL(const unsigned char *loc)
|
qedGetHeaderULL(const unsigned char *loc)
|
||||||
{
|
{
|
||||||
return ( ((unsigned long long)loc[7] << 56)
|
return (((unsigned long long)loc[7] << 56) |
|
||||||
| ((unsigned long long)loc[6] << 48)
|
((unsigned long long)loc[6] << 48) |
|
||||||
| ((unsigned long long)loc[5] << 40)
|
((unsigned long long)loc[5] << 40) |
|
||||||
| ((unsigned long long)loc[4] << 32)
|
((unsigned long long)loc[4] << 32) |
|
||||||
| ((unsigned long long)loc[3] << 24)
|
((unsigned long long)loc[3] << 24) |
|
||||||
| ((unsigned long long)loc[2] << 16)
|
((unsigned long long)loc[2] << 16) |
|
||||||
| ((unsigned long long)loc[1] << 8)
|
((unsigned long long)loc[1] << 8) |
|
||||||
| ((unsigned long long)loc[0] << 0));
|
((unsigned long long)loc[0] << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -162,7 +162,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
|
|||||||
char *eol, *tmp_base;
|
char *eol, *tmp_base;
|
||||||
virSysinfoProcessorDefPtr processor;
|
virSysinfoProcessorDefPtr processor;
|
||||||
|
|
||||||
while((tmp_base = strstr(base, "processor")) != NULL) {
|
while ((tmp_base = strstr(base, "processor")) != NULL) {
|
||||||
base = tmp_base;
|
base = tmp_base;
|
||||||
eol = strchr(base, '\n');
|
eol = strchr(base, '\n');
|
||||||
cur = strchr(base, ':') + 1;
|
cur = strchr(base, ':') + 1;
|
||||||
@ -217,7 +217,7 @@ virSysinfoRead(void) {
|
|||||||
if (VIR_ALLOC(ret) < 0)
|
if (VIR_ALLOC(ret) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
|
if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to open %s"), CPUINFO);
|
_("Failed to open %s"), CPUINFO);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -516,7 +516,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
|
|||||||
char *eol;
|
char *eol;
|
||||||
virSysinfoProcessorDefPtr processor;
|
virSysinfoProcessorDefPtr processor;
|
||||||
|
|
||||||
while((tmp_base = strstr(base, "Processor Information")) != NULL) {
|
while ((tmp_base = strstr(base, "Processor Information")) != NULL) {
|
||||||
base = tmp_base;
|
base = tmp_base;
|
||||||
eol = NULL;
|
eol = NULL;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ int virSetInherit(int fd ATTRIBUTE_UNUSED, bool inherit ATTRIBUTE_UNUSED)
|
|||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
int virSetBlocking(int fd, bool blocking) {
|
int virSetBlocking(int fd, bool blocking) {
|
||||||
return set_nonblocking_flag (fd, !blocking);
|
return set_nonblocking_flag(fd, !blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
int virSetNonBlock(int fd) {
|
int virSetNonBlock(int fd) {
|
||||||
@ -314,7 +314,7 @@ virPipeReadUntilEOF(int outfd, int errfd,
|
|||||||
fds[1].revents = 0;
|
fds[1].revents = 0;
|
||||||
finished[1] = 0;
|
finished[1] = 0;
|
||||||
|
|
||||||
while(!(finished[0] && finished[1])) {
|
while (!(finished[0] && finished[1])) {
|
||||||
|
|
||||||
if (poll(fds, ARRAY_CARDINALITY(fds), -1) < 0) {
|
if (poll(fds, ARRAY_CARDINALITY(fds), -1) < 0) {
|
||||||
if ((errno == EAGAIN) || (errno == EINTR))
|
if ((errno == EAGAIN) || (errno == EINTR))
|
||||||
@ -386,7 +386,7 @@ error:
|
|||||||
number of bytes. If the length of the input is <= max_len, and
|
number of bytes. If the length of the input is <= max_len, and
|
||||||
upon error while reading that data, it works just like fread_file. */
|
upon error while reading that data, it works just like fread_file. */
|
||||||
static char *
|
static char *
|
||||||
saferead_lim (int fd, size_t max_len, size_t *length)
|
saferead_lim(int fd, size_t max_len, size_t *length)
|
||||||
{
|
{
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
size_t alloc = 0;
|
size_t alloc = 0;
|
||||||
@ -409,9 +409,9 @@ saferead_lim (int fd, size_t max_len, size_t *length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that (size + requested <= max_len); */
|
/* Ensure that (size + requested <= max_len); */
|
||||||
requested = MIN (size < max_len ? max_len - size : 0,
|
requested = MIN(size < max_len ? max_len - size : 0,
|
||||||
alloc - size - 1);
|
alloc - size - 1);
|
||||||
count = saferead (fd, buf + size, requested);
|
count = saferead(fd, buf + size, requested);
|
||||||
size += count;
|
size += count;
|
||||||
|
|
||||||
if (count != requested || requested == 0) {
|
if (count != requested || requested == 0) {
|
||||||
@ -441,7 +441,7 @@ virFileReadLimFD(int fd, int maxlen, char **buf)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s = saferead_lim (fd, maxlen+1, &len);
|
s = saferead_lim(fd, maxlen+1, &len);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (len > maxlen || (int)len != len) {
|
if (len > maxlen || (int)len != len) {
|
||||||
@ -540,9 +540,9 @@ int virFileLinkPointsTo(const char *checkLink,
|
|||||||
struct stat src_sb;
|
struct stat src_sb;
|
||||||
struct stat dest_sb;
|
struct stat dest_sb;
|
||||||
|
|
||||||
return (stat (checkLink, &src_sb) == 0
|
return (stat(checkLink, &src_sb) == 0
|
||||||
&& stat (checkDest, &dest_sb) == 0
|
&& stat(checkDest, &dest_sb) == 0
|
||||||
&& SAME_INODE (src_sb, dest_sb));
|
&& SAME_INODE(src_sb, dest_sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ char *virFindFileInPath(const char *file)
|
|||||||
bool virFileIsDir(const char *path)
|
bool virFileIsDir(const char *path)
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
return (stat (path, &s) == 0) && S_ISDIR (s.st_mode);
|
return (stat(path, &s) == 0) && S_ISDIR(s.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool virFileExists(const char *path)
|
bool virFileExists(const char *path)
|
||||||
@ -2270,7 +2270,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
|||||||
char hostname[HOST_NAME_MAX+1], *result;
|
char hostname[HOST_NAME_MAX+1], *result;
|
||||||
struct addrinfo hints, *info;
|
struct addrinfo hints, *info;
|
||||||
|
|
||||||
r = gethostname (hostname, sizeof(hostname));
|
r = gethostname(hostname, sizeof(hostname));
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
"%s", _("failed to determine host name"));
|
"%s", _("failed to determine host name"));
|
||||||
@ -2305,7 +2305,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Tell static analyzers about getaddrinfo semantics. */
|
/* Tell static analyzers about getaddrinfo semantics. */
|
||||||
sa_assert (info);
|
sa_assert(info);
|
||||||
|
|
||||||
if (info->ai_canonname == NULL ||
|
if (info->ai_canonname == NULL ||
|
||||||
STRPREFIX(info->ai_canonname, "localhost"))
|
STRPREFIX(info->ai_canonname, "localhost"))
|
||||||
@ -2316,7 +2316,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
|||||||
result = strdup(hostname);
|
result = strdup(hostname);
|
||||||
else
|
else
|
||||||
/* Caller frees this string. */
|
/* Caller frees this string. */
|
||||||
result = strdup (info->ai_canonname);
|
result = strdup(info->ai_canonname);
|
||||||
|
|
||||||
freeaddrinfo(info);
|
freeaddrinfo(info);
|
||||||
|
|
||||||
@ -2827,7 +2827,7 @@ virGetUserDirectory(void)
|
|||||||
*/
|
*/
|
||||||
if (dir) {
|
if (dir) {
|
||||||
char *p;
|
char *p;
|
||||||
while ((p = strchr (dir, '/')) != NULL)
|
while ((p = strchr(dir, '/')) != NULL)
|
||||||
*p = '\\';
|
*p = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@ create_name:
|
|||||||
if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
|
if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
|
||||||
linkdev, vmuuid,
|
linkdev, vmuuid,
|
||||||
virtPortProfile,
|
virtPortProfile,
|
||||||
vmOp) < 0 )
|
vmOp) < 0)
|
||||||
goto disassociate_exit;
|
goto disassociate_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,15 +288,11 @@ virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
|
|||||||
|
|
||||||
port = htons(port);
|
port = htons(port);
|
||||||
|
|
||||||
if(addr->data.stor.ss_family == AF_INET) {
|
if (addr->data.stor.ss_family == AF_INET) {
|
||||||
addr->data.inet4.sin_port = port;
|
addr->data.inet4.sin_port = port;
|
||||||
}
|
} else if (addr->data.stor.ss_family == AF_INET6) {
|
||||||
|
|
||||||
else if(addr->data.stor.ss_family == AF_INET6) {
|
|
||||||
addr->data.inet6.sin6_port = port;
|
addr->data.inet6.sin6_port = port;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,11 +311,9 @@ virSocketAddrGetPort(virSocketAddrPtr addr) {
|
|||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(addr->data.stor.ss_family == AF_INET) {
|
if (addr->data.stor.ss_family == AF_INET) {
|
||||||
return ntohs(addr->data.inet4.sin_port);
|
return ntohs(addr->data.inet4.sin_port);
|
||||||
}
|
} else if (addr->data.stor.ss_family == AF_INET6) {
|
||||||
|
|
||||||
else if(addr->data.stor.ss_family == AF_INET6) {
|
|
||||||
return ntohs(addr->data.inet6.sin6_port);
|
return ntohs(addr->data.inet6.sin6_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1319,7 @@ void virReportSystemErrorFull(int domcode,
|
|||||||
size_t len = strlen(errnoDetail);
|
size_t len = strlen(errnoDetail);
|
||||||
if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
|
if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
|
||||||
char *p = msgDetailBuf + n;
|
char *p = msgDetailBuf + n;
|
||||||
stpcpy (stpcpy (p, ": "), errnoDetail);
|
stpcpy(stpcpy(p, ": "), errnoDetail);
|
||||||
msgDetail = msgDetailBuf;
|
msgDetail = msgDetailBuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ int virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
|
|||||||
|
|
||||||
/* Adjust DAYS and Y to match the guessed year. */
|
/* Adjust DAYS and Y to match the guessed year. */
|
||||||
days -= ((yg - y) * 365
|
days -= ((yg - y) * 365
|
||||||
+ LEAPS_THRU_END_OF (yg - 1)
|
+ LEAPS_THRU_END_OF(yg - 1)
|
||||||
- LEAPS_THRU_END_OF (y - 1));
|
- LEAPS_THRU_END_OF(y - 1));
|
||||||
y = yg;
|
y = yg;
|
||||||
}
|
}
|
||||||
fields->tm_year = y - 1900;
|
fields->tm_year = y - 1900;
|
||||||
|
@ -39,7 +39,7 @@ virURIParamAppend(virURIPtr uri,
|
|||||||
|
|
||||||
if (!(pname = strdup(name)))
|
if (!(pname = strdup(name)))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
if (!(pvalue = strdup (value)))
|
if (!(pvalue = strdup(value)))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
if (VIR_RESIZE_N(uri->params, uri->paramsAlloc, uri->paramsCount, 1) < 0)
|
if (VIR_RESIZE_N(uri->params, uri->paramsAlloc, uri->paramsCount, 1) < 0)
|
||||||
@ -73,14 +73,14 @@ virURIParseParams(virURIPtr uri)
|
|||||||
char *name = NULL, *value = NULL;
|
char *name = NULL, *value = NULL;
|
||||||
|
|
||||||
/* Find the next separator, or end of the string. */
|
/* Find the next separator, or end of the string. */
|
||||||
end = strchr (query, '&');
|
end = strchr(query, '&');
|
||||||
if (!end)
|
if (!end)
|
||||||
end = strchr (query, ';');
|
end = strchr(query, ';');
|
||||||
if (!end)
|
if (!end)
|
||||||
end = query + strlen (query);
|
end = query + strlen(query);
|
||||||
|
|
||||||
/* Find the first '=' character between here and end. */
|
/* Find the first '=' character between here and end. */
|
||||||
eq = strchr (query, '=');
|
eq = strchr(query, '=');
|
||||||
if (eq && eq >= end) eq = NULL;
|
if (eq && eq >= end) eq = NULL;
|
||||||
|
|
||||||
/* Empty section (eg. "&&"). */
|
/* Empty section (eg. "&&"). */
|
||||||
@ -91,14 +91,14 @@ virURIParseParams(virURIPtr uri)
|
|||||||
* and consistent with CGI.pm we assume value is "".
|
* and consistent with CGI.pm we assume value is "".
|
||||||
*/
|
*/
|
||||||
else if (!eq) {
|
else if (!eq) {
|
||||||
name = xmlURIUnescapeString (query, end - query, NULL);
|
name = xmlURIUnescapeString(query, end - query, NULL);
|
||||||
if (!name) goto no_memory;
|
if (!name) goto no_memory;
|
||||||
}
|
}
|
||||||
/* Or if we have "name=" here (works around annoying
|
/* Or if we have "name=" here (works around annoying
|
||||||
* problem when calling xmlURIUnescapeString with len = 0).
|
* problem when calling xmlURIUnescapeString with len = 0).
|
||||||
*/
|
*/
|
||||||
else if (eq+1 == end) {
|
else if (eq+1 == end) {
|
||||||
name = xmlURIUnescapeString (query, eq - query, NULL);
|
name = xmlURIUnescapeString(query, eq - query, NULL);
|
||||||
if (!name) goto no_memory;
|
if (!name) goto no_memory;
|
||||||
}
|
}
|
||||||
/* If the '=' character is at the beginning then we have
|
/* If the '=' character is at the beginning then we have
|
||||||
@ -109,10 +109,10 @@ virURIParseParams(virURIPtr uri)
|
|||||||
|
|
||||||
/* Otherwise it's "name=value". */
|
/* Otherwise it's "name=value". */
|
||||||
else {
|
else {
|
||||||
name = xmlURIUnescapeString (query, eq - query, NULL);
|
name = xmlURIUnescapeString(query, eq - query, NULL);
|
||||||
if (!name)
|
if (!name)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
value = xmlURIUnescapeString (eq+1, end - (eq+1), NULL);
|
value = xmlURIUnescapeString(eq+1, end - (eq+1), NULL);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
VIR_FREE(name);
|
VIR_FREE(name);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -292,9 +292,9 @@ char *virURIFormatParams(virURIPtr uri)
|
|||||||
|
|
||||||
for (i = 0; i < uri->paramsCount; ++i) {
|
for (i = 0; i < uri->paramsCount; ++i) {
|
||||||
if (!uri->params[i].ignore) {
|
if (!uri->params[i].ignore) {
|
||||||
if (amp) virBufferAddChar (&buf, '&');
|
if (amp) virBufferAddChar(&buf, '&');
|
||||||
virBufferStrcat (&buf, uri->params[i].name, "=", NULL);
|
virBufferStrcat(&buf, uri->params[i].name, "=", NULL);
|
||||||
virBufferURIEncodeString (&buf, uri->params[i].value);
|
virBufferURIEncodeString(&buf, uri->params[i].value);
|
||||||
amp = 1;
|
amp = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,11 +782,11 @@ error:
|
|||||||
|
|
||||||
const char *virXMLPickShellSafeComment(const char *str1, const char *str2)
|
const char *virXMLPickShellSafeComment(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
if(str1 && !strpbrk(str1, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
if (str1 && !strpbrk(str1, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||||
!strstr(str1, "--"))
|
!strstr(str1, "--"))
|
||||||
return str1;
|
return str1;
|
||||||
if(str2 && !strpbrk(str2, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
if (str2 && !strpbrk(str2, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||||
!strstr(str2, "--"))
|
!strstr(str2, "--"))
|
||||||
return str2;
|
return str2;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn,
|
|||||||
|
|
||||||
if (conn->uri == NULL ||
|
if (conn->uri == NULL ||
|
||||||
conn->uri->scheme == NULL ||
|
conn->uri->scheme == NULL ||
|
||||||
STRNEQ (conn->uri->scheme, "vbox") ||
|
STRNEQ(conn->uri->scheme, "vbox") ||
|
||||||
conn->uri->server != NULL)
|
conn->uri->server != NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
@ -162,14 +162,14 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uid != 0) {
|
if (uid != 0) {
|
||||||
if (STRNEQ (conn->uri->path, "/session")) {
|
if (STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
} else { /* root */
|
} else { /* root */
|
||||||
if (STRNEQ (conn->uri->path, "/system") &&
|
if (STRNEQ(conn->uri->path, "/system") &&
|
||||||
STRNEQ (conn->uri->path, "/session")) {
|
STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
#define VBOX_OBJECT_CHECK(conn, type, value) \
|
#define VBOX_OBJECT_CHECK(conn, type, value) \
|
||||||
vboxGlobalData *data = conn->privateData;\
|
vboxGlobalData *data = conn->privateData;\
|
||||||
type ret = value;\
|
type ret = value;\
|
||||||
if(!data->vboxObj) {\
|
if (!data->vboxObj) {\
|
||||||
return ret;\
|
return ret;\
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ if(!data->vboxObj) {\
|
|||||||
vboxGlobalData *data = conn->privateData;\
|
vboxGlobalData *data = conn->privateData;\
|
||||||
type ret = value;\
|
type ret = value;\
|
||||||
IHost *host = NULL;\
|
IHost *host = NULL;\
|
||||||
if(!data->vboxObj) {\
|
if (!data->vboxObj) {\
|
||||||
return ret;\
|
return ret;\
|
||||||
}\
|
}\
|
||||||
data->vboxObj->vtbl->GetHost(data->vboxObj, &host);\
|
data->vboxObj->vtbl->GetHost(data->vboxObj, &host);\
|
||||||
@ -119,7 +119,7 @@ if (!host) {\
|
|||||||
#if VBOX_API_VERSION < 3001
|
#if VBOX_API_VERSION < 3001
|
||||||
|
|
||||||
# define VBOX_MEDIUM_RELEASE(arg) \
|
# define VBOX_MEDIUM_RELEASE(arg) \
|
||||||
if(arg)\
|
if (arg)\
|
||||||
(arg)->vtbl->imedium.nsisupports.Release((nsISupports *)(arg))
|
(arg)->vtbl->imedium.nsisupports.Release((nsISupports *)(arg))
|
||||||
# define VBOX_MEDIUM_FUNC_ARG1(object, func, arg1) \
|
# define VBOX_MEDIUM_FUNC_ARG1(object, func, arg1) \
|
||||||
(object)->vtbl->imedium.func((IMedium *)(object), arg1)
|
(object)->vtbl->imedium.func((IMedium *)(object), arg1)
|
||||||
@ -154,7 +154,7 @@ if (strUtf16) {\
|
|||||||
|
|
||||||
#define DEBUGUUID(msg, iid) \
|
#define DEBUGUUID(msg, iid) \
|
||||||
{\
|
{\
|
||||||
VIR_DEBUG (msg ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",\
|
VIR_DEBUG(msg ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",\
|
||||||
(unsigned)(iid)->m0,\
|
(unsigned)(iid)->m0,\
|
||||||
(unsigned)(iid)->m1,\
|
(unsigned)(iid)->m1,\
|
||||||
(unsigned)(iid)->m2,\
|
(unsigned)(iid)->m2,\
|
||||||
@ -293,7 +293,7 @@ static void nsIDtoChar(unsigned char *uuid, const nsID *iid) {
|
|||||||
uuidstrdst[16] = uuidstrsrc[14];
|
uuidstrdst[16] = uuidstrsrc[14];
|
||||||
uuidstrdst[17] = uuidstrsrc[15];
|
uuidstrdst[17] = uuidstrsrc[15];
|
||||||
|
|
||||||
for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||||
uuidstrdst[i] = uuidstrsrc[i];
|
uuidstrdst[i] = uuidstrsrc[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ static void nsIDFromChar(nsID *iid, const unsigned char *uuid) {
|
|||||||
uuidstrdst[16] = uuidstrsrc[14];
|
uuidstrdst[16] = uuidstrsrc[14];
|
||||||
uuidstrdst[17] = uuidstrsrc[15];
|
uuidstrdst[17] = uuidstrsrc[15];
|
||||||
|
|
||||||
for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||||
uuidstrdst[i] = uuidstrsrc[i];
|
uuidstrdst[i] = uuidstrsrc[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,12 +594,12 @@ static char *vboxGenerateMediumName(PRUint32 storageBus,
|
|||||||
PRUint32 maxPortPerInst = 0;
|
PRUint32 maxPortPerInst = 0;
|
||||||
PRUint32 maxSlotPerPort = 0;
|
PRUint32 maxSlotPerPort = 0;
|
||||||
|
|
||||||
if ( !aMaxPortPerInst
|
if (!aMaxPortPerInst ||
|
||||||
|| !aMaxSlotPerPort)
|
!aMaxSlotPerPort)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( (storageBus < StorageBus_IDE)
|
if ((storageBus < StorageBus_IDE) ||
|
||||||
|| (storageBus > StorageBus_Floppy))
|
(storageBus > StorageBus_Floppy))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
maxPortPerInst = aMaxPortPerInst[storageBus];
|
maxPortPerInst = aMaxPortPerInst[storageBus];
|
||||||
@ -610,8 +610,8 @@ static char *vboxGenerateMediumName(PRUint32 storageBus,
|
|||||||
|
|
||||||
if (storageBus == StorageBus_IDE) {
|
if (storageBus == StorageBus_IDE) {
|
||||||
prefix = "hd";
|
prefix = "hd";
|
||||||
} else if ( (storageBus == StorageBus_SATA)
|
} else if ((storageBus == StorageBus_SATA) ||
|
||||||
|| (storageBus == StorageBus_SCSI)) {
|
(storageBus == StorageBus_SCSI)) {
|
||||||
prefix = "sd";
|
prefix = "sd";
|
||||||
} else if (storageBus == StorageBus_Floppy) {
|
} else if (storageBus == StorageBus_Floppy) {
|
||||||
prefix = "fd";
|
prefix = "fd";
|
||||||
@ -653,16 +653,16 @@ static bool vboxGetDeviceDetails(const char *deviceName,
|
|||||||
PRUint32 maxPortPerInst = 0;
|
PRUint32 maxPortPerInst = 0;
|
||||||
PRUint32 maxSlotPerPort = 0;
|
PRUint32 maxSlotPerPort = 0;
|
||||||
|
|
||||||
if ( !deviceName
|
if (!deviceName ||
|
||||||
|| !deviceInst
|
!deviceInst ||
|
||||||
|| !devicePort
|
!devicePort ||
|
||||||
|| !deviceSlot
|
!deviceSlot ||
|
||||||
|| !aMaxPortPerInst
|
!aMaxPortPerInst ||
|
||||||
|| !aMaxSlotPerPort)
|
!aMaxSlotPerPort)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( (storageBus < StorageBus_IDE)
|
if ((storageBus < StorageBus_IDE) ||
|
||||||
|| (storageBus > StorageBus_Floppy))
|
(storageBus > StorageBus_Floppy))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
total = virDiskNameToIndex(deviceName);
|
total = virDiskNameToIndex(deviceName);
|
||||||
@ -670,9 +670,9 @@ static bool vboxGetDeviceDetails(const char *deviceName,
|
|||||||
maxPortPerInst = aMaxPortPerInst[storageBus];
|
maxPortPerInst = aMaxPortPerInst[storageBus];
|
||||||
maxSlotPerPort = aMaxSlotPerPort[storageBus];
|
maxSlotPerPort = aMaxSlotPerPort[storageBus];
|
||||||
|
|
||||||
if ( !maxPortPerInst
|
if (!maxPortPerInst ||
|
||||||
|| !maxSlotPerPort
|
!maxSlotPerPort ||
|
||||||
|| (total < 0))
|
(total < 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*deviceInst = total / (maxPortPerInst * maxSlotPerPort);
|
*deviceInst = total / (maxPortPerInst * maxSlotPerPort);
|
||||||
@ -982,7 +982,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
|
|||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
|
|
||||||
if (conn->uri->scheme == NULL ||
|
if (conn->uri->scheme == NULL ||
|
||||||
STRNEQ (conn->uri->scheme, "vbox"))
|
STRNEQ(conn->uri->scheme, "vbox"))
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
/* Leave for remote driver */
|
/* Leave for remote driver */
|
||||||
@ -996,14 +996,14 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uid != 0) {
|
if (uid != 0) {
|
||||||
if (STRNEQ (conn->uri->path, "/session")) {
|
if (STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
} else { /* root */
|
} else { /* root */
|
||||||
if (STRNEQ (conn->uri->path, "/system") &&
|
if (STRNEQ(conn->uri->path, "/system") &&
|
||||||
STRNEQ (conn->uri->path, "/session")) {
|
STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
@ -1135,8 +1135,8 @@ static int vboxListDomains(virConnectPtr conn, int *ids, int nids) {
|
|||||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
if (isAccessible) {
|
if (isAccessible) {
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
if ( (state >= MachineState_FirstOnline)
|
if ((state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) ) {
|
(state <= MachineState_LastOnline)) {
|
||||||
ret++;
|
ret++;
|
||||||
ids[j++] = i + 1;
|
ids[j++] = i + 1;
|
||||||
}
|
}
|
||||||
@ -1172,8 +1172,8 @@ static int vboxNumOfDomains(virConnectPtr conn) {
|
|||||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
if (isAccessible) {
|
if (isAccessible) {
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
if ( (state >= MachineState_FirstOnline)
|
if ((state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) )
|
(state <= MachineState_LastOnline))
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1243,8 +1243,8 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
|
|||||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
if (isAccessible) {
|
if (isAccessible) {
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
if ( (state >= MachineState_FirstOnline)
|
if ((state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) ) {
|
(state <= MachineState_LastOnline)) {
|
||||||
PRUnichar *machineNameUtf16 = NULL;
|
PRUnichar *machineNameUtf16 = NULL;
|
||||||
char *machineNameUtf8 = NULL;
|
char *machineNameUtf8 = NULL;
|
||||||
|
|
||||||
@ -1329,9 +1329,9 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ret = virGetDomain(conn, machineNameUtf8, iid_as_uuid);
|
ret = virGetDomain(conn, machineNameUtf8, iid_as_uuid);
|
||||||
if ( ret
|
if (ret &&
|
||||||
&& (state >= MachineState_FirstOnline)
|
(state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) )
|
(state <= MachineState_LastOnline))
|
||||||
ret->id = i + 1;
|
ret->id = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1397,9 +1397,9 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ret = virGetDomain(conn, machineNameUtf8, uuid);
|
ret = virGetDomain(conn, machineNameUtf8, uuid);
|
||||||
if ( ret
|
if (ret &&
|
||||||
&& (state >= MachineState_FirstOnline)
|
(state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) )
|
(state <= MachineState_LastOnline))
|
||||||
ret->id = i + 1;
|
ret->id = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,8 +1466,8 @@ static int vboxDomainIsActive(virDomainPtr dom) {
|
|||||||
|
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
|
|
||||||
if ( (state >= MachineState_FirstOnline)
|
if ((state >= MachineState_FirstOnline) &&
|
||||||
&& (state <= MachineState_LastOnline) )
|
(state <= MachineState_LastOnline))
|
||||||
ret = 1;
|
ret = 1;
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -1945,7 +1945,7 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {
|
|||||||
info->nrVirtCpu = CPUCount;
|
info->nrVirtCpu = CPUCount;
|
||||||
info->memory = memorySize * 1024;
|
info->memory = memorySize * 1024;
|
||||||
info->maxMem = maxMemorySize * 1024;
|
info->maxMem = maxMemorySize * 1024;
|
||||||
switch(state) {
|
switch (state) {
|
||||||
case MachineState_Running:
|
case MachineState_Running:
|
||||||
info->state = VIR_DOMAIN_RUNNING;
|
info->state = VIR_DOMAIN_RUNNING;
|
||||||
break;
|
break;
|
||||||
@ -2426,7 +2426,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
|||||||
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
||||||
VBOX_UTF16_FREE(valueTypeUtf16);
|
VBOX_UTF16_FREE(valueTypeUtf16);
|
||||||
|
|
||||||
if ( STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui") ) {
|
if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) {
|
||||||
PRUnichar *keyDislpayUtf16 = NULL;
|
PRUnichar *keyDislpayUtf16 = NULL;
|
||||||
PRUnichar *valueDisplayUtf16 = NULL;
|
PRUnichar *valueDisplayUtf16 = NULL;
|
||||||
char *valueDisplayUtf8 = NULL;
|
char *valueDisplayUtf8 = NULL;
|
||||||
@ -3350,7 +3350,7 @@ sharedFoldersCleanup:
|
|||||||
* alloc mem and set def->nhostdevs
|
* alloc mem and set def->nhostdevs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(i = 0; i < deviceFilters.count; i++) {
|
for (i = 0; i < deviceFilters.count; i++) {
|
||||||
PRBool active = PR_FALSE;
|
PRBool active = PR_FALSE;
|
||||||
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
||||||
|
|
||||||
@ -3364,7 +3364,7 @@ sharedFoldersCleanup:
|
|||||||
/* Alloc mem needed for the filters now */
|
/* Alloc mem needed for the filters now */
|
||||||
if (VIR_ALLOC_N(def->hostdevs, def->nhostdevs) >= 0) {
|
if (VIR_ALLOC_N(def->hostdevs, def->nhostdevs) >= 0) {
|
||||||
|
|
||||||
for(i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) {
|
for (i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) {
|
||||||
PRBool active = PR_FALSE;
|
PRBool active = PR_FALSE;
|
||||||
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
||||||
|
|
||||||
@ -3462,8 +3462,8 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
|||||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
if (isAccessible) {
|
if (isAccessible) {
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
if ( (state < MachineState_FirstOnline)
|
if ((state < MachineState_FirstOnline) ||
|
||||||
|| (state > MachineState_LastOnline) ) {
|
(state > MachineState_LastOnline)) {
|
||||||
machine->vtbl->GetName(machine, &machineNameUtf16);
|
machine->vtbl->GetName(machine, &machineNameUtf16);
|
||||||
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
|
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
|
||||||
names[j] = strdup(machineName);
|
names[j] = strdup(machineName);
|
||||||
@ -3471,7 +3471,7 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
|||||||
VBOX_UTF8_FREE(machineName);
|
VBOX_UTF8_FREE(machineName);
|
||||||
if (!names[j]) {
|
if (!names[j]) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
for ( ; j >= 0 ; j--)
|
for (; j >= 0 ; j--)
|
||||||
VIR_FREE(names[j]);
|
VIR_FREE(names[j]);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3512,8 +3512,8 @@ static int vboxNumOfDefinedDomains(virConnectPtr conn) {
|
|||||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
if (isAccessible) {
|
if (isAccessible) {
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
if ( (state < MachineState_FirstOnline)
|
if ((state < MachineState_FirstOnline) ||
|
||||||
|| (state > MachineState_LastOnline) ) {
|
(state > MachineState_LastOnline)) {
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3555,7 +3555,7 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
|
|||||||
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
||||||
VBOX_UTF16_FREE(valueTypeUtf16);
|
VBOX_UTF16_FREE(valueTypeUtf16);
|
||||||
|
|
||||||
if ( STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui") ) {
|
if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) {
|
||||||
|
|
||||||
VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16);
|
VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16);
|
||||||
machine->vtbl->GetExtraData(machine, keyDislpayUtf16,
|
machine->vtbl->GetExtraData(machine, keyDislpayUtf16,
|
||||||
@ -3660,7 +3660,7 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
|
|||||||
iid->value,
|
iid->value,
|
||||||
sessionType,
|
sessionType,
|
||||||
env,
|
env,
|
||||||
&progress );
|
&progress);
|
||||||
#else /* VBOX_API_VERSION >= 4000 */
|
#else /* VBOX_API_VERSION >= 4000 */
|
||||||
rc = machine->vtbl->LaunchVMProcess(machine, data->vboxSession,
|
rc = machine->vtbl->LaunchVMProcess(machine, data->vboxSession,
|
||||||
sessionType, env, &progress);
|
sessionType, env, &progress);
|
||||||
@ -3746,9 +3746,9 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) {
|
|||||||
PRUint32 state = MachineState_Null;
|
PRUint32 state = MachineState_Null;
|
||||||
machine->vtbl->GetState(machine, &state);
|
machine->vtbl->GetState(machine, &state);
|
||||||
|
|
||||||
if ( (state == MachineState_PoweredOff) ||
|
if ((state == MachineState_PoweredOff) ||
|
||||||
(state == MachineState_Saved) ||
|
(state == MachineState_Saved) ||
|
||||||
(state == MachineState_Aborted) ) {
|
(state == MachineState_Aborted)) {
|
||||||
ret = vboxStartMachine(dom, i, machine, &iid);
|
ret = vboxStartMachine(dom, i, machine, &iid);
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||||
@ -7174,8 +7174,8 @@ vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid, void **resultp)
|
|||||||
static const nsID isupportIID = NS_ISUPPORTS_IID;
|
static const nsID isupportIID = NS_ISUPPORTS_IID;
|
||||||
|
|
||||||
/* Match UUID for IVirtualBoxCallback class */
|
/* Match UUID for IVirtualBoxCallback class */
|
||||||
if ( memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0
|
if (memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0 ||
|
||||||
|| memcmp(iid, &isupportIID, sizeof(nsID)) == 0) {
|
memcmp(iid, &isupportIID, sizeof(nsID)) == 0) {
|
||||||
g_pVBoxGlobalData->vboxCallBackRefCount++;
|
g_pVBoxGlobalData->vboxCallBackRefCount++;
|
||||||
*resultp = that;
|
*resultp = that;
|
||||||
|
|
||||||
@ -7249,10 +7249,10 @@ static void vboxReadCallback(int watch ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vboxDomainEventRegister (virConnectPtr conn,
|
static int vboxDomainEventRegister(virConnectPtr conn,
|
||||||
virConnectDomainEventCallback callback,
|
virConnectDomainEventCallback callback,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
virFreeCallback freecb) {
|
virFreeCallback freecb) {
|
||||||
VBOX_OBJECT_CHECK(conn, int, -1);
|
VBOX_OBJECT_CHECK(conn, int, -1);
|
||||||
int vboxRet = -1;
|
int vboxRet = -1;
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
@ -7293,9 +7293,9 @@ static int vboxDomainEventRegister (virConnectPtr conn,
|
|||||||
|
|
||||||
ret = virDomainEventStateRegister(conn, data->domainEvents,
|
ret = virDomainEventStateRegister(conn, data->domainEvents,
|
||||||
callback, opaque, freecb);
|
callback, opaque, freecb);
|
||||||
VIR_DEBUG("virDomainEventStateRegister (ret = %d) ( conn: %p, "
|
VIR_DEBUG("virDomainEventStateRegister (ret = %d) (conn: %p, "
|
||||||
"callback: %p, opaque: %p, "
|
"callback: %p, opaque: %p, "
|
||||||
"freecb: %p )", ret, conn, callback,
|
"freecb: %p)", ret, conn, callback,
|
||||||
opaque, freecb);
|
opaque, freecb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7312,8 +7312,8 @@ static int vboxDomainEventRegister (virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vboxDomainEventDeregister (virConnectPtr conn,
|
static int vboxDomainEventDeregister(virConnectPtr conn,
|
||||||
virConnectDomainEventCallback callback) {
|
virConnectDomainEventCallback callback) {
|
||||||
VBOX_OBJECT_CHECK(conn, int, -1);
|
VBOX_OBJECT_CHECK(conn, int, -1);
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
@ -7387,9 +7387,9 @@ static int vboxDomainEventRegisterAny(virConnectPtr conn,
|
|||||||
dom, eventID,
|
dom, eventID,
|
||||||
callback, opaque, freecb, &ret) < 0)
|
callback, opaque, freecb, &ret) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) ( conn: %p, "
|
VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) (conn: %p, "
|
||||||
"callback: %p, opaque: %p, "
|
"callback: %p, opaque: %p, "
|
||||||
"freecb: %p )", ret, conn, callback,
|
"freecb: %p)", ret, conn, callback,
|
||||||
opaque, freecb);
|
opaque, freecb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7723,9 +7723,9 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *
|
|||||||
virNetworkIpDefPtr ipdef;
|
virNetworkIpDefPtr ipdef;
|
||||||
virSocketAddr netmask;
|
virSocketAddr netmask;
|
||||||
|
|
||||||
if ( (!def)
|
if ((!def) ||
|
||||||
|| (def->forwardType != VIR_NETWORK_FORWARD_NONE)
|
(def->forwardType != VIR_NETWORK_FORWARD_NONE) ||
|
||||||
|| (def->nips == 0 || !def->ips))
|
(def->nips == 0 || !def->ips))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Look for the first IPv4 IP address definition and use that.
|
/* Look for the first IPv4 IP address definition and use that.
|
||||||
@ -8135,7 +8135,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
|
|||||||
&dhcpServer);
|
&dhcpServer);
|
||||||
if (dhcpServer) {
|
if (dhcpServer) {
|
||||||
ipdef->nranges = 1;
|
ipdef->nranges = 1;
|
||||||
if (VIR_ALLOC_N(ipdef->ranges, ipdef->nranges) >=0 ) {
|
if (VIR_ALLOC_N(ipdef->ranges, ipdef->nranges) >=0) {
|
||||||
PRUnichar *ipAddressUtf16 = NULL;
|
PRUnichar *ipAddressUtf16 = NULL;
|
||||||
PRUnichar *networkMaskUtf16 = NULL;
|
PRUnichar *networkMaskUtf16 = NULL;
|
||||||
PRUnichar *fromIPAddressUtf16 = NULL;
|
PRUnichar *fromIPAddressUtf16 = NULL;
|
||||||
@ -8174,7 +8174,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipdef->nhosts = 1;
|
ipdef->nhosts = 1;
|
||||||
if (VIR_ALLOC_N(ipdef->hosts, ipdef->nhosts) >=0 ) {
|
if (VIR_ALLOC_N(ipdef->hosts, ipdef->nhosts) >=0) {
|
||||||
ipdef->hosts[0].name = strdup(network->name);
|
ipdef->hosts[0].name = strdup(network->name);
|
||||||
if (ipdef->hosts[0].name == NULL) {
|
if (ipdef->hosts[0].name == NULL) {
|
||||||
VIR_FREE(ipdef->hosts);
|
VIR_FREE(ipdef->hosts);
|
||||||
@ -8256,9 +8256,9 @@ cleanup:
|
|||||||
* The Storage Functions here on
|
* The Storage Functions here on
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
|
static virDrvOpenStatus vboxStorageOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
vboxGlobalData *data = conn->privateData;
|
vboxGlobalData *data = conn->privateData;
|
||||||
|
|
||||||
@ -8277,7 +8277,7 @@ static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
|
|||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vboxStorageClose (virConnectPtr conn) {
|
static int vboxStorageClose(virConnectPtr conn) {
|
||||||
VIR_DEBUG("vbox storage uninitialized");
|
VIR_DEBUG("vbox storage uninitialized");
|
||||||
conn->storagePrivateData = NULL;
|
conn->storagePrivateData = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -8417,7 +8417,7 @@ static virStorageVolPtr vboxStorageVolLookupByName(virStoragePoolPtr pool, const
|
|||||||
nsresult rc;
|
nsresult rc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!name)
|
if (!name)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks);
|
rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks);
|
||||||
@ -8628,8 +8628,8 @@ static virStorageVolPtr vboxStorageVolCreateXML(virStoragePoolPtr pool,
|
|||||||
if ((def = virStorageVolDefParseString(&poolDef, xml)) == NULL)
|
if ((def = virStorageVolDefParseString(&poolDef, xml)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ( !def->name
|
if (!def->name ||
|
||||||
|| (def->type != VIR_STORAGE_VOL_FILE))
|
(def->type != VIR_STORAGE_VOL_FILE))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* TODO: for now only the vmdk, vpc and vdi type harddisk
|
/* TODO: for now only the vmdk, vpc and vdi type harddisk
|
||||||
|
@ -163,7 +163,7 @@ vmwareLoadDomains(struct vmware_driver *driver)
|
|||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for(str = outbuf ; (vmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
for (str = outbuf ; (vmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||||
str = NULL) {
|
str = NULL) {
|
||||||
|
|
||||||
if (vmxPath[0] != '/')
|
if (vmxPath[0] != '/')
|
||||||
|
@ -205,8 +205,8 @@ vmwareUpdateVMStatus(struct vmware_driver *driver, virDomainObjPtr vm)
|
|||||||
&vmxAbsolutePath) < 0)
|
&vmxAbsolutePath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for(str = outbuf ; (parsedVmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
for (str = outbuf ; (parsedVmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||||
str = NULL) {
|
str = NULL) {
|
||||||
|
|
||||||
if (parsedVmxPath[0] != '/')
|
if (parsedVmxPath[0] != '/')
|
||||||
continue;
|
continue;
|
||||||
@ -634,7 +634,7 @@ cleanup:
|
|||||||
virDomainDefFree(vmdef);
|
virDomainDefFree(vmdef);
|
||||||
VIR_FREE(vmx);
|
VIR_FREE(vmx);
|
||||||
VIR_FREE(vmxPath);
|
VIR_FREE(vmxPath);
|
||||||
if(vm)
|
if (vm)
|
||||||
virDomainObjUnlock(vm);
|
virDomainObjUnlock(vm);
|
||||||
vmwareDriverUnlock(driver);
|
vmwareDriverUnlock(driver);
|
||||||
return dom;
|
return dom;
|
||||||
|
@ -60,13 +60,13 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xstrtoint64 (char const *s, int base, int64_t *result)
|
xstrtoint64(char const *s, int base, int64_t *result)
|
||||||
{
|
{
|
||||||
long long int lli;
|
long long int lli;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
lli = strtoll (s, &p, base);
|
lli = strtoll(s, &p, base);
|
||||||
if (errno || !(*p == 0 || *p == '\n') || p == s || (int64_t) lli != lli)
|
if (errno || !(*p == 0 || *p == '\n') || p == s || (int64_t) lli != lli)
|
||||||
return -1;
|
return -1;
|
||||||
*result = lli;
|
*result = lli;
|
||||||
@ -74,26 +74,26 @@ xstrtoint64 (char const *s, int base, int64_t *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
read_stat (const char *path)
|
read_stat(const char *path)
|
||||||
{
|
{
|
||||||
char str[64];
|
char str[64];
|
||||||
int64_t r;
|
int64_t r;
|
||||||
int i;
|
int i;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
fp = fopen (path, "r");
|
fp = fopen(path, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* read, but don't bail out before closing */
|
/* read, but don't bail out before closing */
|
||||||
i = fread (str, 1, sizeof(str) - 1, fp);
|
i = fread(str, 1, sizeof(str) - 1, fp);
|
||||||
|
|
||||||
if (VIR_FCLOSE(fp) != 0 /* disk error */
|
if (VIR_FCLOSE(fp) != 0 /* disk error */
|
||||||
|| i < 1) /* ensure we read at least one byte */
|
|| i < 1) /* ensure we read at least one byte */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
str[i] = '\0'; /* make sure the string is nul-terminated */
|
str[i] = '\0'; /* make sure the string is nul-terminated */
|
||||||
if (xstrtoint64 (str, 10, &r) == -1)
|
if (xstrtoint64(str, 10, &r) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@ -136,7 +136,7 @@ read_bd_stat(int device, int domid, const char *str)
|
|||||||
* is no connected device.
|
* is no connected device.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
check_bd_connected(xenUnifiedPrivatePtr priv, int device, int domid)
|
||||||
{
|
{
|
||||||
char s[256], *rs;
|
char s[256], *rs;
|
||||||
int r;
|
int r;
|
||||||
@ -146,11 +146,11 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
|||||||
* xenstore, etc.
|
* xenstore, etc.
|
||||||
*/
|
*/
|
||||||
if (!priv->xshandle) return 1;
|
if (!priv->xshandle) return 1;
|
||||||
snprintf (s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
|
snprintf(s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
|
||||||
domid, device);
|
domid, device);
|
||||||
s[sizeof(s) - 1] = '\0';
|
s[sizeof(s) - 1] = '\0';
|
||||||
|
|
||||||
rs = xs_read (priv->xshandle, 0, s, &len);
|
rs = xs_read(priv->xshandle, 0, s, &len);
|
||||||
if (!rs) return 1;
|
if (!rs) return 1;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* Hmmm ... we can get to xenstore but it returns an empty
|
/* Hmmm ... we can get to xenstore but it returns an empty
|
||||||
@ -161,7 +161,7 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = STREQ (rs, "4");
|
r = STREQ(rs, "4");
|
||||||
VIR_FREE(rs);
|
VIR_FREE(rs);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -170,11 +170,11 @@ static int
|
|||||||
read_bd_stats(xenUnifiedPrivatePtr priv,
|
read_bd_stats(xenUnifiedPrivatePtr priv,
|
||||||
int device, int domid, struct _virDomainBlockStats *stats)
|
int device, int domid, struct _virDomainBlockStats *stats)
|
||||||
{
|
{
|
||||||
stats->rd_req = read_bd_stat (device, domid, "rd_req");
|
stats->rd_req = read_bd_stat(device, domid, "rd_req");
|
||||||
stats->rd_bytes = read_bd_stat (device, domid, "rd_sect");
|
stats->rd_bytes = read_bd_stat(device, domid, "rd_sect");
|
||||||
stats->wr_req = read_bd_stat (device, domid, "wr_req");
|
stats->wr_req = read_bd_stat(device, domid, "wr_req");
|
||||||
stats->wr_bytes = read_bd_stat (device, domid, "wr_sect");
|
stats->wr_bytes = read_bd_stat(device, domid, "wr_sect");
|
||||||
stats->errs = read_bd_stat (device, domid, "oo_req");
|
stats->errs = read_bd_stat(device, domid, "oo_req");
|
||||||
|
|
||||||
/* None of the files were found - it's likely that this version
|
/* None of the files were found - it's likely that this version
|
||||||
* of Xen is an old one which just doesn't support stats collection.
|
* of Xen is an old one which just doesn't support stats collection.
|
||||||
@ -195,7 +195,7 @@ read_bd_stats(xenUnifiedPrivatePtr priv,
|
|||||||
if (stats->rd_req == 0 && stats->rd_bytes == 0 &&
|
if (stats->rd_req == 0 && stats->rd_bytes == 0 &&
|
||||||
stats->wr_req == 0 && stats->wr_bytes == 0 &&
|
stats->wr_req == 0 && stats->wr_bytes == 0 &&
|
||||||
stats->errs == 0 &&
|
stats->errs == 0 &&
|
||||||
!check_bd_connected (priv, device, domid)) {
|
!check_bd_connected(priv, device, domid)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Frontend block device not connected for domain %d"),
|
_("Frontend block device not connected for domain %d"),
|
||||||
domid);
|
domid);
|
||||||
@ -358,10 +358,10 @@ xenLinuxDomainDeviceID(int domid, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenLinuxDomainBlockStats (xenUnifiedPrivatePtr priv,
|
xenLinuxDomainBlockStats(xenUnifiedPrivatePtr priv,
|
||||||
virDomainPtr dom,
|
virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainBlockStats *stats)
|
struct _virDomainBlockStats *stats)
|
||||||
{
|
{
|
||||||
int device = xenLinuxDomainDeviceID(dom->id, path);
|
int device = xenLinuxDomainDeviceID(dom->id, path);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1463,9 +1463,9 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
xenHypervisorDomainBlockStats (virDomainPtr dom,
|
xenHypervisorDomainBlockStats(virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainBlockStats *stats)
|
struct _virDomainBlockStats *stats)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
@ -1474,7 +1474,7 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
|
|||||||
priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
/* Need to lock because it hits the xenstore handle :-( */
|
/* Need to lock because it hits the xenstore handle :-( */
|
||||||
ret = xenLinuxDomainBlockStats (priv, dom, path, stats);
|
ret = xenLinuxDomainBlockStats(priv, dom, path, stats);
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
@ -1492,9 +1492,9 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
|
|||||||
* virNetwork interface, as yet not decided.
|
* virNetwork interface, as yet not decided.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenHypervisorDomainInterfaceStats (virDomainPtr dom,
|
xenHypervisorDomainInterfaceStats(virDomainPtr dom,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainInterfaceStats *stats)
|
struct _virDomainInterfaceStats *stats)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int rqdomid, device;
|
int rqdomid, device;
|
||||||
@ -1983,30 +1983,30 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
|||||||
* Note that errors here are really internal errors since these
|
* Note that errors here are really internal errors since these
|
||||||
* regexps should never fail to compile.
|
* regexps should never fail to compile.
|
||||||
*/
|
*/
|
||||||
errcode = regcomp (&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
|
errcode = regcomp(&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
char error[100];
|
char error[100];
|
||||||
regerror (errcode, &flags_hvm_rec, error, sizeof(error));
|
regerror(errcode, &flags_hvm_rec, error, sizeof(error));
|
||||||
regfree (&flags_hvm_rec);
|
regfree(&flags_hvm_rec);
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
errcode = regcomp (&flags_pae_rec, flags_pae_re, REG_EXTENDED);
|
errcode = regcomp(&flags_pae_rec, flags_pae_re, REG_EXTENDED);
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
char error[100];
|
char error[100];
|
||||||
regerror (errcode, &flags_pae_rec, error, sizeof(error));
|
regerror(errcode, &flags_pae_rec, error, sizeof(error));
|
||||||
regfree (&flags_pae_rec);
|
regfree(&flags_pae_rec);
|
||||||
regfree (&flags_hvm_rec);
|
regfree(&flags_hvm_rec);
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
errcode = regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
errcode = regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
char error[100];
|
char error[100];
|
||||||
regerror (errcode, &xen_cap_rec, error, sizeof(error));
|
regerror(errcode, &xen_cap_rec, error, sizeof(error));
|
||||||
regfree (&xen_cap_rec);
|
regfree(&xen_cap_rec);
|
||||||
regfree (&flags_pae_rec);
|
regfree(&flags_pae_rec);
|
||||||
regfree (&flags_hvm_rec);
|
regfree(&flags_hvm_rec);
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2512,7 +2512,7 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Really, this never fails - look at the man-page. */
|
/* Really, this never fails - look at the man-page. */
|
||||||
uname (&utsname);
|
uname(&utsname);
|
||||||
|
|
||||||
guest_arches[i].model = "i686";
|
guest_arches[i].model = "i686";
|
||||||
guest_arches[i].bits = 32;
|
guest_arches[i].bits = 32;
|
||||||
@ -2594,15 +2594,15 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
|
|||||||
* architectures and non-Linux. (XXX)
|
* architectures and non-Linux. (XXX)
|
||||||
*/
|
*/
|
||||||
if (cpuinfo) {
|
if (cpuinfo) {
|
||||||
while (fgets (line, sizeof(line), cpuinfo)) {
|
while (fgets(line, sizeof(line), cpuinfo)) {
|
||||||
if (regexec (&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
|
if (regexec(&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
|
||||||
&& subs[0].rm_so != -1) {
|
&& subs[0].rm_so != -1) {
|
||||||
if (virStrncpy(hvm_type,
|
if (virStrncpy(hvm_type,
|
||||||
&line[subs[1].rm_so],
|
&line[subs[1].rm_so],
|
||||||
subs[1].rm_eo-subs[1].rm_so,
|
subs[1].rm_eo-subs[1].rm_so,
|
||||||
sizeof(hvm_type)) == NULL)
|
sizeof(hvm_type)) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
} else if (regexec (&flags_pae_rec, line, 0, NULL, 0) == 0)
|
} else if (regexec(&flags_pae_rec, line, 0, NULL, 0) == 0)
|
||||||
host_pae = 1;
|
host_pae = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2632,17 +2632,17 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Expecting one line in this file - ignore any more. */
|
/* Expecting one line in this file - ignore any more. */
|
||||||
if ((capabilities) && (fgets (line, sizeof(line), capabilities))) {
|
if ((capabilities) && (fgets(line, sizeof(line), capabilities))) {
|
||||||
/* Split the line into tokens. strtok_r is OK here because we "own"
|
/* Split the line into tokens. strtok_r is OK here because we "own"
|
||||||
* this buffer. Parse out the features from each token.
|
* this buffer. Parse out the features from each token.
|
||||||
*/
|
*/
|
||||||
for (str = line, nr_guest_archs = 0;
|
for (str = line, nr_guest_archs = 0;
|
||||||
nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
|
nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
|
||||||
&& (token = strtok_r (str, " ", &saveptr)) != NULL;
|
&& (token = strtok_r(str, " ", &saveptr)) != NULL;
|
||||||
str = NULL) {
|
str = NULL) {
|
||||||
|
|
||||||
if (regexec (&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
|
if (regexec(&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
|
||||||
subs, 0) == 0) {
|
subs, 0) == 0) {
|
||||||
int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
|
int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
|
||||||
const char *model;
|
const char *model;
|
||||||
int bits, pae = 0, nonpae = 0, ia64_be = 0;
|
int bits, pae = 0, nonpae = 0, ia64_be = 0;
|
||||||
@ -2740,9 +2740,9 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
|
|||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
|
|
||||||
/* Really, this never fails - look at the man-page. */
|
/* Really, this never fails - look at the man-page. */
|
||||||
uname (&utsname);
|
uname(&utsname);
|
||||||
|
|
||||||
cpuinfo = fopen ("/proc/cpuinfo", "r");
|
cpuinfo = fopen("/proc/cpuinfo", "r");
|
||||||
if (cpuinfo == NULL) {
|
if (cpuinfo == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
@ -2752,7 +2752,7 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilities = fopen ("/sys/hypervisor/properties/capabilities", "r");
|
capabilities = fopen("/sys/hypervisor/properties/capabilities", "r");
|
||||||
if (capabilities == NULL) {
|
if (capabilities == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
VIR_FORCE_FCLOSE(cpuinfo);
|
VIR_FORCE_FCLOSE(cpuinfo);
|
||||||
@ -2790,7 +2790,7 @@ cleanup:
|
|||||||
* Return the capabilities of this hypervisor.
|
* Return the capabilities of this hypervisor.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
xenHypervisorGetCapabilities (virConnectPtr conn)
|
xenHypervisorGetCapabilities(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||||
char *xml;
|
char *xml;
|
||||||
@ -2920,7 +2920,7 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xenHypervisorDomainGetOSType (virDomainPtr dom)
|
xenHypervisorDomainGetOSType(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
xen_getdomaininfo dominfo;
|
xen_getdomaininfo dominfo;
|
||||||
@ -3161,7 +3161,7 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
|
|||||||
*
|
*
|
||||||
* Returns the memory size in kilobytes or 0 in case of error.
|
* Returns the memory size in kilobytes or 0 in case of error.
|
||||||
*/
|
*/
|
||||||
static unsigned long long ATTRIBUTE_NONNULL (1)
|
static unsigned long long ATTRIBUTE_NONNULL(1)
|
||||||
xenHypervisorGetMaxMemory(virDomainPtr domain)
|
xenHypervisorGetMaxMemory(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
@ -3254,7 +3254,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
|
|||||||
info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
|
info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
|
||||||
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * kb_per_pages;
|
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * kb_per_pages;
|
||||||
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo);
|
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo);
|
||||||
if(info->maxMem != UINT_MAX)
|
if (info->maxMem != UINT_MAX)
|
||||||
info->maxMem *= kb_per_pages;
|
info->maxMem *= kb_per_pages;
|
||||||
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
|
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
|
||||||
return 0;
|
return 0;
|
||||||
@ -3717,7 +3717,7 @@ int
|
|||||||
xenHavePrivilege(void)
|
xenHavePrivilege(void)
|
||||||
{
|
{
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
return priv_ineffect (PRIV_XVM_CONTROL);
|
return priv_ineffect(PRIV_XVM_CONTROL);
|
||||||
#else
|
#else
|
||||||
return access(XEN_HYPERVISOR_SOCKET, R_OK) == 0;
|
return access(XEN_HYPERVISOR_SOCKET, R_OK) == 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,7 +96,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
|
|||||||
initial list of domains */
|
initial list of domains */
|
||||||
VIR_DEBUG("Looking for dom with uuid: %s", uuid_str);
|
VIR_DEBUG("Looking for dom with uuid: %s", uuid_str);
|
||||||
/* XXX Should not have to go via a virDomainPtr obj instance */
|
/* XXX Should not have to go via a virDomainPtr obj instance */
|
||||||
if(!(dom = xenDaemonLookupByUUID(conn, rawuuid))) {
|
if (!(dom = xenDaemonLookupByUUID(conn, rawuuid))) {
|
||||||
/* If we are here, the domain has gone away.
|
/* If we are here, the domain has gone away.
|
||||||
search for, and create a domain from the stored
|
search for, and create a domain from the stored
|
||||||
list info */
|
list info */
|
||||||
@ -250,7 +250,7 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
VIR_DEBUG("got inotify event");
|
VIR_DEBUG("got inotify event");
|
||||||
|
|
||||||
if( conn && conn->privateData ) {
|
if (conn && conn->privateData) {
|
||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -299,14 +299,14 @@ reread:
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("looking up dom"));
|
"%s", _("looking up dom"));
|
||||||
|
|
||||||
if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0 ) {
|
if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error adding file to config cache"));
|
"%s", _("Error adding file to config cache"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (e->mask & ( IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO) ) {
|
} else if (e->mask & (IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO)) {
|
||||||
virDomainEventPtr event;
|
virDomainEventPtr event;
|
||||||
if (xenInotifyAddDomainConfigInfo(conn, fname) < 0 ) {
|
if (xenInotifyAddDomainConfigInfo(conn, fname) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error adding file to config cache"));
|
"%s", _("Error adding file to config cache"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -381,7 +381,7 @@ xenInotifyOpen(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xenInotifyAddDomainConfigInfo(conn, path) < 0 ) {
|
if (xenInotifyAddDomainConfigInfo(conn, path) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error adding file to config list"));
|
"%s", _("Error adding file to config list"));
|
||||||
closedir(dh);
|
closedir(dh);
|
||||||
@ -414,7 +414,7 @@ xenInotifyOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
VIR_DEBUG("Building initial config cache");
|
VIR_DEBUG("Building initial config cache");
|
||||||
if (priv->useXenConfigCache &&
|
if (priv->useXenConfigCache &&
|
||||||
xenXMConfigCacheRefresh (conn) < 0) {
|
xenXMConfigCacheRefresh(conn) < 0) {
|
||||||
VIR_DEBUG("Failed to enable XM config cache %s", conn->err.message);
|
VIR_DEBUG("Failed to enable XM config cache %s", conn->err.message);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ istartswith(const char *haystack, const char *needle)
|
|||||||
* Returns the HTTP return code and @content is set to the
|
* Returns the HTTP return code and @content is set to the
|
||||||
* allocated memory containing HTTP content.
|
* allocated memory containing HTTP content.
|
||||||
*/
|
*/
|
||||||
static int ATTRIBUTE_NONNULL (2)
|
static int ATTRIBUTE_NONNULL(2)
|
||||||
xend_req(int fd, char **content)
|
xend_req(int fd, char **content)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
@ -308,7 +308,7 @@ xend_req(int fd, char **content)
|
|||||||
/* Allocate one byte beyond the end of the largest buffer we will read.
|
/* Allocate one byte beyond the end of the largest buffer we will read.
|
||||||
Combined with the fact that VIR_ALLOC_N zeros the returned buffer,
|
Combined with the fact that VIR_ALLOC_N zeros the returned buffer,
|
||||||
this guarantees that "content" will always be NUL-terminated. */
|
this guarantees that "content" will always be NUL-terminated. */
|
||||||
if (VIR_ALLOC_N(*content, content_length + 1) < 0 ) {
|
if (VIR_ALLOC_N(*content, content_length + 1) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -682,13 +682,13 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
|
|||||||
for (r = res; r; r = r->ai_next) {
|
for (r = res; r; r = r->ai_next) {
|
||||||
int sock;
|
int sock;
|
||||||
|
|
||||||
sock = socket (r->ai_family, SOCK_STREAM, r->ai_protocol);
|
sock = socket(r->ai_family, SOCK_STREAM, r->ai_protocol);
|
||||||
if (sock == -1) {
|
if (sock == -1) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect (sock, r->ai_addr, r->ai_addrlen) == -1) {
|
if (connect(sock, r->ai_addr, r->ai_addrlen) == -1) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
VIR_FORCE_CLOSE(sock);
|
VIR_FORCE_CLOSE(sock);
|
||||||
continue;
|
continue;
|
||||||
@ -704,7 +704,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo (res);
|
freeaddrinfo(res);
|
||||||
|
|
||||||
if (!priv->addrlen) {
|
if (!priv->addrlen) {
|
||||||
/* Don't raise error when unprivileged, since proxy takes over */
|
/* Don't raise error when unprivileged, since proxy takes over */
|
||||||
@ -1288,7 +1288,7 @@ xenDaemonOpen(virConnectPtr conn,
|
|||||||
xend_detect_config_version(conn) == -1)
|
xend_detect_config_version(conn) == -1)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
else if (STRCASEEQ (conn->uri->scheme, "xen")) {
|
else if (STRCASEEQ(conn->uri->scheme, "xen")) {
|
||||||
/*
|
/*
|
||||||
* try first to open the unix socket
|
* try first to open the unix socket
|
||||||
*/
|
*/
|
||||||
@ -1302,7 +1302,7 @@ xenDaemonOpen(virConnectPtr conn,
|
|||||||
if (xenDaemonOpen_tcp(conn, "localhost", "8000") < 0 ||
|
if (xenDaemonOpen_tcp(conn, "localhost", "8000") < 0 ||
|
||||||
xend_detect_config_version(conn) == -1)
|
xend_detect_config_version(conn) == -1)
|
||||||
goto failed;
|
goto failed;
|
||||||
} else if (STRCASEEQ (conn->uri->scheme, "http")) {
|
} else if (STRCASEEQ(conn->uri->scheme, "http")) {
|
||||||
if (conn->uri->port &&
|
if (conn->uri->port &&
|
||||||
virAsprintf(&port, "%d", conn->uri->port) == -1) {
|
virAsprintf(&port, "%d", conn->uri->port) == -1) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -3130,14 +3130,14 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonDomainMigratePrepare (virConnectPtr dconn,
|
xenDaemonDomainMigratePrepare(virConnectPtr dconn,
|
||||||
char **cookie ATTRIBUTE_UNUSED,
|
char **cookie ATTRIBUTE_UNUSED,
|
||||||
int *cookielen ATTRIBUTE_UNUSED,
|
int *cookielen ATTRIBUTE_UNUSED,
|
||||||
const char *uri_in,
|
const char *uri_in,
|
||||||
char **uri_out,
|
char **uri_out,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
const char *dname ATTRIBUTE_UNUSED,
|
const char *dname ATTRIBUTE_UNUSED,
|
||||||
unsigned long resource ATTRIBUTE_UNUSED)
|
unsigned long resource ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virCheckFlags(XEN_MIGRATION_FLAGS, -1);
|
virCheckFlags(XEN_MIGRATION_FLAGS, -1);
|
||||||
|
|
||||||
@ -3155,13 +3155,13 @@ xenDaemonDomainMigratePrepare (virConnectPtr dconn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenDaemonDomainMigratePerform (virDomainPtr domain,
|
xenDaemonDomainMigratePerform(virDomainPtr domain,
|
||||||
const char *cookie ATTRIBUTE_UNUSED,
|
const char *cookie ATTRIBUTE_UNUSED,
|
||||||
int cookielen ATTRIBUTE_UNUSED,
|
int cookielen ATTRIBUTE_UNUSED,
|
||||||
const char *uri,
|
const char *uri,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
const char *dname,
|
const char *dname,
|
||||||
unsigned long bandwidth)
|
unsigned long bandwidth)
|
||||||
{
|
{
|
||||||
/* Upper layers have already checked domain. */
|
/* Upper layers have already checked domain. */
|
||||||
/* NB: Passing port=0 to xend means it ignores
|
/* NB: Passing port=0 to xend means it ignores
|
||||||
@ -3199,7 +3199,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
* Check the flags.
|
* Check the flags.
|
||||||
*/
|
*/
|
||||||
if ((flags & VIR_MIGRATE_LIVE)) {
|
if ((flags & VIR_MIGRATE_LIVE)) {
|
||||||
strcpy (live, "1");
|
strcpy(live, "1");
|
||||||
flags &= ~VIR_MIGRATE_LIVE;
|
flags &= ~VIR_MIGRATE_LIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3235,36 +3235,36 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
* URI is non-NULL (guaranteed by caller). We expect either
|
* URI is non-NULL (guaranteed by caller). We expect either
|
||||||
* "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
|
* "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
|
||||||
*/
|
*/
|
||||||
if (strstr (uri, "//")) { /* Full URI. */
|
if (strstr(uri, "//")) { /* Full URI. */
|
||||||
virURIPtr uriptr;
|
virURIPtr uriptr;
|
||||||
if (!(uriptr = virURIParse (uri)))
|
if (!(uriptr = virURIParse(uri)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) {
|
if (uriptr->scheme && STRCASENEQ(uriptr->scheme, "xenmigr")) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", _("xenDaemonDomainMigrate: only xenmigr://"
|
"%s", _("xenDaemonDomainMigrate: only xenmigr://"
|
||||||
" migrations are supported by Xen"));
|
" migrations are supported by Xen"));
|
||||||
virURIFree (uriptr);
|
virURIFree(uriptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!uriptr->server) {
|
if (!uriptr->server) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", _("xenDaemonDomainMigrate: a hostname must be"
|
"%s", _("xenDaemonDomainMigrate: a hostname must be"
|
||||||
" specified in the URI"));
|
" specified in the URI"));
|
||||||
virURIFree (uriptr);
|
virURIFree(uriptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
hostname = strdup (uriptr->server);
|
hostname = strdup(uriptr->server);
|
||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
virURIFree (uriptr);
|
virURIFree(uriptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (uriptr->port)
|
if (uriptr->port)
|
||||||
snprintf (port, sizeof(port), "%d", uriptr->port);
|
snprintf(port, sizeof(port), "%d", uriptr->port);
|
||||||
virURIFree (uriptr);
|
virURIFree(uriptr);
|
||||||
}
|
}
|
||||||
else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
|
else if ((p = strrchr(uri, ':')) != NULL) { /* "hostname:port" */
|
||||||
int port_nr, n;
|
int port_nr, n;
|
||||||
|
|
||||||
if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
|
if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
|
||||||
@ -3272,11 +3272,11 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
"%s", _("xenDaemonDomainMigrate: invalid port number"));
|
"%s", _("xenDaemonDomainMigrate: invalid port number"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
snprintf (port, sizeof(port), "%d", port_nr);
|
snprintf(port, sizeof(port), "%d", port_nr);
|
||||||
|
|
||||||
/* Get the hostname. */
|
/* Get the hostname. */
|
||||||
n = p - uri; /* n = Length of hostname in bytes. */
|
n = p - uri; /* n = Length of hostname in bytes. */
|
||||||
hostname = strdup (uri);
|
hostname = strdup(uri);
|
||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
@ -3284,7 +3284,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
hostname[n] = '\0';
|
hostname[n] = '\0';
|
||||||
}
|
}
|
||||||
else { /* "hostname" (or IP address) */
|
else { /* "hostname" (or IP address) */
|
||||||
hostname = strdup (uri);
|
hostname = strdup(uri);
|
||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
@ -3299,20 +3299,20 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
|||||||
* to our advantage since all parameters supported and required
|
* to our advantage since all parameters supported and required
|
||||||
* by current xend can be included without breaking older xend.
|
* by current xend can be included without breaking older xend.
|
||||||
*/
|
*/
|
||||||
ret = xend_op (domain->conn, domain->name,
|
ret = xend_op(domain->conn, domain->name,
|
||||||
"op", "migrate",
|
"op", "migrate",
|
||||||
"destination", hostname,
|
"destination", hostname,
|
||||||
"live", live,
|
"live", live,
|
||||||
"port", port,
|
"port", port,
|
||||||
"node", "-1", /* xen-unstable c/s 17753 */
|
"node", "-1", /* xen-unstable c/s 17753 */
|
||||||
"ssl", "0", /* xen-unstable c/s 17709 */
|
"ssl", "0", /* xen-unstable c/s 17709 */
|
||||||
"change_home_server", "0", /* xen-unstable c/s 20326 */
|
"change_home_server", "0", /* xen-unstable c/s 20326 */
|
||||||
"resource", "0", /* removed by xen-unstable c/s 17553 */
|
"resource", "0", /* removed by xen-unstable c/s 17553 */
|
||||||
NULL);
|
NULL);
|
||||||
VIR_FREE (hostname);
|
VIR_FREE(hostname);
|
||||||
|
|
||||||
if (ret == 0 && undefined_source)
|
if (ret == 0 && undefined_source)
|
||||||
xenDaemonDomainUndefine (domain);
|
xenDaemonDomainUndefine(domain);
|
||||||
|
|
||||||
VIR_DEBUG("migration done");
|
VIR_DEBUG("migration done");
|
||||||
|
|
||||||
@ -3540,7 +3540,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
|
|||||||
"%s", _("node information incomplete, missing scheduler name"));
|
"%s", _("node information incomplete, missing scheduler name"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (STREQ (ret, "credit")) {
|
if (STREQ(ret, "credit")) {
|
||||||
schedulertype = strdup("credit");
|
schedulertype = strdup("credit");
|
||||||
if (schedulertype == NULL){
|
if (schedulertype == NULL){
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -3548,7 +3548,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
|
|||||||
}
|
}
|
||||||
if (nparams)
|
if (nparams)
|
||||||
*nparams = XEN_SCHED_CRED_NPARAM;
|
*nparams = XEN_SCHED_CRED_NPARAM;
|
||||||
} else if (STREQ (ret, "sedf")) {
|
} else if (STREQ(ret, "sedf")) {
|
||||||
schedulertype = strdup("sedf");
|
schedulertype = strdup("sedf");
|
||||||
if (schedulertype == NULL){
|
if (schedulertype == NULL){
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -3738,10 +3738,10 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
|
|||||||
memset(&buf_weight, 0, VIR_UUID_BUFLEN);
|
memset(&buf_weight, 0, VIR_UUID_BUFLEN);
|
||||||
memset(&buf_cap, 0, VIR_UUID_BUFLEN);
|
memset(&buf_cap, 0, VIR_UUID_BUFLEN);
|
||||||
for (i = 0; i < nparams; i++) {
|
for (i = 0; i < nparams; i++) {
|
||||||
if (STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT) &&
|
if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT) &&
|
||||||
params[i].type == VIR_TYPED_PARAM_UINT) {
|
params[i].type == VIR_TYPED_PARAM_UINT) {
|
||||||
snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui);
|
snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui);
|
||||||
} else if (STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_CAP) &&
|
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP) &&
|
||||||
params[i].type == VIR_TYPED_PARAM_UINT) {
|
params[i].type == VIR_TYPED_PARAM_UINT) {
|
||||||
snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
|
snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
|
||||||
} else {
|
} else {
|
||||||
@ -3797,9 +3797,9 @@ error:
|
|||||||
* Returns 0 if successful, -1 if error, -2 if declined.
|
* Returns 0 if successful, -1 if error, -2 if declined.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
xenDaemonDomainBlockPeek(virDomainPtr domain, const char *path,
|
||||||
unsigned long long offset, size_t size,
|
unsigned long long offset, size_t size,
|
||||||
void *buffer)
|
void *buffer)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
struct sexpr *root = NULL;
|
struct sexpr *root = NULL;
|
||||||
@ -3817,11 +3817,11 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
|||||||
|
|
||||||
/* Security check: The path must correspond to a block device. */
|
/* Security check: The path must correspond to a block device. */
|
||||||
if (domain->id > 0)
|
if (domain->id > 0)
|
||||||
root = sexpr_get (domain->conn, "/xend/domain/%d?detail=1",
|
root = sexpr_get(domain->conn, "/xend/domain/%d?detail=1",
|
||||||
domain->id);
|
domain->id);
|
||||||
else if (domain->id < 0)
|
else if (domain->id < 0)
|
||||||
root = sexpr_get (domain->conn, "/xend/domain/%s?detail=1",
|
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1",
|
||||||
domain->name);
|
domain->name);
|
||||||
else {
|
else {
|
||||||
/* This call always fails for dom0. */
|
/* This call always fails for dom0. */
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
@ -3852,7 +3852,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
|||||||
path = actual;
|
path = actual;
|
||||||
|
|
||||||
/* The path is correct, now try to open it and get its size. */
|
/* The path is correct, now try to open it and get its size. */
|
||||||
fd = open (path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("failed to open for reading: %s"),
|
_("failed to open for reading: %s"),
|
||||||
@ -3864,8 +3864,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
|||||||
/* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
|
/* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
|
||||||
* be 64 bits on all platforms.
|
* be 64 bits on all platforms.
|
||||||
*/
|
*/
|
||||||
if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
|
if (lseek(fd, offset, SEEK_SET) == (off_t) -1 ||
|
||||||
saferead (fd, buffer, size) == (ssize_t) -1) {
|
saferead(fd, buffer, size) == (ssize_t) -1) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("failed to lseek or read from file: %s"),
|
_("failed to lseek or read from file: %s"),
|
||||||
path);
|
path);
|
||||||
|
@ -309,7 +309,7 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
|
|||||||
* Caller must hold the lock on 'conn->privateData' before
|
* Caller must hold the lock on 'conn->privateData' before
|
||||||
* calling this function
|
* calling this function
|
||||||
*/
|
*/
|
||||||
int xenXMConfigCacheRefresh (virConnectPtr conn) {
|
int xenXMConfigCacheRefresh(virConnectPtr conn) {
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
DIR *dh;
|
DIR *dh;
|
||||||
struct dirent *ent;
|
struct dirent *ent;
|
||||||
@ -411,9 +411,9 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
|
|||||||
* every few seconds
|
* every few seconds
|
||||||
*/
|
*/
|
||||||
virDrvOpenStatus
|
virDrvOpenStatus
|
||||||
xenXMOpen (virConnectPtr conn,
|
xenXMOpen(virConnectPtr conn,
|
||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
@ -893,7 +893,7 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(filename = virHashLookup(priv->nameConfigMap, domname)))
|
if (!(filename = virHashLookup(priv->nameConfigMap, domname)))
|
||||||
@ -949,7 +949,7 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, (const void *)uuid)))
|
if (!(entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, (const void *)uuid)))
|
||||||
@ -1049,7 +1049,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0) {
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0) {
|
||||||
xenUnifiedUnlock(priv);
|
xenUnifiedUnlock(priv);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1261,7 +1261,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (maxnames > virHashSize(priv->configCache))
|
if (maxnames > virHashSize(priv->configCache))
|
||||||
@ -1306,7 +1306,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
|
|||||||
priv = conn->privateData;
|
priv = conn->privateData;
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virHashSize(priv->nameConfigMap);
|
ret = virHashSize(priv->nameConfigMap);
|
||||||
@ -1527,11 +1527,11 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xenXMDomainBlockPeek (virDomainPtr dom ATTRIBUTE_UNUSED,
|
xenXMDomainBlockPeek(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||||
const char *path ATTRIBUTE_UNUSED,
|
const char *path ATTRIBUTE_UNUSED,
|
||||||
unsigned long long offset ATTRIBUTE_UNUSED,
|
unsigned long long offset ATTRIBUTE_UNUSED,
|
||||||
size_t size ATTRIBUTE_UNUSED,
|
size_t size ATTRIBUTE_UNUSED,
|
||||||
void *buffer ATTRIBUTE_UNUSED)
|
void *buffer ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("block peeking not implemented"));
|
_("block peeking not implemented"));
|
||||||
|
@ -95,7 +95,7 @@ virConnectDoStoreList(virConnectPtr conn, const char *path,
|
|||||||
if (priv->xshandle == NULL || path == NULL || nb == NULL)
|
if (priv->xshandle == NULL || path == NULL || nb == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return xs_directory (priv->xshandle, 0, path, nb);
|
return xs_directory(priv->xshandle, 0, path, nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -287,8 +287,8 @@ xenStoreOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This will get called once at start */
|
/* This will get called once at start */
|
||||||
if ( xenStoreAddWatch(conn, "@releaseDomain",
|
if (xenStoreAddWatch(conn, "@releaseDomain",
|
||||||
"releaseDomain", xenStoreDomainReleased, priv) < 0 )
|
"releaseDomain", xenStoreDomainReleased, priv) < 0)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("adding watch @releaseDomain"));
|
"%s", _("adding watch @releaseDomain"));
|
||||||
@ -296,8 +296,8 @@ xenStoreOpen(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The initial call of this will fill domInfoList */
|
/* The initial call of this will fill domInfoList */
|
||||||
if( xenStoreAddWatch(conn, "@introduceDomain",
|
if (xenStoreAddWatch(conn, "@introduceDomain",
|
||||||
"introduceDomain", xenStoreDomainIntroduced, priv) < 0 )
|
"introduceDomain", xenStoreDomainIntroduced, priv) < 0)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("adding watch @introduceDomain"));
|
"%s", _("adding watch @introduceDomain"));
|
||||||
@ -571,7 +571,7 @@ xenStoreNumOfDomains(virConnectPtr conn)
|
|||||||
realnum++;
|
realnum++;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
VIR_FREE (idlist);
|
VIR_FREE(idlist);
|
||||||
ret = realnum;
|
ret = realnum;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -599,7 +599,7 @@ xenStoreDoListDomains(virConnectPtr conn, xenUnifiedPrivatePtr priv, int *ids, i
|
|||||||
if (priv->xshandle == NULL)
|
if (priv->xshandle == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
idlist = xs_directory (priv->xshandle, 0, "/local/domain", &num);
|
idlist = xs_directory(priv->xshandle, 0, "/local/domain", &num);
|
||||||
if (idlist == NULL)
|
if (idlist == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ xenStoreDoListDomains(virConnectPtr conn, xenUnifiedPrivatePtr priv, int *ids, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
VIR_FREE (idlist);
|
VIR_FREE(idlist);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +696,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
|
|||||||
prop[199] = 0;
|
prop[199] = 0;
|
||||||
tmp = xs_read(priv->xshandle, 0, prop, &len);
|
tmp = xs_read(priv->xshandle, 0, prop, &len);
|
||||||
if (tmp != NULL) {
|
if (tmp != NULL) {
|
||||||
found = STREQ (name, tmp);
|
found = STREQ(name, tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
if (found)
|
if (found)
|
||||||
break;
|
break;
|
||||||
@ -985,19 +985,19 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
|
|||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
break;
|
break;
|
||||||
if ((devlen != len) || memcmp(val, dev, len)) {
|
if ((devlen != len) || memcmp(val, dev, len)) {
|
||||||
VIR_FREE (val);
|
VIR_FREE(val);
|
||||||
} else {
|
} else {
|
||||||
ret = strdup(list[i]);
|
ret = strdup(list[i]);
|
||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
|
||||||
VIR_FREE (val);
|
VIR_FREE(val);
|
||||||
VIR_FREE (list);
|
VIR_FREE(list);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VIR_FREE (list);
|
VIR_FREE(list);
|
||||||
}
|
}
|
||||||
snprintf(dir, sizeof(dir), "/local/domain/0/backend/tap/%d", id);
|
snprintf(dir, sizeof(dir), "/local/domain/0/backend/tap/%d", id);
|
||||||
list = xs_directory(priv->xshandle, 0, dir, &num);
|
list = xs_directory(priv->xshandle, 0, dir, &num);
|
||||||
@ -1008,19 +1008,19 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
|
|||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
break;
|
break;
|
||||||
if ((devlen != len) || memcmp(val, dev, len)) {
|
if ((devlen != len) || memcmp(val, dev, len)) {
|
||||||
VIR_FREE (val);
|
VIR_FREE(val);
|
||||||
} else {
|
} else {
|
||||||
ret = strdup(list[i]);
|
ret = strdup(list[i]);
|
||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
|
||||||
VIR_FREE (val);
|
VIR_FREE(val);
|
||||||
VIR_FREE (list);
|
VIR_FREE(list);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VIR_FREE (list);
|
VIR_FREE(list);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1164,12 +1164,12 @@ int xenStoreAddWatch(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
list = priv->xsWatchList;
|
list = priv->xsWatchList;
|
||||||
if(!list)
|
if (!list)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* check if we already have this callback on our list */
|
/* check if we already have this callback on our list */
|
||||||
for (n=0; n < list->count; n++) {
|
for (n=0; n < list->count; n++) {
|
||||||
if( STREQ(list->watches[n]->path, path) &&
|
if (STREQ(list->watches[n]->path, path) &&
|
||||||
STREQ(list->watches[n]->token, token)) {
|
STREQ(list->watches[n]->token, token)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("watch already tracked"));
|
"%s", _("watch already tracked"));
|
||||||
@ -1228,11 +1228,11 @@ int xenStoreRemoveWatch(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
list = priv->xsWatchList;
|
list = priv->xsWatchList;
|
||||||
if(!list)
|
if (!list)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0 ; i < list->count ; i++) {
|
for (i = 0 ; i < list->count ; i++) {
|
||||||
if( STREQ(list->watches[i]->path, path) &&
|
if (STREQ(list->watches[i]->path, path) &&
|
||||||
STREQ(list->watches[i]->token, token)) {
|
STREQ(list->watches[i]->token, token)) {
|
||||||
|
|
||||||
if (!xs_unwatch(priv->xshandle,
|
if (!xs_unwatch(priv->xshandle,
|
||||||
@ -1271,8 +1271,8 @@ xenStoreFindWatch(xenStoreWatchListPtr list,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < list->count ; i++)
|
for (i = 0 ; i < list->count ; i++)
|
||||||
if( STREQ(path, list->watches[i]->path) &&
|
if (STREQ(path, list->watches[i]->path) &&
|
||||||
STREQ(token, list->watches[i]->token) )
|
STREQ(token, list->watches[i]->token))
|
||||||
return list->watches[i];
|
return list->watches[i];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1293,14 +1293,14 @@ xenStoreWatchEvent(int watch ATTRIBUTE_UNUSED,
|
|||||||
virConnectPtr conn = data;
|
virConnectPtr conn = data;
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||||
|
|
||||||
if(!priv) return;
|
if (!priv) return;
|
||||||
|
|
||||||
/* only set a watch on read and write events */
|
/* only set a watch on read and write events */
|
||||||
if (events & (VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP)) return;
|
if (events & (VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP)) return;
|
||||||
|
|
||||||
xenUnifiedLock(priv);
|
xenUnifiedLock(priv);
|
||||||
|
|
||||||
if(!priv->xshandle)
|
if (!priv->xshandle)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
event = xs_read_watch(priv->xshandle, &stringCount);
|
event = xs_read_watch(priv->xshandle, &stringCount);
|
||||||
@ -1311,7 +1311,7 @@ xenStoreWatchEvent(int watch ATTRIBUTE_UNUSED,
|
|||||||
token = event[XS_WATCH_TOKEN];
|
token = event[XS_WATCH_TOKEN];
|
||||||
|
|
||||||
sw = xenStoreFindWatch(priv->xsWatchList, path, token);
|
sw = xenStoreFindWatch(priv->xsWatchList, path, token);
|
||||||
if( sw )
|
if (sw)
|
||||||
sw->cb(conn, path, token, sw->opaque);
|
sw->cb(conn, path, token, sw->opaque);
|
||||||
VIR_FREE(event);
|
VIR_FREE(event);
|
||||||
|
|
||||||
@ -1342,7 +1342,7 @@ retry:
|
|||||||
if (new_domain_cnt < 0)
|
if (new_domain_cnt < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
|
if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1418,14 +1418,14 @@ int xenStoreDomainReleased(virConnectPtr conn,
|
|||||||
|
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
||||||
|
|
||||||
if(!priv->activeDomainList->count) return 0;
|
if (!priv->activeDomainList->count) return 0;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
new_domain_cnt = xenStoreNumOfDomains(conn);
|
new_domain_cnt = xenStoreNumOfDomains(conn);
|
||||||
if (new_domain_cnt < 0)
|
if (new_domain_cnt < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
|
if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ static int xenapiDefaultConsoleType(const char *ostype)
|
|||||||
* Return virCapsPtr on success or NULL on failure
|
* Return virCapsPtr on success or NULL on failure
|
||||||
*/
|
*/
|
||||||
static virCapsPtr
|
static virCapsPtr
|
||||||
getCapsObject (void)
|
getCapsObject(void)
|
||||||
{
|
{
|
||||||
virCapsGuestPtr guest1, guest2;
|
virCapsGuestPtr guest1, guest2;
|
||||||
virCapsGuestDomainPtr domain1, domain2;
|
virCapsGuestDomainPtr domain1, domain2;
|
||||||
@ -98,8 +98,8 @@ getCapsObject (void)
|
|||||||
* Return VIR_DRV_OPEN_SUCCESS on success, else VIR_DRV_OPEN_ERROR
|
* Return VIR_DRV_OPEN_SUCCESS on success, else VIR_DRV_OPEN_ERROR
|
||||||
*/
|
*/
|
||||||
static virDrvOpenStatus
|
static virDrvOpenStatus
|
||||||
xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
|
xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
char *username = NULL;
|
char *username = NULL;
|
||||||
char *password = NULL;
|
char *password = NULL;
|
||||||
@ -225,7 +225,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiClose (virConnectPtr conn)
|
xenapiClose(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct _xenapiPrivate *priv = conn->privateData;
|
struct _xenapiPrivate *priv = conn->privateData;
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ xenapiClose (virConnectPtr conn)
|
|||||||
* Returns 0
|
* Returns 0
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
xenapiSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||||
{
|
{
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case VIR_DRV_FEATURE_MIGRATION_V2:
|
case VIR_DRV_FEATURE_MIGRATION_V2:
|
||||||
@ -268,7 +268,7 @@ xenapiSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
|||||||
* Returns name of the driver
|
* Returns name of the driver
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
xenapiType (virConnectPtr conn ATTRIBUTE_UNUSED)
|
xenapiType(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return "XenAPI";
|
return "XenAPI";
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ xenapiType (virConnectPtr conn ATTRIBUTE_UNUSED)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiGetVersion (virConnectPtr conn, unsigned long *hvVer)
|
xenapiGetVersion(virConnectPtr conn, unsigned long *hvVer)
|
||||||
{
|
{
|
||||||
xen_host host;
|
xen_host host;
|
||||||
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
||||||
@ -333,7 +333,7 @@ xenapiGetVersion (virConnectPtr conn, unsigned long *hvVer)
|
|||||||
* Returns the hostname on success, or NULL on failure
|
* Returns the hostname on success, or NULL on failure
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
xenapiGetHostname (virConnectPtr conn)
|
xenapiGetHostname(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
xen_host host;
|
xen_host host;
|
||||||
@ -356,7 +356,7 @@ xenapiGetHostname (virConnectPtr conn)
|
|||||||
* Returns a hardcoded value for Maximum VCPUS
|
* Returns a hardcoded value for Maximum VCPUS
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiGetMaxVcpus (virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBUTE_UNUSED)
|
xenapiGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
/* this is hardcoded for simplicity and set to a resonable value compared
|
/* this is hardcoded for simplicity and set to a resonable value compared
|
||||||
to the actual value */
|
to the actual value */
|
||||||
@ -371,7 +371,7 @@ xenapiGetMaxVcpus (virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBU
|
|||||||
* Returns Node details on success or else -1
|
* Returns Node details on success or else -1
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
|
xenapiNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
||||||
{
|
{
|
||||||
int64_t memory, mhz;
|
int64_t memory, mhz;
|
||||||
xen_host_cpu_set *host_cpu_set;
|
xen_host_cpu_set *host_cpu_set;
|
||||||
@ -422,7 +422,7 @@ xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
|
|||||||
* Returns capabilities as an XML string
|
* Returns capabilities as an XML string
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
xenapiGetCapabilities (virConnectPtr conn)
|
xenapiGetCapabilities(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virCapsPtr caps = ((struct _xenapiPrivate *)(conn->privateData))->caps;
|
virCapsPtr caps = ((struct _xenapiPrivate *)(conn->privateData))->caps;
|
||||||
if (caps) {
|
if (caps) {
|
||||||
@ -444,7 +444,7 @@ xenapiGetCapabilities (virConnectPtr conn)
|
|||||||
* Returns the number of domain found or -1 in case of error
|
* Returns the number of domain found or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiListDomains (virConnectPtr conn, int *ids, int maxids)
|
xenapiListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||||
{
|
{
|
||||||
/* vm.list */
|
/* vm.list */
|
||||||
xen_host host;
|
xen_host host;
|
||||||
@ -481,7 +481,7 @@ xenapiListDomains (virConnectPtr conn, int *ids, int maxids)
|
|||||||
* Returns the number of domains found or -1 in case of error
|
* Returns the number of domains found or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiNumOfDomains (virConnectPtr conn)
|
xenapiNumOfDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
/* #(vm.list) */
|
/* #(vm.list) */
|
||||||
xen_vm_set *result = NULL;
|
xen_vm_set *result = NULL;
|
||||||
@ -510,9 +510,9 @@ xenapiNumOfDomains (virConnectPtr conn)
|
|||||||
* Returns the domain pointer or NULL in case of error
|
* Returns the domain pointer or NULL in case of error
|
||||||
*/
|
*/
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
xenapiDomainCreateXML (virConnectPtr conn,
|
xenapiDomainCreateXML(virConnectPtr conn,
|
||||||
const char *xmlDesc,
|
const char *xmlDesc,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
xen_vm_record *record = NULL;
|
xen_vm_record *record = NULL;
|
||||||
xen_vm vm = NULL;
|
xen_vm vm = NULL;
|
||||||
@ -562,7 +562,7 @@ xenapiDomainCreateXML (virConnectPtr conn,
|
|||||||
* or NULL in case of error
|
* or NULL in case of error
|
||||||
*/
|
*/
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
xenapiDomainLookupByID (virConnectPtr conn, int id)
|
xenapiDomainLookupByID(virConnectPtr conn, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int64_t domID;
|
int64_t domID;
|
||||||
@ -617,8 +617,8 @@ xenapiDomainLookupByID (virConnectPtr conn, int id)
|
|||||||
* or -1 in case of error
|
* or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
xenapiDomainLookupByUUID (virConnectPtr conn,
|
xenapiDomainLookupByUUID(virConnectPtr conn,
|
||||||
const unsigned char *uuid)
|
const unsigned char *uuid)
|
||||||
{
|
{
|
||||||
/* vm.get_by_uuid */
|
/* vm.get_by_uuid */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -655,8 +655,8 @@ xenapiDomainLookupByUUID (virConnectPtr conn,
|
|||||||
* or -1 in case of error
|
* or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
xenapiDomainLookupByName (virConnectPtr conn,
|
xenapiDomainLookupByName(virConnectPtr conn,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
/* vm.get_by_name_label */
|
/* vm.get_by_name_label */
|
||||||
xen_vm_set *vms = NULL;
|
xen_vm_set *vms = NULL;
|
||||||
@ -706,7 +706,7 @@ xenapiDomainLookupByName (virConnectPtr conn,
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainSuspend (virDomainPtr dom)
|
xenapiDomainSuspend(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
/* vm.pause() */
|
/* vm.pause() */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -741,7 +741,7 @@ xenapiDomainSuspend (virDomainPtr dom)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainResume (virDomainPtr dom)
|
xenapiDomainResume(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
/* vm.unpause() */
|
/* vm.unpause() */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -820,7 +820,7 @@ xenapiDomainShutdown(virDomainPtr dom)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainReboot (virDomainPtr dom, unsigned int flags)
|
xenapiDomainReboot(virDomainPtr dom, unsigned int flags)
|
||||||
{
|
{
|
||||||
/* vm.clean_reboot */
|
/* vm.clean_reboot */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -912,7 +912,7 @@ xenapiDomainDestroy(virDomainPtr dom)
|
|||||||
* Returns OS version on success or NULL in case of error
|
* Returns OS version on success or NULL in case of error
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
xenapiDomainGetOSType (virDomainPtr dom)
|
xenapiDomainGetOSType(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
xen_vm vm=NULL;
|
xen_vm vm=NULL;
|
||||||
xen_vm_set *vms;
|
xen_vm_set *vms;
|
||||||
@ -949,7 +949,7 @@ xenapiDomainGetOSType (virDomainPtr dom)
|
|||||||
* or 0 in case of error
|
* or 0 in case of error
|
||||||
*/
|
*/
|
||||||
static unsigned long long
|
static unsigned long long
|
||||||
xenapiDomainGetMaxMemory (virDomainPtr dom)
|
xenapiDomainGetMaxMemory(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
int64_t mem_static_max = 0;
|
int64_t mem_static_max = 0;
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -980,7 +980,7 @@ xenapiDomainGetMaxMemory (virDomainPtr dom)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
|
xenapiDomainSetMaxMemory(virDomainPtr dom, unsigned long memory)
|
||||||
{
|
{
|
||||||
/* vm.set_memory_static_max */
|
/* vm.set_memory_static_max */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1015,7 +1015,7 @@ xenapiDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
|
xenapiDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
|
||||||
{
|
{
|
||||||
int64_t maxmem = 0, memory = 0, vcpu = 0;
|
int64_t maxmem = 0, memory = 0, vcpu = 0;
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1108,8 +1108,8 @@ cleanup:
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
xenapiDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
/* vm.set_vcpus_max */
|
/* vm.set_vcpus_max */
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1147,7 +1147,7 @@ xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
xenapiDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||||
{
|
{
|
||||||
return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||||
}
|
}
|
||||||
@ -1159,8 +1159,8 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainPinVcpu (virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
xenapiDomainPinVcpu(virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
||||||
unsigned char *cpumap, int maplen)
|
unsigned char *cpumap, int maplen)
|
||||||
{
|
{
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1200,9 +1200,9 @@ xenapiDomainPinVcpu (virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
|||||||
* Return number of structures filled on success or -1 in case of error
|
* Return number of structures filled on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainGetVcpus (virDomainPtr dom,
|
xenapiDomainGetVcpus(virDomainPtr dom,
|
||||||
virVcpuInfoPtr info, int maxinfo,
|
virVcpuInfoPtr info, int maxinfo,
|
||||||
unsigned char *cpumaps, int maplen)
|
unsigned char *cpumaps, int maplen)
|
||||||
{
|
{
|
||||||
|
|
||||||
xen_vm_set *vms = NULL;
|
xen_vm_set *vms = NULL;
|
||||||
@ -1278,7 +1278,7 @@ xenapiDomainGetVcpus (virDomainPtr dom,
|
|||||||
* Returns Vcpus count on success or -1 in case of error
|
* Returns Vcpus count on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
xenapiDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||||
{
|
{
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
xen_vm_set *vms;
|
xen_vm_set *vms;
|
||||||
@ -1321,7 +1321,7 @@ xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
|||||||
* Returns maximum number of Vcpus on success or -1 in case of error
|
* Returns maximum number of Vcpus on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainGetMaxVcpus (virDomainPtr dom)
|
xenapiDomainGetMaxVcpus(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||||
@ -1380,7 +1380,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
for (i = 0; i < result->size; i++) {
|
for (i = 0; i < result->size; i++) {
|
||||||
if (STREQ(result->contents[i].key, "order")) {
|
if (STREQ(result->contents[i].key, "order")) {
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
while(result->contents[i].val[cnt] != '\0') {
|
while (result->contents[i].val[cnt] != '\0') {
|
||||||
defPtr->os.bootDevs[cnt] = map2LibvirtBootOrder(result->contents[i].val[cnt]);
|
defPtr->os.bootDevs[cnt] = map2LibvirtBootOrder(result->contents[i].val[cnt]);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
@ -1421,7 +1421,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
}
|
}
|
||||||
xen_vm_get_pv_args(session, &value, vm);
|
xen_vm_get_pv_args(session, &value, vm);
|
||||||
if (STRNEQ(value, "")) {
|
if (STRNEQ(value, "")) {
|
||||||
if(!(defPtr->os.cmdline = strdup(value))) {
|
if (!(defPtr->os.cmdline = strdup(value))) {
|
||||||
VIR_FREE(boot_policy);
|
VIR_FREE(boot_policy);
|
||||||
VIR_FREE(value);
|
VIR_FREE(value);
|
||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
@ -1462,7 +1462,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
xen_vm_get_platform(session, &result, vm);
|
xen_vm_get_platform(session, &result, vm);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < result->size; i++) {
|
for (i = 0; i < result->size; i++) {
|
||||||
if (STREQ(result->contents[i].val, "true")) {
|
if (STREQ(result->contents[i].val, "true")) {
|
||||||
if (STREQ(result->contents[i].key, "acpi"))
|
if (STREQ(result->contents[i].key, "acpi"))
|
||||||
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_ACPI);
|
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_ACPI);
|
||||||
@ -1535,8 +1535,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
* Returns number of names provided in the array or -1 in case of error
|
* Returns number of names provided in the array or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiListDefinedDomains (virConnectPtr conn, char **const names,
|
xenapiListDefinedDomains(virConnectPtr conn, char **const names,
|
||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
int i,j=0,doms;
|
int i,j=0,doms;
|
||||||
xen_vm_set *result;
|
xen_vm_set *result;
|
||||||
@ -1582,7 +1582,7 @@ xenapiListDefinedDomains (virConnectPtr conn, char **const names,
|
|||||||
* Returns number of domains found on success or -1 in case of error
|
* Returns number of domains found on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiNumOfDefinedDomains (virConnectPtr conn)
|
xenapiNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
xen_vm_set *result;
|
xen_vm_set *result;
|
||||||
xen_vm_record *record;
|
xen_vm_record *record;
|
||||||
@ -1615,7 +1615,7 @@ xenapiNumOfDefinedDomains (virConnectPtr conn)
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
|
xenapiDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||||
{
|
{
|
||||||
xen_vm_set *vms;
|
xen_vm_set *vms;
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1657,7 +1657,7 @@ xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainCreate (virDomainPtr dom)
|
xenapiDomainCreate(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
return xenapiDomainCreateWithFlags(dom, 0);
|
return xenapiDomainCreateWithFlags(dom, 0);
|
||||||
}
|
}
|
||||||
@ -1669,7 +1669,7 @@ xenapiDomainCreate (virDomainPtr dom)
|
|||||||
* Returns 0 on success or -1 in case of error
|
* Returns 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
xenapiDomainDefineXML (virConnectPtr conn, const char *xml)
|
xenapiDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||||
{
|
{
|
||||||
xen_vm_record *record=NULL;
|
xen_vm_record *record=NULL;
|
||||||
xen_vm vm=NULL;
|
xen_vm vm=NULL;
|
||||||
@ -1755,7 +1755,7 @@ xenapiDomainUndefine(virDomainPtr dom)
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
|
xenapiDomainGetAutostart(virDomainPtr dom, int *autostart)
|
||||||
{
|
{
|
||||||
int i,flag=0;
|
int i,flag=0;
|
||||||
xen_vm_set *vms;
|
xen_vm_set *vms;
|
||||||
@ -1802,7 +1802,7 @@ xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
|
|||||||
* Return 0 on success or -1 in case of error
|
* Return 0 on success or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
|
xenapiDomainSetAutostart(virDomainPtr dom, int autostart)
|
||||||
{
|
{
|
||||||
xen_vm_set *vms;
|
xen_vm_set *vms;
|
||||||
xen_vm vm;
|
xen_vm vm;
|
||||||
@ -1835,7 +1835,7 @@ xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
xenapiDomainGetSchedulerType (virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
xenapiDomainGetSchedulerType(virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
||||||
{
|
{
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
@ -1853,7 +1853,7 @@ xenapiDomainGetSchedulerType (virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
|||||||
* Returns memory size on success or 0 in case of error
|
* Returns memory size on success or 0 in case of error
|
||||||
*/
|
*/
|
||||||
static unsigned long long
|
static unsigned long long
|
||||||
xenapiNodeGetFreeMemory (virConnectPtr conn)
|
xenapiNodeGetFreeMemory(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
xen_host_metrics_set *xen_met_set;
|
xen_host_metrics_set *xen_met_set;
|
||||||
unsigned long long freeMem = 0;
|
unsigned long long freeMem = 0;
|
||||||
@ -1886,8 +1886,8 @@ xenapiDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
|
|||||||
* Returns the number of entries filled in freeMems, or -1 in case of error.
|
* Returns the number of entries filled in freeMems, or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xenapiNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMems,
|
xenapiNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems,
|
||||||
int startCell, int maxCells)
|
int startCell, int maxCells)
|
||||||
{
|
{
|
||||||
if (maxCells > 1 && startCell > 0) {
|
if (maxCells > 1 && startCell > 0) {
|
||||||
xenapiSessionErrorHandler(conn, VIR_ERR_NO_SUPPORT, NULL);
|
xenapiSessionErrorHandler(conn, VIR_ERR_NO_SUPPORT, NULL);
|
||||||
@ -1970,9 +1970,9 @@ static virDriver xenapiDriver = {
|
|||||||
* Returns the driver priority or -1 in case of error.
|
* Returns the driver priority or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xenapiRegister (void)
|
xenapiRegister(void)
|
||||||
{
|
{
|
||||||
return virRegisterDriver (&xenapiDriver);
|
return virRegisterDriver(&xenapiDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -306,7 +306,7 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
|
|||||||
if (virStrToLong_i(num, NULL, 10, &pos) < 0)
|
if (virStrToLong_i(num, NULL, 10, &pos) < 0)
|
||||||
return;
|
return;
|
||||||
if (pos < 0 || pos > max_bits - 1)
|
if (pos < 0 || pos > max_bits - 1)
|
||||||
VIR_WARN ("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
|
VIR_WARN("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
|
||||||
else
|
else
|
||||||
(cpumap)[pos / 8] |= (1 << (pos % 8));
|
(cpumap)[pos / 8] |= (1 << (pos % 8));
|
||||||
num = strtok_r(NULL, ",", &bp);
|
num = strtok_r(NULL, ",", &bp);
|
||||||
@ -342,7 +342,7 @@ mapPowerState(enum xen_vm_power_state state)
|
|||||||
|
|
||||||
/* allocate a flexible array and fill values(key,val) */
|
/* allocate a flexible array and fill values(key,val) */
|
||||||
int
|
int
|
||||||
allocStringMap (xen_string_string_map **strings, char *key, char *val)
|
allocStringMap(xen_string_string_map **strings, char *key, char *val)
|
||||||
{
|
{
|
||||||
int sz = ((*strings) == NULL) ? 0 : (*strings)->size;
|
int sz = ((*strings) == NULL) ? 0 : (*strings)->size;
|
||||||
sz++;
|
sz++;
|
||||||
@ -383,8 +383,8 @@ xenapiSessionErrorHandle(virConnectPtr conn, virErrorNumber errNum,
|
|||||||
|
|
||||||
/* creates network intereface for VM */
|
/* creates network intereface for VM */
|
||||||
static int
|
static int
|
||||||
createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
createVifNetwork(virConnectPtr conn, xen_vm vm, int device,
|
||||||
char *bridge, char *mac)
|
char *bridge, char *mac)
|
||||||
{
|
{
|
||||||
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
||||||
xen_vm xvm = NULL;
|
xen_vm xvm = NULL;
|
||||||
@ -402,7 +402,7 @@ createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
|||||||
xen_network_record *net_rec = NULL;
|
xen_network_record *net_rec = NULL;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
if (xen_network_get_all(session, &net_set)) {
|
if (xen_network_get_all(session, &net_set)) {
|
||||||
for(cnt = 0; cnt < net_set->size; cnt++) {
|
for (cnt = 0; cnt < net_set->size; cnt++) {
|
||||||
if (xen_network_get_record(session, &net_rec, net_set->contents[cnt])) {
|
if (xen_network_get_record(session, &net_rec, net_set->contents[cnt])) {
|
||||||
if (STREQ(net_rec->bridge, bridge)) {
|
if (STREQ(net_rec->bridge, bridge)) {
|
||||||
break;
|
break;
|
||||||
@ -446,8 +446,8 @@ createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
|||||||
|
|
||||||
/* Create a VM record from the XML description */
|
/* Create a VM record from the XML description */
|
||||||
int
|
int
|
||||||
createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
|
createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
|
||||||
xen_vm_record **record, xen_vm *vm)
|
xen_vm_record **record, xen_vm *vm)
|
||||||
{
|
{
|
||||||
char uuidStr[VIR_UUID_STRING_BUFLEN];
|
char uuidStr[VIR_UUID_STRING_BUFLEN];
|
||||||
xen_string_string_map *strings = NULL;
|
xen_string_string_map *strings = NULL;
|
||||||
|
@ -426,8 +426,8 @@ xenParseSxprDisks(virDomainDefPtr def,
|
|||||||
|
|
||||||
src = offset + 1;
|
src = offset + 1;
|
||||||
|
|
||||||
if (STREQ (disk->driverName, "tap") ||
|
if (STREQ(disk->driverName, "tap") ||
|
||||||
STREQ (disk->driverName, "tap2")) {
|
STREQ(disk->driverName, "tap2")) {
|
||||||
char *driverType = NULL;
|
char *driverType = NULL;
|
||||||
|
|
||||||
offset = strchr(src, ':');
|
offset = strchr(src, ':');
|
||||||
@ -470,7 +470,7 @@ xenParseSxprDisks(virDomainDefPtr def,
|
|||||||
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQLEN (dst, "ioemu:", 6))
|
if (STREQLEN(dst, "ioemu:", 6))
|
||||||
dst += 6;
|
dst += 6;
|
||||||
|
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||||
@ -478,9 +478,9 @@ xenParseSxprDisks(virDomainDefPtr def,
|
|||||||
if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_3) {
|
if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_3) {
|
||||||
offset = strrchr(dst, ':');
|
offset = strrchr(dst, ':');
|
||||||
if (offset) {
|
if (offset) {
|
||||||
if (STREQ (offset, ":cdrom")) {
|
if (STREQ(offset, ":cdrom")) {
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||||
} else if (STREQ (offset, ":disk")) {
|
} else if (STREQ(offset, ":disk")) {
|
||||||
/* The default anyway */
|
/* The default anyway */
|
||||||
} else {
|
} else {
|
||||||
/* Unknown, lets pretend its a disk too */
|
/* Unknown, lets pretend its a disk too */
|
||||||
|
@ -1209,7 +1209,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
|
|||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
virConfValuePtr val, tmp;
|
virConfValuePtr val, tmp;
|
||||||
|
|
||||||
if(disk->src) {
|
if (disk->src) {
|
||||||
if (disk->format) {
|
if (disk->format) {
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
|
@ -625,12 +625,12 @@ static int test16(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
if ((fd = open(abs_builddir "/commandhelper.log",
|
if ((fd = open(abs_builddir "/commandhelper.log",
|
||||||
O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0) {
|
O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0) {
|
||||||
printf("Cannot open log file: %s\n", strerror (errno));
|
printf("Cannot open log file: %s\n", strerror(errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
virCommandWriteArgLog(cmd, fd);
|
virCommandWriteArgLog(cmd, fd);
|
||||||
if (VIR_CLOSE(fd) < 0) {
|
if (VIR_CLOSE(fd) < 0) {
|
||||||
printf("Cannot close log file: %s\n", strerror (errno));
|
printf("Cannot close log file: %s\n", strerror(errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
if (fwrite(buffer, 1, len, stdout) != len) {
|
if (fwrite(buffer, 1, len, stdout) != len) {
|
||||||
fprintf(stderr, "Write failed: %s\n", strerror (errno));
|
fprintf(stderr, "Write failed: %s\n", strerror(errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ mymain(void)
|
|||||||
|
|
||||||
if ((driver.caps = testQemuCapsInit()) == NULL)
|
if ((driver.caps = testQemuCapsInit()) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
if((driver.stateDir = strdup("/nowhere")) == NULL)
|
if ((driver.stateDir = strdup("/nowhere")) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
# define DO_TEST_FULL(name, extraFlags, migrateFrom) \
|
# define DO_TEST_FULL(name, extraFlags, migrateFrom) \
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "virrandom.h"
|
#include "virrandom.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virSecurityManagerPtr mgr;
|
virSecurityManagerPtr mgr;
|
||||||
const char *doi, *model;
|
const char *doi, *model;
|
||||||
@ -19,23 +19,23 @@ main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false);
|
mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false);
|
||||||
if (mgr == NULL) {
|
if (mgr == NULL) {
|
||||||
fprintf (stderr, "Failed to start security driver");
|
fprintf(stderr, "Failed to start security driver");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
model = virSecurityManagerGetModel(mgr);
|
model = virSecurityManagerGetModel(mgr);
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Failed to copy secModel model: %s",
|
fprintf(stderr, "Failed to copy secModel model: %s",
|
||||||
strerror (errno));
|
strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
doi = virSecurityManagerGetDOI(mgr);
|
doi = virSecurityManagerGetDOI(mgr);
|
||||||
if (!doi)
|
if (!doi)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Failed to copy secModel DOI: %s",
|
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
||||||
strerror (errno));
|
strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ mymain(void)
|
|||||||
1, testCompareXMLToXMLHelper, &info) < 0) \
|
1, testCompareXMLToXMLHelper, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
} \
|
} \
|
||||||
while(0);
|
while (0);
|
||||||
|
|
||||||
DO_TEST("pool-dir", "vol-file");
|
DO_TEST("pool-dir", "vol-file");
|
||||||
DO_TEST("pool-dir", "vol-file-backing");
|
DO_TEST("pool-dir", "vol-file-backing");
|
||||||
|
@ -216,12 +216,12 @@ virtTestLoadFile(const char *file, char **buf)
|
|||||||
int len, tmplen, buflen;
|
int len, tmplen, buflen;
|
||||||
|
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
fprintf (stderr, "%s: failed to open: %s\n", file, strerror(errno));
|
fprintf(stderr, "%s: failed to open: %s\n", file, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat(fileno(fp), &st) < 0) {
|
if (fstat(fileno(fp), &st) < 0) {
|
||||||
fprintf (stderr, "%s: failed to fstat: %s\n", file, strerror(errno));
|
fprintf(stderr, "%s: failed to fstat: %s\n", file, strerror(errno));
|
||||||
VIR_FORCE_FCLOSE(fp);
|
VIR_FORCE_FCLOSE(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ virtTestLoadFile(const char *file, char **buf)
|
|||||||
tmplen = buflen = st.st_size + 1;
|
tmplen = buflen = st.st_size + 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(*buf, buflen) < 0) {
|
if (VIR_ALLOC_N(*buf, buflen) < 0) {
|
||||||
fprintf (stderr, "%s: larger than available memory (> %d)\n", file, buflen);
|
fprintf(stderr, "%s: larger than available memory (> %d)\n", file, buflen);
|
||||||
VIR_FORCE_FCLOSE(fp);
|
VIR_FORCE_FCLOSE(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ virtTestLoadFile(const char *file, char **buf)
|
|||||||
tmplen -= len;
|
tmplen -= len;
|
||||||
}
|
}
|
||||||
if (ferror(fp)) {
|
if (ferror(fp)) {
|
||||||
fprintf (stderr, "%s: read failed: %s\n", file, strerror(errno));
|
fprintf(stderr, "%s: read failed: %s\n", file, strerror(errno));
|
||||||
VIR_FORCE_FCLOSE(fp);
|
VIR_FORCE_FCLOSE(fp);
|
||||||
VIR_FREE(*buf);
|
VIR_FREE(*buf);
|
||||||
return -1;
|
return -1;
|
||||||
@ -282,7 +282,7 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
|
|||||||
if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
|
if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
open_max = sysconf (_SC_OPEN_MAX);
|
open_max = sysconf(_SC_OPEN_MAX);
|
||||||
for (i = 0; i < open_max; i++) {
|
for (i = 0; i < open_max; i++) {
|
||||||
if (i != stdinfd &&
|
if (i != stdinfd &&
|
||||||
i != pipefd) {
|
i != pipefd) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user