[libvirt] [PATCH] phyp: Verify that domain XML contains at least one disk element
by Matthias Bolte
phypBuildLpar expects that at least one disk element is provided.
---
src/phyp/phyp_driver.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index ab12392..0a7d6f9 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3715,13 +3715,17 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
goto err;
}
- if (def->ndisks > 0) {
- if (!def->disks[0]->src) {
- PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
- _("Field \"<src>\" under \"<disk>\" on the domain XML file is "
- "missing."));
- goto err;
- }
+ if (def->ndisks < 1) {
+ PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
+ _("Domain XML must contain at least one \"<disk>\" element."));
+ goto err;
+ }
+
+ if (!def->disks[0]->src) {
+ PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
+ _("Field \"<src>\" under \"<disk>\" on the domain XML file is "
+ "missing."));
+ goto err;
}
virBufferAddLit(&buf, "mksyscfg");
--
1.7.0.4
14 years, 1 month
[libvirt] [PATCH] PHYP: Checking for NULL values when building new guest
by Eduardo Otubo
When creating a new gust, the function phypBuildLpar() was not
checking for NULL values, making the driver to have a segmentation
fault.
---
src/phyp/phyp_driver.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 251111d..999870e 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3701,6 +3701,25 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
int exit_status = 0;
virBuffer buf = VIR_BUFFER_INITIALIZER;
+ if (!def->name) {
+ VIR_ERROR0(_("Field \"<name>\" on the domain XML file missing."));
+ goto err;
+ } else if (!def->memory) {
+ VIR_ERROR0(_
+ ("Field \"<memory>\" on the domain XML file missing."));
+ goto err;
+ } else if (!def->maxmem) {
+ VIR_ERROR0(_
+ ("Field \"<currentMemory>\" on the domain XML file missing."));
+ goto err;
+ } else if (!def->vcpus) {
+ VIR_ERROR0(_("Field \"<vcpu>\" on the domain XML file missing."));
+ goto err;
+ } else if (!def->disks[0]->src) {
+ VIR_ERROR0(_("Field \"<disk>\" on the domain XML file missing."));
+ goto err;
+ }
+
virBufferAddLit(&buf, "mksyscfg");
if (system_type == HMC)
virBufferVSprintf(&buf, " -m %s", managed_system);
--
1.7.0.4
14 years, 1 month
[libvirt] dumpxml doesn't export 'boot' options
by Jaromír Červenka
Hi again,
I added another boot options to my running domain, like this:
# virsh edit leon.i-tux.cz
<os>
...
<boot dev='cdrom'/>
<bootmenu enable='yes'/>
</os>
(Note: "dev='hd" was already present)
Right after :wq (vim commands) -> # Domain leon.i-tux.cz XML configuration
edited.
Now when I did "virsh dumpxml leon.i-tux.cz" these new boot options are
missing in output. But "cat /etc/libvirt/qemu/leon.i-tux.cz.xml" shows me
these new options and "virsh edit" also. Is it some bug or normal behavior?
I also noticed that these options disappear after restarting libvirt daemon
- but only from "virsh edit", not from /etc/... xml file.
I would like to do some kind of backups of my domains thru dumpxml :) Maybe
the best way will be to backup all in /etc/libvirt.
Thank you,
Jaromír.
14 years, 1 month
[libvirt] Storage volume
by Jaromír Červenka
Hello,
is there any way, how to create storage volume from existing qcow2 image
file? I have XML description for this new volume and image which was used
without xml. But when I tried "vol-create" it automatically deleted this
file and created new one.
Thank you,
Jaromír Červenka
Official openSUSE community member
Web: http://www.cervajz.com/
Jabber: cervajz(a)cervajz.com
MSN: jara.cervenka(a)seznam.cz
Tel.: +420 607 592 687
Alt. e-mails:
jaromir.cervenka(a)opensuse.org,
jaromir.cervenka(a)speel.cz
14 years, 1 month
[libvirt] [PATCH] 1/1: implement usb and pci hot attach in AppArmor driver
by Jamie Strandboge
The AppArmor security driver has partial support for hostdev devices in
that if they already exist in the XML, virt-aa-helper can find them and
add them to the profile. Hot attach does not work[1] because
AppArmorSetSecurityHostdevLabel and AppArmorRestoreSecurityHostdevLabel
are not currently implemented. From the patch description:
Implement AppArmorSetSecurityHostdevLabel() and
AppArmorRestoreSecurityHostdevLabel() for hostdev and pcidev attach.
virt-aa-helper also has to be adjusted because *FileIterate() is used
for pci and usb devices and the corresponding XML for hot attached
hostdev and pcidev is not in the XML passed to virt-aa-helper. The new
'-F filename' option is added to append a rule to the profile as opposed
to the existing '-f filename', which rewrites the libvirt-<uuid>.files
file anew. This new '-F' option will append a rule to an existing
libvirt-<uuid>.files if it exists, otherwise it acts the same as '-f'.
load_profile() and reload_profile() have been adjusted to add an
'append' argument, which when true will use '-F' instead of '-f' when
executing virt-aa-helper.
All existing calls to load_profile() and reload_profile() have been
adjusted to use the old behavior (ie append==false) except
AppArmorSetSavedStateLabel() where it made sense to use the new
behavior.
This patch also adds tests for '-F'
The tests still use the old convention of cat with sed that Eric Blake
mentioned should be improved-- I will be submitting another patch for
this. This patch compiles fine with --enable-compile-warnings=error,
passes the parts of 'make check' that this patch touches (ie, the
daemon-conf fails here, but it always fails for me) and passes
'syntax-check'.
Jamie
[1]https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/640993
--
Jamie Strandboge | http://www.canonical.com
14 years, 1 month