[libvirt] [PATCH designer] Adapt saner libtool versioning scheme from libvirt
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The current way libtool versioning is calculated has a timebomb
when the package version number changes to 1.0.0, which will
cause the library soname to change. Adapt to the latest libvirt
macros for libtool versioning, which use an explicit variable
LIBVIRT_DESIGNER_SONUM setting for changing soname.
---
configure.ac | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index c999826..2a55f75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,9 +19,47 @@ LIBVIRT_DESIGNER_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
LIBVIRT_DESIGNER_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
LIBVIRT_DESIGNER_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
LIBVIRT_DESIGNER_VERSION=$LIBVIRT_DESIGNER_MAJOR_VERSION.$LIBVIRT_DESIGNER_MINOR_VERSION.$LIBVIRT_DESIGNER_MICRO_VERSION$LIBVIRT_DESIGNER_MICRO_VERSION_SUFFIX
-LIBVIRT_DESIGNER_VERSION_INFO=`expr $LIBVIRT_DESIGNER_MAJOR_VERSION + $LIBVIRT_DESIGNER_MINOR_VERSION`:$LIBVIRT_DESIGNER_MICRO_VERSION:$LIBVIRT_DESIGNER_MINOR_VERSION
LIBVIRT_DESIGNER_VERSION_NUMBER=`expr $LIBVIRT_DESIGNER_MAJOR_VERSION \* 1000000 + $LIBVIRT_DESIGNER_MINOR_VERSION \* 1000 + $LIBVIRT_DESIGNER_MICRO_VERSION`
+# In libtool terminology we need to figure out:
+#
+# CURRENT
+# The most recent interface number that this library implements.
+#
+# REVISION
+# The implementation number of the CURRENT interface.
+#
+# AGE
+# The difference between the newest and oldest interfaces that this
+# library implements.
+#
+# In other words, the library implements all the interface numbers
+# in the range from number `CURRENT - AGE' to `CURRENT'.
+#
+# Libtool assigns the soname version from `CURRENT - AGE', and we
+# don't want that to ever change in libvirt. ie it must always be
+# zero, to produce libvirt.so.0.
+#
+# We would, however, like the libvirt-designer version number reflected
+# in the so version'd symlinks, and this is based on AGE.REVISION
+# eg libvirt-designer.so.0.AGE.REVISION
+#
+# Assuming we do ever want to break soname version, this can
+# toggled. But seriously, don't touch this, unless we explicitly
+# agree to break ABI on the mailing list.
+LIBVIRT_DESIGNER_SONUM=0
+
+# The following examples show what libtool will do
+#
+# Input: 0.9.14 -> libvirt-designer.so.0.9.14
+# Input: 1.0.0 -> libvirt-designer.so.0.1000.0
+# Input: 2.5.8 -> libvirt-designer.so.0.2005.8
+#
+AGE=`expr $LIBVIRT_DESIGNER_MAJOR_VERSION '*' 1000 + $LIBVIRT_DESIGNER_MINOR_VERSION`
+REVISION=$LIBVIRT_DESIGNER_MICRO_VERSION
+CURRENT=`expr $LIBVIRT_DESIGNER_SONUM + $AGE`
+LIBVIRT_DESIGNER_VERSION_INFO=$CURRENT:$REVISION:$AGE
+
AC_SUBST([LIBVIRT_DESIGNER_MAJOR_VERSION])
AC_SUBST([LIBVIRT_DESIGNER_MINOR_VERSION])
AC_SUBST([LIBVIRT_DESIGNER_MICRO_VERSION])
--
1.8.1.4
11 years, 7 months
[libvirt] Reworked patch set to add UID/GID support for containers
by dwalsh@redhat.com
Combined all UID/GID patches, taken into account Dan Berrange feedback.
Now UID will be based off the current UID.
Sandbox Shell is no longer used when using LXC containers. Connect will
now just execute a shell within the container.
[sandbox PATCH 1/6] Add UID/GID support for use with interactive
[sandbox PATCH 2/6] We should not turn on the sanbox shell by
[sandbox PATCH 3/6] Only create the destination directory if it does
11 years, 7 months
[libvirt] [libvirt-designer][PATCH] test: Add new SimpleDisk test
by Michal Privoznik
This test is meant for adding CDROM, floppy and disk to a domain.
For now, each method has _file and _device variant, which are
tested for now.
---
libvirt-designer/test-designer-domain.c | 101 ++++++++++++++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/libvirt-designer/test-designer-domain.c b/libvirt-designer/test-designer-domain.c
index bbd5a28..90f7e68 100644
--- a/libvirt-designer/test-designer-domain.c
+++ b/libvirt-designer/test-designer-domain.c
@@ -125,6 +125,41 @@ static const gchar *capslxcxml =
" </guest>"
"</capabilities>";
+static const gchar *domain_machine_simple_iso_result =
+ "<domain>\n"
+ " <devices>\n"
+ " <disk type=\"file\">\n"
+ " <source file=\"/foo/bar1\"/>\n"
+ " <driver name=\"qemu\" type=\"raw\"/>\n"
+ " <target bus=\"ide\" dev=\"hda\"/>\n"
+ " </disk>\n"
+ " <disk type=\"block\">\n"
+ " <source dev=\"/foo/bar2\"/>\n"
+ " <driver name=\"qemu\" type=\"raw\"/>\n"
+ " <target bus=\"ide\" dev=\"hdb\"/>\n"
+ " </disk>\n"
+ " <disk type=\"file\">\n"
+ " <source file=\"/foo/bar3\"/>\n"
+ " <driver name=\"qemu\" type=\"qcow2\"/>\n"
+ " <target bus=\"ide\" dev=\"hdc\"/>\n"
+ " </disk>\n"
+ " <disk type=\"block\">\n"
+ " <source dev=\"/foo/bar4\"/>\n"
+ " <driver name=\"qemu\" type=\"raw\"/>\n"
+ " <target bus=\"ide\" dev=\"hdd\"/>\n"
+ " </disk>\n"
+ " <disk type=\"file\">\n"
+ " <source file=\"/foo/bar5\"/>\n"
+ " <driver name=\"qemu\" type=\"bochs\"/>\n"
+ " <target bus=\"ide\" dev=\"hde\"/>\n"
+ " </disk>\n"
+ " <disk type=\"block\">\n"
+ " <source dev=\"/foo/bar6\"/>\n"
+ " <driver name=\"qemu\" type=\"raw\"/>\n"
+ " <target bus=\"ide\" dev=\"hdf\"/>\n"
+ " </disk>\n"
+ " </devices>\n"
+ "</domain>";
static void test_domain_machine_setup(GVirDesignerDomain **design, gconstpointer opaque)
{
@@ -142,6 +177,49 @@ static void test_domain_machine_setup(GVirDesignerDomain **design, gconstpointer
}
+static void test_domain_machine_simple_disk_setup(GVirDesignerDomain **design, gconstpointer opaque)
+{
+ GError *error = NULL;
+ GVirConfigDomainDisk *disk;
+ OsinfoOs *os = osinfo_os_new("http://myoperatingsystem/amazing/4.2");
+ OsinfoDb *db = osinfo_db_new();
+ OsinfoPlatform *platform = osinfo_platform_new("http://myhypervisor.org/awesome/6.6.6");
+ GVirConfigCapabilities *caps = gvir_config_capabilities_new_from_xml(capsqemuxml, NULL);
+
+ *design = gvir_designer_domain_new(db, os, platform, caps);
+ g_assert(*design);
+
+ disk = gvir_designer_domain_add_cdrom_file(*design, "/foo/bar1", "raw", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ disk = gvir_designer_domain_add_cdrom_device(*design, "/foo/bar2", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ disk = gvir_designer_domain_add_disk_file(*design, "/foo/bar3", "qcow2", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ disk = gvir_designer_domain_add_disk_device(*design, "/foo/bar4", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ disk = gvir_designer_domain_add_floppy_file(*design, "/foo/bar5", "bochs", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ disk = gvir_designer_domain_add_disk_device(*design, "/foo/bar6", &error);
+ g_assert(disk);
+ g_object_unref(disk);
+
+ g_object_unref(os);
+ g_object_unref(db);
+ g_object_unref(platform);
+ g_object_unref(caps);
+}
+
+
static void test_domain_container_setup(GVirDesignerDomain **design, gconstpointer opaque)
{
OsinfoOs *os = osinfo_os_new("http://myoperatingsystem/amazing/4.2");
@@ -243,6 +321,22 @@ static void test_domain_machine_alt_arch_run(GVirDesignerDomain **design, gconst
g_object_unref(osconfig);
}
+static void test_domain_machine_simple_disk_run(GVirDesignerDomain **design, gconstpointer opaque)
+{
+ GError *error = NULL;
+ gboolean ret;
+ GVirConfigDomain *config;
+ gchar *xml;
+
+ config = gvir_designer_domain_get_config(*design);
+ xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(config));
+ g_test_message("XML %s", xml);
+ g_assert_cmpstr(xml,
+ ==,
+ domain_machine_simple_iso_result);
+ g_free(xml);
+}
+
static void test_domain_container_host_arch_run(GVirDesignerDomain **design, gconstpointer opaque)
{
GError *error = NULL;
@@ -362,5 +456,12 @@ int main(int argc, char **argv)
test_domain_container_setup,
test_domain_container_alt_arch_run,
test_domain_teardown);
+ g_test_add("/TestDesignerDomain/SimpleDisk",
+ GVirDesignerDomain *,
+ &domain,
+ test_domain_machine_simple_disk_setup,
+ test_domain_machine_simple_disk_run,
+ test_domain_teardown);
+
return g_test_run();
}
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH glib] Adopt saner libtool versioning scheme from libvirt
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The current way libtool versioning is calculated has a timebomb
when the package version number changes to 1.0.0, which will
cause the library soname to change. Adapt to the latest libvirt
macros for libtool versioning, which use an explicit variable
LIBVIRT_GLIB_SONUM setting for changing soname.
---
configure.ac | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index cef5025..360c13f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,9 +21,46 @@ LIBVIRT_GLIB_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
LIBVIRT_GLIB_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
LIBVIRT_GLIB_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
LIBVIRT_GLIB_VERSION=$LIBVIRT_GLIB_MAJOR_VERSION.$LIBVIRT_GLIB_MINOR_VERSION.$LIBVIRT_GLIB_MICRO_VERSION$LIBVIRT_GLIB_MICRO_VERSION_SUFFIX
-LIBVIRT_GLIB_VERSION_INFO=`expr $LIBVIRT_GLIB_MAJOR_VERSION + $LIBVIRT_GLIB_MINOR_VERSION`:$LIBVIRT_GLIB_MICRO_VERSION:$LIBVIRT_GLIB_MINOR_VERSION
LIBVIRT_GLIB_VERSION_NUMBER=`expr $LIBVIRT_GLIB_MAJOR_VERSION \* 1000000 + $LIBVIRT_GLIB_MINOR_VERSION \* 1000 + $LIBVIRT_GLIB_MICRO_VERSION`
+# In libtool terminology we need to figure out:
+#
+# CURRENT
+# The most recent interface number that this library implements.
+#
+# REVISION
+# The implementation number of the CURRENT interface.
+#
+# AGE
+# The difference between the newest and oldest interfaces that this
+# library implements.
+#
+# In other words, the library implements all the interface numbers
+# in the range from number `CURRENT - AGE' to `CURRENT'.
+#
+# Libtool assigns the soname version from `CURRENT - AGE', and we
+# don't want that to ever change in libvirt. ie it must always be
+# zero, to produce libvirt.so.0.
+#
+# We would, however, like the libvirt-glib version number reflected
+# in the so version'd symlinks, and this is based on AGE.REVISION
+# eg libvirt-glib.so.0.AGE.REVISION
+#
+# Assuming we do ever want to break soname version, this can
+# toggled. But seriously, don't ever touch this.
+LIBVIRT_GLIB_SONUM=0
+
+# The following examples show what libtool will do
+#
+# Input: 0.9.14 -> libvirt-glib.so.0.9.14
+# Input: 1.0.0 -> libvirt-glib.so.0.1000.0
+# Input: 2.5.8 -> libvirt-glib.so.0.2005.8
+#
+AGE=`expr $LIBVIRT_GLIB_MAJOR_VERSION '*' 1000 + $LIBVIRT_GLIB_MINOR_VERSION`
+REVISION=$LIBVIRT_GLIB_MICRO_VERSION
+CURRENT=`expr $LIBVIRT_GLIB_SONUM + $AGE`
+LIBVIRT_GLIB_VERSION_INFO=$CURRENT:$REVISION:$AGE
+
AC_SUBST([LIBVIRT_GLIB_MAJOR_VERSION])
AC_SUBST([LIBVIRT_GLIB_MINOR_VERSION])
AC_SUBST([LIBVIRT_GLIB_MICRO_VERSION])
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH designer] Increment soname + symbol versions
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The ABI of some methods was explicitly broken, so the soname
and symbol versions must all be incremented to reflect the
ABI incompatibility
---
configure.ac | 2 +-
libvirt-designer/libvirt-designer.sym | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2a55f75..e70b2e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ LIBVIRT_DESIGNER_VERSION_NUMBER=`expr $LIBVIRT_DESIGNER_MAJOR_VERSION \* 1000000
# Assuming we do ever want to break soname version, this can
# toggled. But seriously, don't touch this, unless we explicitly
# agree to break ABI on the mailing list.
-LIBVIRT_DESIGNER_SONUM=0
+LIBVIRT_DESIGNER_SONUM=1
# The following examples show what libtool will do
#
diff --git a/libvirt-designer/libvirt-designer.sym b/libvirt-designer/libvirt-designer.sym
index 7a24f2c..6e2e231 100644
--- a/libvirt-designer/libvirt-designer.sym
+++ b/libvirt-designer/libvirt-designer.sym
@@ -1,4 +1,4 @@
-LIBVIRT_DESIGNER_0.0.1 {
+LIBVIRT_DESIGNER_0.0.2 {
global:
gvir_designer_init;
gvir_designer_init_check;
--
1.8.1.4
11 years, 7 months
[libvirt] [libvirt-designer][PATCH 1/2] cfg.mk: Update list of syntax-check exceptions
by Michal Privoznik
The bindtextdomain syntax-check macro is doing some dumb
checking: each file containing '\<main *(' must call
bindtextdomain. Even if it's mentioned inside a comment block,
which we do as of e71ad8e13e7.
---
Or shall we drop bindtextdomain rule instead?
cfg.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 54f62d4..1e4b31d 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -104,8 +104,8 @@ sc_copyright_format:
prev_version_file = /dev/null
-exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-designer/test)|(libvirt-designer/libvirt-designer-init-*)|(examples/virtxml.c)
+exclude_file_name_regexp--sc_bindtextdomain = ^libvirt-designer/(test|libvirt-designer-main\.c)|^examples/virtxml\.c$$
-exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch]
+exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch]$$
-exclude_file_name_regexp--sc_prohibit_strcmp = ^libvirt-designer/libvirt-designer-init-qemu.c
+exclude_file_name_regexp--sc_prohibit_strcmp = ^libvirt-designer/libvirt-designer-init-qemu.c$$
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] Virsh command vol-rename
by harryxiyou@gmail.com
From: Harry Wei <harryxiyou(a)gmail.com>
Vol-rename is a convenience function, requiring when
one wanna rename a volume name.
Signed-off-by: Harry Wei <harryxiyou(a)gmail.com>
---
tools/virsh-volume.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 0ca295f..8757d54 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -490,6 +490,103 @@ cleanup:
}
/*
+ * "vol-rename" command
+ */
+static const vshCmdInfo info_vol_rename[] = {
+ {.name = "help",
+ .data = N_("rename a volume.")
+ },
+ {.name = "desc",
+ .data = N_("Rename an existing volume.")
+ },
+ {.name = NULL}
+};
+
+static const vshCmdOptDef opts_vol_rename[] = {
+ {.name = "vol",
+ .type = VSH_OT_DATA,
+ .flags = VSH_OFLAG_REQ,
+ .help = N_("orig vol name or key")
+ },
+ {.name = "newname",
+ .type = VSH_OT_DATA,
+ .flags = VSH_OFLAG_REQ,
+ .help = N_("new name")
+ },
+ {.name = "pool",
+ .type = VSH_OT_STRING,
+ .help = N_("pool name or uuid")
+ },
+ {.name = NULL}
+};
+
+static bool
+cmdVolRename(vshControl *ctl, const vshCmd *cmd)
+{
+ virStoragePoolPtr origpool = NULL;
+ virStorageVolPtr origvol = NULL, newvol = NULL;
+ const char *origname = NULL;
+ const char *name = NULL;
+ char *origxml = NULL;
+ xmlChar *newxml = NULL;
+ bool ret = false;
+ unsigned int flags = 0;
+
+ if (!(origvol = vshCommandOptVol(ctl, cmd, "vol", "pool", &origname)))
+ goto cleanup;
+
+ origpool = virStoragePoolLookupByVolume(origvol);
+ if (!origpool) {
+ vshError(ctl, "%s", _("failed to get parent pool"));
+ goto cleanup;
+ }
+
+ if (vshCommandOptStringReq(ctl, cmd, "newname", &name) < 0)
+ goto cleanup;
+
+ origxml = virStorageVolGetXMLDesc(origvol, 0);
+ if (!origxml)
+ goto cleanup;
+
+ newxml = vshMakeCloneXML(origxml, name);
+ if (!newxml) {
+ vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+ goto cleanup;
+ }
+
+ newvol = virStorageVolCreateXMLFrom(origpool, (char *) newxml, origvol, flags);
+
+ if (newvol != NULL) {
+ vshPrint(ctl, _("Vol %s cloned from %s\n"),
+ virStorageVolGetName(newvol), virStorageVolGetName(origvol));
+ } else {
+ vshError(ctl, _("Failed to clone vol from %s"),
+ virStorageVolGetName(origvol));
+ goto cleanup;
+ }
+
+ if (virStorageVolDelete(origvol, 0) == 0) {
+ vshPrint(ctl, _("Vol %s deleted\n"), origname);
+ } else {
+ vshError(ctl, _("Failed to delete vol %s"), origname);
+ goto cleanup;
+ }
+
+ ret = true;
+
+cleanup:
+ VIR_FREE(origxml);
+ xmlFree(newxml);
+ if (origvol)
+ virStorageVolFree(origvol);
+ if (newvol)
+ virStorageVolFree(newvol);
+ if (origpool)
+ virStoragePoolFree(origpool);
+ return ret;
+}
+
+/*
* "vol-clone" command
*/
static const vshCmdInfo info_vol_clone[] = {
@@ -1752,6 +1849,12 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd)
}
const vshCmdDef storageVolCmds[] = {
+ {.name = "vol-rename",
+ .handler = cmdVolRename,
+ .opts = opts_vol_rename,
+ .info = info_vol_rename,
+ .flags = 0
+ },
{.name = "vol-clone",
.handler = cmdVolClone,
.opts = opts_vol_clone,
--
1.7.9.5
11 years, 7 months
[libvirt] [PATCH] qemu: fix default spice password setting
by Ján Tomko
Set spice password even if default VNC password hasn't been set.
https://bugzilla.redhat.com/show_bug.cgi?id=953720
---
src/qemu/qemu_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a6c75cb..4f39ca4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2714,7 +2714,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
int ret = -1;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- if (!auth->passwd && !cfg->vncPassword) {
+ if (!auth->passwd && !defaultPasswd) {
ret = 0;
goto cleanup;
}
--
1.8.1.5
11 years, 7 months
[libvirt] [libvirt-php PATCH] Fixed the libvirt_domain_disk_add and libvirt_domain_disk_remove so that they can handle block devices, and can update a running domain
by Martijn Otto
---
src/libvirt-php.c | 246 +++++++++++++++++++++++++----------------------------
1 file changed, 114 insertions(+), 132 deletions(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 0b8345a..24e8606 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -4232,11 +4232,12 @@ PHP_FUNCTION(libvirt_domain_change_boot_devices)
Since version: 0.4.2
Description: Function is used to add the disk to the virtual machine using set of API functions to make it as simple as possible for the user
Arguments: @res [resource]: libvirt domain resource
- @img [string]: string for the image file on the host system
+ @path [string]: string for the image file or device node on the system
@dev [string]: string for the device to be presented to the guest (e.g. hda)
@typ [string]: bus type for the device in the guest, usually 'ide' or 'scsi'
- @driver [string]: driver type to be specified, like 'raw' or 'qcow2'
- @flags [int]: flags for getting the XML description
+ @driver [string]: driver type to be specified, like 'raw' or 'qcow2'
+ @cache [string]: cache mode, can be 'default', 'none', 'writeback' or 'writethrough'
+ @io [string]: io mode, can be 'default', 'native' or 'threads'
Returns: new domain resource
*/
PHP_FUNCTION(libvirt_domain_disk_add)
@@ -4244,46 +4245,40 @@ PHP_FUNCTION(libvirt_domain_disk_add)
php_libvirt_domain *domain=NULL;
zval *zdomain;
char *tmp1 = NULL;
- char *tmp2 = NULL;
char *xml;
- char *img = NULL;
- int img_len;
+ char *path = NULL;
+ int path_len;
char *dev = NULL;
int dev_len;
char *driver = NULL;
int driver_len;
char *typ = NULL;
int typ_len;
- char *new_xml = NULL;
- int new_len;
+ char *cache = "default";
+ int cache_len;
+ char *io = "default";
+ int io_len;
char new[4096] = { 0 };
- long xflags = 0;
int retval = -1;
- int pos = -1;
- php_libvirt_domain *res_domain = NULL;
- php_libvirt_connection *conn = NULL;
- virDomainPtr dom=NULL;
+ int block_device = 0; // whether the path leads to a block device (1) or to an image (0)
+ char cache_attr[32] = ""; // store the complete cache attribute, or an empty string to denote default
+ char io_attr[32] = ""; // store the complete io attribute, or an empty string to denote default
- GET_DOMAIN_FROM_ARGS("rssss|l",&zdomain,&img,&img_len,&dev,&dev_len,&typ,&typ_len,&driver,&driver_len,&xflags);
+ GET_DOMAIN_FROM_ARGS("rssss|ss",&zdomain,&path,&path_len,&dev,&dev_len,&typ,&typ_len,&driver,&driver_len,&cache,&cache_len,&io,&io_len);
- DPRINTF("%s: Domain %p, device = %s, image = %s, type = %s, driver = %s\n", PHPFUNC,
- domain->domain, dev, img, typ, driver);
+ DPRINTF("%s: Domain %p, device = %s, path = %s, type = %s, driver = %s, cache = %s, io = %s\n", PHPFUNC,
+ domain->domain, dev, path, typ, driver, cache, io);
- xml=virDomainGetXMLDesc(domain->domain,xflags);
+ // check whether the path leads to a block device
+ if (strncmp(path, "/dev/", 5) == 0)
+ block_device = 1;
+
+ xml=virDomainGetXMLDesc(domain->domain, 0);
if (xml==NULL) {
set_error_if_unset("Cannot get the XML description" TSRMLS_CC);
RETURN_FALSE;
}
- snprintf(new, sizeof(new), "//domain/devices/disk/source[@file=\"%s\"]/./@file", img);
- tmp1 = get_string_from_xpath(xml, new, NULL, &retval);
- if (tmp1 != NULL) {
- free(tmp1);
- snprintf(new, sizeof(new), "Domain already has image <i>%s</i> connected", img);
- set_error(new TSRMLS_CC);
- RETURN_FALSE;
- }
-
snprintf(new, sizeof(new), "//domain/devices/disk/target[@dev='%s']/./@dev", dev);
tmp1 = get_string_from_xpath(xml, new, NULL, &retval);
if (tmp1 != NULL) {
@@ -4293,58 +4288,72 @@ PHP_FUNCTION(libvirt_domain_disk_add)
RETURN_FALSE;
}
- if (access(img, R_OK) != 0) {
- snprintf(new, sizeof(new), "Image file <i>%s</i> doesn't exist", img);
- set_error(new TSRMLS_CC);
- RETURN_FALSE;
- }
-
- snprintf(new, sizeof(new),
- " <disk type='file' device='disk'>\n"
- " <driver name='qemu' type='%s'/>\n"
- " <source file='%s'/>\n"
- " <target dev='%s' bus='%s'/>\n"
- " </disk>", driver, img, dev, typ);
- tmp1 = strstr(xml, "</emulator>") + strlen("</emulator>");
- pos = strlen(xml) - strlen(tmp1);
+ // do we want to use a non-default cache mode?
+ if (strncmp(cache, "default", 7) != 0)
+ snprintf(cache_attr, sizeof(cache_attr), "cache='%s'", cache);
- tmp2 = emalloc( ( pos + 1 )* sizeof(char) );
- memset(tmp2, 0, pos + 1);
- memcpy(tmp2, xml, pos);
+ // or a non-default io mode perhaps?
+ if (strncmp(io, "default", 7) != 0)
+ snprintf(io_attr, sizeof(io_attr), "io='%s'", io);
- new_len = strlen(tmp1) + strlen(tmp2) + strlen(new) + 2;
- new_xml = emalloc( new_len * sizeof(char) );
- snprintf(new_xml, new_len, "%s\n%s%s", tmp2, new, tmp1);
-
- conn = domain->conn;
+ // check for valid image file or device node
+ if (block_device == 0) {
+ // check whether the image already appears in the xml
+ snprintf(new, sizeof(new), "//domain/devices/disk/source[@file=\"%s\"]/./@file", path);
+ tmp1 = get_string_from_xpath(xml, new, NULL, &retval);
+ if (tmp1 != NULL) {
+ free(tmp1);
+ snprintf(new, sizeof(new), "Domain already has image <i>%s</i> connected", path);
+ set_error(new TSRMLS_CC);
+ RETURN_FALSE;
+ }
- virDomainUndefine(domain->domain);
- virDomainFree(domain->domain);
+ if (access(path, R_OK) != 0) {
+ snprintf(new, sizeof(new), "Image file <i>%s</i> doesn't exist", path);
+ set_error(new TSRMLS_CC);
+ RETURN_FALSE;
+ }
- retval = virDomainFree(domain->domain);
- if (retval != 0) {
- DPRINTF("%s: Cannot free domain %p, error code = %d (%s)\n", PHPFUNC, domain->domain, retval, LIBVIRT_G(last_error));
- }
+ // create the xml to add the device
+ snprintf(new, sizeof(new),
+ " <disk type='file' device='disk'>\n"
+ " <driver name='qemu' type='%s' %s %s/>\n"
+ " <source file='%s'/>\n"
+ " <target dev='%s' bus='%s'/>\n"
+ " </disk>", driver, cache_attr, io_attr, path, dev, typ);
+ }
else {
- resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, domain->domain, 0 TSRMLS_CC);
- DPRINTF("%s: Domain %p freed\n", PHPFUNC, domain->domain);
- }
-
- dom=virDomainDefineXML(conn->conn, new_xml);
- if (dom==NULL) {
- DPRINTF("%s: Function failed, restoring original XML\n", PHPFUNC);
- dom=virDomainDefineXML(conn->conn, xml);
- if (dom == NULL)
+ // check whether the device already appears in the xml
+ snprintf(new, sizeof(new), "//domain/devices/disk/source[@dev=\"%s\"]/./@dev", path);
+ tmp1 = get_string_from_xpath(xml, new, NULL, &retval);
+ if (tmp1 != NULL) {
+ free(tmp1);
+ snprintf(new, sizeof(new), "Domain already has device <i>%s</i> connected", path);
+ set_error(new TSRMLS_CC);
RETURN_FALSE;
+ }
+
+ // create the xml to add the device
+ snprintf(new, sizeof(new),
+ " <disk type='block' device='disk'>\n"
+ " <driver name='qemu' type='%s' %s %s/>\n"
+ " <source dev='%s'/>\n"
+ " <target dev='%s' bus='%s'/>\n"
+ " </disk>", driver, cache_attr, io_attr, path, dev, typ);
}
- res_domain = emalloc(sizeof(php_libvirt_domain));
- res_domain->domain = dom;
- res_domain->conn = conn;
+ // attach the disk to the domain
+ retval = virDomainAttachDeviceFlags(domain->domain, new, VIR_DOMAIN_AFFECT_CURRENT);
+ if (retval != 0) {
+ snprintf(new, sizeof(new), "%s: Cannot add device to domain %p, error code = %d (%s)\n", PHPFUNC, domain->domain, retval, LIBVIRT_G(last_error));
+ set_error(new TSRMLS_CC);
+ RETURN_FALSE;
+ }
- DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain);
- resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->domain, 1 TSRMLS_CC);
- ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain);
+ // the disk was successfully added
+ DPRINTF("%s: returning %p\n", PHPFUNC, domain->domain);
+ zend_list_addref(Z_LVAL_P(zdomain));
+ RETURN_RESOURCE(Z_LVAL_P(zdomain));
}
/*
@@ -4360,96 +4369,69 @@ PHP_FUNCTION(libvirt_domain_disk_remove)
{
php_libvirt_domain *domain=NULL;
zval *zdomain;
- char *tmp1 = NULL;
- char *tmp2 = NULL;
+ char *type = NULL;
+ char *path = NULL;
+ char *source = NULL;
char *xml;
char *dev = NULL;
int dev_len;
char *new_xml = NULL;
int new_len;
char new[4096] = { 0 };
- long xflags = 0;
int retval = -1;
- int pos = -1;
- int i, idx = 0;
- php_libvirt_domain *res_domain=NULL;
- php_libvirt_connection *conn = NULL;
- virDomainPtr dom = NULL;
- GET_DOMAIN_FROM_ARGS("rs|l",&zdomain,&dev,&dev_len,&xflags);
+ GET_DOMAIN_FROM_ARGS("rs|l",&zdomain,&dev,&dev_len);
DPRINTF("%s: Trying to remove %s from domain %p\n", PHPFUNC, dev, domain->domain);
- xml=virDomainGetXMLDesc(domain->domain,xflags);
+ xml=virDomainGetXMLDesc(domain->domain, 0);
if (xml==NULL) {
set_error_if_unset("Cannot get the XML description" TSRMLS_CC);
RETURN_FALSE;
}
- snprintf(new, sizeof(new), "//domain/devices/disk/target[@dev='%s']/./@dev", dev);
- tmp1 = get_string_from_xpath(xml, new, NULL, &retval);
- if (tmp1 == NULL) {
+ // check for the type, if no result is found, the disk does not exist
+ snprintf(new, sizeof(new), "//domain/devices/disk/target[@dev='%s']/../@type", dev);
+ type = get_string_from_xpath(xml, new, NULL, &retval);
+ if (type == NULL) {
snprintf(new, sizeof(new), "Device <i>%s</i> is not connected to the guest", dev);
set_error(new TSRMLS_CC);
RETURN_FALSE;
}
- free(tmp1);
-
- snprintf(new, sizeof(new), "<target dev='%s'", dev);
- tmp1 = strstr(xml, new) + strlen(new);
- pos = strlen(xml) - strlen(tmp1);
-
- tmp2 = emalloc( ( pos + 1 )* sizeof(char) );
- memset(tmp2, 0, pos + 1);
- memcpy(tmp2, xml, pos);
-
- for (i = strlen(tmp2) - 5; i > 0; i--)
- if ((tmp2[i] == '<') && (tmp2[i+1] == 'd')
- && (tmp2[i+2] == 'i') && (tmp2[i+3] == 's')
- && (tmp2[i+4] == 'k')) {
- tmp2[i-5] = 0;
- break;
- }
+ // are we dealing with a file or a block device?
+ if (strcmp(type, "file") == 0)
+ source = "file";
+ else
+ source = "dev";
- for (i = 0; i < strlen(tmp1) - 7; i++)
- if ((tmp1[i] == '<') && (tmp1[i+1] == '/')
- && (tmp1[i+2] == 'd') && (tmp1[i+3] == 'i')
- && (tmp1[i+4] == 's') && (tmp1[i+5] == 'k')
- && (tmp1[i+6] == '>')) {
- idx = i + 6;
- break;
- }
+ // retrieve the device or file
+ snprintf(new, sizeof(new), "//domain/devices/disk/target[@dev='%s']/../source/@%s", dev, source);
+ path = get_string_from_xpath(xml, new, NULL, &retval);
- new_len = strlen(tmp2) + (strlen(tmp1) - idx);
- new_xml = emalloc( new_len * sizeof(char) );
- memset(new_xml, 0, new_len);
- strcpy(new_xml, tmp2);
- for (i = idx; i < strlen(tmp1) - 1; i++)
- new_xml[ strlen(tmp2) + i - idx ] = tmp1[i];
+ // define the xml to remove the device
+ snprintf(new, sizeof(new),
+ " <disk type='%s' device='disk'>"
+ " <source %s='%s'/>"
+ " <target dev='%s'/>"
+ " </disk>", type, source, path, dev);
- conn = domain->conn;
- virDomainUndefine(domain->domain);
+ // cleanup temporary resources
+ free(type);
+ free(path);
- retval = virDomainFree(domain->domain);
+ // remove the disk from the domain
+ retval = virDomainDetachDeviceFlags(domain->domain, new, VIR_DOMAIN_AFFECT_CURRENT);
if (retval != 0) {
- DPRINTF("%s: Cannot free domain %p, error code = %d (%s)\n", PHPFUNC, domain->domain, retval, LIBVIRT_G(last_error));
- }
- else {
- resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, domain->domain, 0 TSRMLS_CC);
- DPRINTF("%s: Domain %p freed\n", PHPFUNC, domain->domain);
+ snprintf(new, sizeof(new), "%s: Cannot remove device from domain %p, error code = %d (%s)\n", PHPFUNC, domain->domain, retval, LIBVIRT_G(last_error));
+ set_error(new TSRMLS_CC);
+ RETURN_FALSE;
}
- dom=virDomainDefineXML(conn->conn,new_xml);
- if (dom==NULL) RETURN_FALSE;
-
- res_domain = emalloc(sizeof(php_libvirt_domain));
- res_domain->domain = dom;
- res_domain->conn = conn;
-
- DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain);
- resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->domain, 1 TSRMLS_CC);
- ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain);
+ // the disk was successfully removed
+ DPRINTF("%s: returning %p\n", PHPFUNC, domain->domain);
+ zend_list_addref(Z_LVAL_P(zdomain));
+ RETURN_RESOURCE(Z_LVAL_P(zdomain));
}
/*
@@ -5172,7 +5154,7 @@ PHP_FUNCTION(libvirt_domain_get_block_info) {
GET_DOMAIN_FROM_ARGS("rs",&zdomain,&dev,&dev_len);
/* Get XML for the domain */
- xml=virDomainGetXMLDesc(domain->domain, VIR_DOMAIN_XML_INACTIVE);
+ xml=virDomainGetXMLDesc(domain->domain, 0);
if (xml==NULL) {
set_error("Cannot get domain XML" TSRMLS_CC);
RETURN_FALSE;
--
1.7.9.5
11 years, 7 months
[libvirt] [PATCH v4 1/2 RESEND] Add NVRAM device
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
For pSeries guest in QEMU, NVRAM is one kind of spapr-vio device.
Users are allowed to specify spapr-vio devices'address.
But NVRAM is not supported in libvirt. So this patch is to
add NVRAM device to allow users to specify its address.
In QEMU, NVRAM device's address is specified by
"-global spapr-nvram.reg=xxxxx".
In libvirt, XML file is defined as the following:
<nvram>
<address type='spapr-vio' reg='0x3000'/>
</nvram>
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v4 -> v3:
* Sperate NVRAM definition from qemu command line parser.
v3 -> v2:
* Add NVRAM in domaincommon.rng and formatdomain.xml.in suggested by Daniel P.Berrange
* Add NVRAM test cases suggested by Daniel P.Berrange
* Remove nvram allocation when it is not specified suggested by Daniel P.Berrange
* Add several error reports suggested by Daniel P.Berrange
v2 -> v1:
* Add NVRAM parameters parsing in qemuParseCommandLine
docs/formatdomain.html.in | 35 ++++++++++++++++++++
docs/schemas/domaincommon.rng | 10 ++++++
src/conf/domain_conf.c | 76 +++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 10 ++++++
4 files changed, 131 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d400e35..f590304 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4415,6 +4415,41 @@ qemu-kvm -net nic,model=? /dev/null
</dl>
+ <h4><a name="elementsNVRAM">NVRAM device</a></h4>
+ <p>
+ One NVRAM device is always added to pSeries guests on PPC64.
+ And on PPC64, NVRAM devices' address type are VIO which
+ allows users to change.<code>nvram</code> element in XML file
+ is provided to specify its address.
+ Currently, libvirt only considers configuration for pSeries guests.
+ </p>
+ <p>
+ Example: usage of NVRAM configuration
+ </p>
+<pre>
+ ...
+ <devices>
+ <nvram>
+ <address type='spapr-vio' reg='0x3000'/>
+ </nvram>
+ </devices>
+ ...
+</pre>
+ <dl>
+ <dt><code>spapr-vio</code></dt>
+ <dd>
+ <p>
+ VIO device address type, this is only for PPC64.
+ </p>
+ </dd>
+ <dt><code>reg</code></dt>
+ <dd>
+ <p>
+ Devices' address
+ </p>
+ </dd>
+ </dl>
+
<h3><a name="seclabel">Security label</a></h3>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2c31f76..2b58d95 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2764,6 +2764,13 @@
</optional>
</element>
</define>
+ <define name="nvram">
+ <element name="nvram">
+ <optional>
+ <ref name="address"/>
+ </optional>
+ </element>
+ </define>
<define name="memballoon">
<element name="memballoon">
<attribute name="model">
@@ -3208,6 +3215,9 @@
<optional>
<ref name="memballoon"/>
</optional>
+ <optional>
+ <ref name="nvram"/>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 36a46da..3a5e59a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -193,6 +193,7 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"smartcard",
"chr",
"memballoon",
+ "nvram",
"rng")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
@@ -1552,6 +1553,16 @@ void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def)
VIR_FREE(def);
}
+void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def)
+{
+ if (!def)
+ return;
+
+ virDomainDeviceInfoClear(&def->info);
+
+ VIR_FREE(def);
+}
+
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def)
{
if (!def)
@@ -1718,6 +1729,7 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
break;
}
@@ -1910,6 +1922,7 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainWatchdogDefFree(def->watchdog);
virDomainMemballoonDefFree(def->memballoon);
+ virDomainNVRAMDefFree(def->nvram);
for (i = 0; i < def->nseclabels; i++)
virSecurityLabelDefFree(def->seclabels[i]);
@@ -2478,6 +2491,12 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
if (cb(def, &device, &def->rng->info, opaque) < 0)
return -1;
}
+ if (def->nvram) {
+ device.type = VIR_DOMAIN_DEVICE_NVRAM;
+ device.data.nvram = def->nvram;
+ if (cb(def, &device, &def->nvram->info, opaque) < 0)
+ return -1;
+ }
device.type = VIR_DOMAIN_DEVICE_HUB;
for (i = 0; i < def->nhubs ; i++) {
device.data.hub = def->hubs[i];
@@ -2509,6 +2528,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_RNG:
break;
@@ -7994,6 +8014,23 @@ error:
goto cleanup;
}
+static virDomainNVRAMDefPtr
+virDomainNVRAMDefParseXML(const xmlNodePtr node,
+ unsigned int flags)
+{
+ virDomainNVRAMDefPtr def;
+
+ if (VIR_ALLOC(def) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ if ( virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0 )
+ return NULL;
+
+ return def;
+}
+
static virSysinfoDefPtr
virSysinfoParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt)
@@ -11105,6 +11142,26 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes);
}
+ def->nvram = NULL;
+ if ((n = virXPathNodeSet("./devices/nvram", ctxt, &nodes)) < 0) {
+ goto error;
+ }
+
+ if (n > 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single nvram device is supported"));
+ goto error;
+ }
+
+ if (n > 0) {
+ virDomainNVRAMDefPtr nvram =
+ virDomainNVRAMDefParseXML(nodes[0], flags);
+ if (!nvram)
+ goto error;
+ def->nvram = nvram;
+ VIR_FREE(nodes);
+ }
+
/* analysis of the hub devices */
if ((n = virXPathNodeSet("./devices/hub", ctxt, &nodes)) < 0) {
goto error;
@@ -14159,6 +14216,21 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
}
static int
+virDomainNVRAMDefFormat(virBufferPtr buf,
+ virDomainNVRAMDefPtr def,
+ unsigned int flags)
+{
+ virBufferAsprintf(buf, " <nvram>\n");
+ if (virDomainDeviceInfoIsSet(&def->info, flags))
+ if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
+ return -1;
+
+ virBufferAddLit(buf, " </nvram>\n");
+
+ return 0;
+}
+
+static int
virDomainSysinfoDefFormat(virBufferPtr buf,
virSysinfoDefPtr def)
{
@@ -15469,6 +15541,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->rng)
virDomainRNGDefFormat(buf, def->rng, flags);
+ if (def->nvram)
+ virDomainNVRAMDefFormat(buf, def->nvram, flags);
+
virBufferAddLit(buf, " </devices>\n");
virBufferAdjustIndent(buf, 2);
@@ -16749,6 +16824,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Copying definition of '%d' type "
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3ab0f15..d98bec1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -109,6 +109,9 @@ typedef virDomainChrDef *virDomainChrDefPtr;
typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
+typedef struct _virDomainNVRAMDef virDomainNVRAMDef;
+typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;
+
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
@@ -137,6 +140,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_SMARTCARD,
VIR_DOMAIN_DEVICE_CHR,
VIR_DOMAIN_DEVICE_MEMBALLOON,
+ VIR_DOMAIN_DEVICE_NVRAM,
VIR_DOMAIN_DEVICE_RNG,
VIR_DOMAIN_DEVICE_LAST
@@ -163,6 +167,7 @@ struct _virDomainDeviceDef {
virDomainSmartcardDefPtr smartcard;
virDomainChrDefPtr chr;
virDomainMemballoonDefPtr memballoon;
+ virDomainNVRAMDefPtr nvram;
virDomainRNGDefPtr rng;
} data;
};
@@ -1442,6 +1447,9 @@ struct _virDomainMemballoonDef {
virDomainDeviceInfo info;
};
+struct _virDomainNVRAMDef {
+ virDomainDeviceInfo info;
+};
enum virDomainSmbiosMode {
VIR_DOMAIN_SMBIOS_NONE = 0,
@@ -1883,6 +1891,7 @@ struct _virDomainDef {
/* Only 1 */
virDomainWatchdogDefPtr watchdog;
virDomainMemballoonDefPtr memballoon;
+ virDomainNVRAMDefPtr nvram;
virCPUDefPtr cpu;
virSysinfoDefPtr sysinfo;
virDomainRedirFilterDefPtr redirfilter;
@@ -2041,6 +2050,7 @@ int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def);
void virDomainSoundDefFree(virDomainSoundDefPtr def);
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
+void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
void virDomainVideoDefFree(virDomainVideoDefPtr def);
virDomainHostdevDefPtr virDomainHostdevDefAlloc(void);
--
1.8.1.4
11 years, 7 months