mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Introduce source flags to virDomainGetHostname()
There is a lots of possibilities to retrieve hostname information from domain. Libvirt could use lease information from dnsmasq to get current hostname too. QEMU supports QEMU-agent but it can use lease source. Signed-off-by: Julio Faracco <jcfaracco@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
2033668bc7
commit
3cf12299f6
@ -1567,6 +1567,12 @@ int virDomainSetMemoryStatsPeriod (virDomainPtr domain,
|
|||||||
int virDomainGetMaxVcpus (virDomainPtr domain);
|
int virDomainGetMaxVcpus (virDomainPtr domain);
|
||||||
int virDomainGetSecurityLabel (virDomainPtr domain,
|
int virDomainGetSecurityLabel (virDomainPtr domain,
|
||||||
virSecurityLabelPtr seclabel);
|
virSecurityLabelPtr seclabel);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
VIR_DOMAIN_GET_HOSTNAME_LEASE = (1 << 0), /* Parse DHCP lease file */
|
||||||
|
VIR_DOMAIN_GET_HOSTNAME_AGENT = (1 << 1), /* Query qemu guest agent */
|
||||||
|
} virDomainGetHostnameFlags;
|
||||||
|
|
||||||
char * virDomainGetHostname (virDomainPtr domain,
|
char * virDomainGetHostname (virDomainPtr domain,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int virDomainGetSecurityLabelList (virDomainPtr domain,
|
int virDomainGetSecurityLabelList (virDomainPtr domain,
|
||||||
|
@ -332,6 +332,7 @@ typedef enum {
|
|||||||
VIR_ERR_INVALID_NETWORK_PORT = 105, /* invalid network port object */
|
VIR_ERR_INVALID_NETWORK_PORT = 105, /* invalid network port object */
|
||||||
VIR_ERR_NETWORK_PORT_EXIST = 106, /* the network port already exist */
|
VIR_ERR_NETWORK_PORT_EXIST = 106, /* the network port already exist */
|
||||||
VIR_ERR_NO_NETWORK_PORT = 107, /* network port not found */
|
VIR_ERR_NO_NETWORK_PORT = 107, /* network port not found */
|
||||||
|
VIR_ERR_NO_HOSTNAME = 108, /* no domain's hostname found */
|
||||||
|
|
||||||
# ifdef VIR_ENUM_SENTINELS
|
# ifdef VIR_ENUM_SENTINELS
|
||||||
VIR_ERR_NUMBER_LAST
|
VIR_ERR_NUMBER_LAST
|
||||||
|
@ -11025,12 +11025,13 @@ virDomainGetDiskErrors(virDomainPtr dom,
|
|||||||
/**
|
/**
|
||||||
* virDomainGetHostname:
|
* virDomainGetHostname:
|
||||||
* @domain: a domain object
|
* @domain: a domain object
|
||||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
* @flags: bitwise-OR of virDomainGetHostnameFlags
|
||||||
*
|
*
|
||||||
* Get the hostname for that domain.
|
* Get the hostname for that domain. If no hostname is found,
|
||||||
|
* then an error is raised with VIR_ERR_NO_HOSTNAME code.
|
||||||
*
|
*
|
||||||
* Dependent on hypervisor used, this may require a guest agent to be
|
* Dependent on hypervisor and @flags used, this may require a
|
||||||
* available.
|
* guest agent to be available.
|
||||||
*
|
*
|
||||||
* Returns the hostname which must be freed by the caller, or
|
* Returns the hostname which must be freed by the caller, or
|
||||||
* NULL if there was an error.
|
* NULL if there was an error.
|
||||||
|
@ -296,6 +296,7 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
|
|||||||
case VIR_ERR_NO_DOMAIN_METADATA:
|
case VIR_ERR_NO_DOMAIN_METADATA:
|
||||||
case VIR_ERR_NO_SERVER:
|
case VIR_ERR_NO_SERVER:
|
||||||
case VIR_ERR_NO_CLIENT:
|
case VIR_ERR_NO_CLIENT:
|
||||||
|
case VIR_ERR_NO_HOSTNAME:
|
||||||
return VIR_LOG_DEBUG;
|
return VIR_LOG_DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1233,6 +1233,9 @@ static const virErrorMsgTuple virErrorMsgStrings[] = {
|
|||||||
[VIR_ERR_NO_NETWORK_PORT] = {
|
[VIR_ERR_NO_NETWORK_PORT] = {
|
||||||
N_("network port not found"),
|
N_("network port not found"),
|
||||||
N_("network port not found: %s") },
|
N_("network port not found: %s") },
|
||||||
|
[VIR_ERR_NO_HOSTNAME] = {
|
||||||
|
N_("no hostname found"),
|
||||||
|
N_("no hostname found: %s") },
|
||||||
};
|
};
|
||||||
|
|
||||||
G_STATIC_ASSERT(G_N_ELEMENTS(virErrorMsgStrings) == VIR_ERR_NUMBER_LAST);
|
G_STATIC_ASSERT(G_N_ELEMENTS(virErrorMsgStrings) == VIR_ERR_NUMBER_LAST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user