[libvirt] libvirt disk labels and QEMU drive host alias generation
by Kashyap Chamarthy
Summary
-------
It seems like libvirt is generating the same QEMU drive host
alias ('drive-virtio-disk%d') for different two disk labels (vdb, vdb1).
[Refer the contextual root cause analysis discussion at the end with
Laine & Peter.]
Let's take a quick example to demonstrate the issue.
On a guest that is shut down, attach a couplee of disks with labels
'vdb', and 'vdb1'
$ sudo virsh attach-disk cvm1 \
/export/vmimages/1.raw vdb --config
$ sudo virsh attach-disk cvm1 \
/export/vmimages/1.raw vdb1 --config
$ virsh domblklist cvm1
Target Source
------------------------------------------------
vda /var/lib/libvirt/images/cirros-0.3.3-x86_64-disk.img
vdb /export/vmimages/1.raw
vdb1 /export/vmimages/1.raw
Which results in guest XML:
[...]
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/export/vmimages/1.raw'/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/export/vmimages/1.raw'/>
<target dev='vdb1' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
[...]
Sarting the guest (error message manually wrapped) fails, as
$ virsh start cvm1
error: Failed to start domain cvm1
error: internal error: process exited while connecting to monitor:
qemu-system-x86_64: -drive
file=/export/vmimages/1.raw,format=raw,if=none,id=drive-virtio-disk1: Duplicate
ID 'drive-virtio-disk1' for drive
It results in QEMU CLI:
-drive file=/export/vmimages/1.raw,format=raw,if=none,id=drive-virtio-disk1 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 \
-drive file=/export/vmimages/1.raw,format=raw,if=none,id=drive-virtio-disk1 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk1,id=virtio-disk1 \
Root cause analysis discussion from IRC from Friday
---------------------------------------------------
[laine]
The problem is that the "alias" libvirt generates based on the target
device name should be unique, but it isn't.
I can see why it's doing that. When putting the index of the disk it's
processing within the entries into drive-virtio-disk%d, it learns the
index by calling virDiskNameToIndex().
It's going through a list of disks, 0, 1, 2, 3, etc creating the
alias. But at each index, it calls this other function to learn the
index, and that function just searches for the first entry that matches
the name.
If they *really* don't know the index (because they only have a
pointer to the entry) they should just search for the entry with the
matching *address in memory*
Haven't stepped through it carefully, but it looks like "vdb" and
"vdb1" lead to the same id, and also "vdb" and "sdb"
[pkrempa]
The alias generator calls virDiskNameToIndex() which calls
virDiskNameParse(). virDiskNameParse() parses the name including
the partition number and returns it. virDiskNameToIndex() discards
the partition number and returns the disk index.
If we accept both 'sdb' and 'sdb1' but generate the same alias then
that's a bug.
--
/kashyap
8 years, 5 months
[libvirt] [PATCH 0/6] Some patches for native TLS encrypted chardev TCP support
by John Ferlan
Not fully complete yet as I need the key secret from the LUKS
encryption support series; however, I figured I would post what I
have that is at least "separable".
This set of patches is in support of:
https://bugzilla.redhat.com/show_bug.cgi?id=1300776
What's missing is the ability to provide an AES secret/key/passphrase
in order to generate the qemu "passwordid=tlskey0" option.
John Ferlan (6):
caps: Add capability for tls-x509-creds
docs: Clarify chardev protocol
qemu: Refactor qemuDomainAttachChrDevice error paths
conf: Add new tlsx509 attribute for tcp chardev
qemu: Add support for TLS X.509 path
qemu: Add the ability to hotplug the TLS X.509 environment
docs/formatdomain.html.in | 36 +++++++-
docs/schemas/domaincommon.rng | 12 +++
src/conf/domain_audit.c | 2 +
src/conf/domain_conf.c | 15 +++
src/conf/domain_conf.h | 1 +
src/conf/virchrdev.c | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 101 +++++++++++++++++++++
src/qemu/qemu_command.h | 6 ++
src/qemu/qemu_hotplug.c | 47 ++++++++--
src/qemu/qemu_monitor_json.c | 9 ++
src/security/security_dac.c | 11 ++-
src/security/security_selinux.c | 10 ++
src/security/virt-aa-helper.c | 12 ++-
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
.../qemuxml2argv-serial-tcp-tlsx509-chardev.args | 32 +++++++
.../qemuxml2argv-serial-tcp-tlsx509-chardev.xml | 42 +++++++++
tests/qemuxml2argvtest.c | 3 +
.../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 51 +++++++++++
tests/qemuxml2xmltest.c | 1 +
25 files changed, 385 insertions(+), 15 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml
--
2.5.5
8 years, 5 months
[libvirt] [PATCH 1/6] add VirtualBox 5 support to file vbox/vbox_tmpl.c
by Martin Pietsch
---
src/vbox/vbox_tmpl.c | 290 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 183 insertions(+), 107 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 7a8205d..79ce001 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -69,6 +69,8 @@
# include "vbox_CAPI_v4_3.h"
#elif VBOX_API_VERSION == 4003004
# include "vbox_CAPI_v4_3_4.h"
+#elif VBOX_API_VERSION == 5000000
+# include "vbox_CAPI_v5_0.h"
#else
# error "Unsupport VBOX_API_VERSION"
#endif
@@ -228,18 +230,18 @@ static void nsIDtoChar(unsigned char *uuid, const nsID *iid)
memcpy(uuidinterim, iid, VIR_UUID_BUFLEN);
virUUIDFormat(uuidinterim, uuidstrsrc);
- uuidstrdst[0] = uuidstrsrc[6];
- uuidstrdst[1] = uuidstrsrc[7];
- uuidstrdst[2] = uuidstrsrc[4];
- uuidstrdst[3] = uuidstrsrc[5];
- uuidstrdst[4] = uuidstrsrc[2];
- uuidstrdst[5] = uuidstrsrc[3];
- uuidstrdst[6] = uuidstrsrc[0];
- uuidstrdst[7] = uuidstrsrc[1];
+ uuidstrdst[0] = uuidstrsrc[6];
+ uuidstrdst[1] = uuidstrsrc[7];
+ uuidstrdst[2] = uuidstrsrc[4];
+ uuidstrdst[3] = uuidstrsrc[5];
+ uuidstrdst[4] = uuidstrsrc[2];
+ uuidstrdst[5] = uuidstrsrc[3];
+ uuidstrdst[6] = uuidstrsrc[0];
+ uuidstrdst[7] = uuidstrsrc[1];
- uuidstrdst[8] = uuidstrsrc[8];
+ uuidstrdst[8] = uuidstrsrc[8];
- uuidstrdst[9] = uuidstrsrc[11];
+ uuidstrdst[9] = uuidstrsrc[11];
uuidstrdst[10] = uuidstrsrc[12];
uuidstrdst[11] = uuidstrsrc[9];
uuidstrdst[12] = uuidstrsrc[10];
@@ -267,18 +269,18 @@ static void nsIDFromChar(nsID *iid, const unsigned char *uuid)
virUUIDFormat(uuid, uuidstrsrc);
- uuidstrdst[0] = uuidstrsrc[6];
- uuidstrdst[1] = uuidstrsrc[7];
- uuidstrdst[2] = uuidstrsrc[4];
- uuidstrdst[3] = uuidstrsrc[5];
- uuidstrdst[4] = uuidstrsrc[2];
- uuidstrdst[5] = uuidstrsrc[3];
- uuidstrdst[6] = uuidstrsrc[0];
- uuidstrdst[7] = uuidstrsrc[1];
+ uuidstrdst[0] = uuidstrsrc[6];
+ uuidstrdst[1] = uuidstrsrc[7];
+ uuidstrdst[2] = uuidstrsrc[4];
+ uuidstrdst[3] = uuidstrsrc[5];
+ uuidstrdst[4] = uuidstrsrc[2];
+ uuidstrdst[5] = uuidstrsrc[3];
+ uuidstrdst[6] = uuidstrsrc[0];
+ uuidstrdst[7] = uuidstrsrc[1];
- uuidstrdst[8] = uuidstrsrc[8];
+ uuidstrdst[8] = uuidstrsrc[8];
- uuidstrdst[9] = uuidstrsrc[11];
+ uuidstrdst[9] = uuidstrsrc[11];
uuidstrdst[10] = uuidstrsrc[12];
uuidstrdst[11] = uuidstrsrc[9];
uuidstrdst[12] = uuidstrsrc[10];
@@ -621,13 +623,12 @@ _vboxIIDFromArrayItem(vboxGlobalData *data, vboxIIDUnion *iidu,
# if VBOX_API_VERSION < 4000000
/* Only 3.x will use this function. */
static bool vboxGetDeviceDetails(const char *deviceName,
- PRUint32 *aMaxPortPerInst,
- PRUint32 *aMaxSlotPerPort,
- PRUint32 storageBus,
- PRInt32 *deviceInst,
- PRInt32 *devicePort,
- PRInt32 *deviceSlot)
-{
+ PRUint32 *aMaxPortPerInst,
+ PRUint32 *aMaxSlotPerPort,
+ PRUint32 storageBus,
+ PRInt32 *deviceInst,
+ PRInt32 *devicePort,
+ PRInt32 *deviceSlot) {
int total = 0;
PRUint32 maxPortPerInst = 0;
PRUint32 maxSlotPerPort = 0;
@@ -829,8 +830,8 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
machine->vtbl->GetDVDDrive(machine, &dvdDrive);
if (dvdDrive) {
- IDVDImage *dvdImage = NULL;
- PRUnichar *dvdfileUtf16 = NULL;
+ IDVDImage *dvdImage = NULL;
+ PRUnichar *dvdfileUtf16 = NULL;
vboxIID dvduuid = VBOX_IID_INITIALIZER;
vboxIID dvdemptyuuid = VBOX_IID_INITIALIZER;
@@ -873,10 +874,10 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
}
} else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
if (type == VIR_STORAGE_TYPE_FILE && src) {
- IHardDisk *hardDisk = NULL;
+ IHardDisk *hardDisk = NULL;
PRUnichar *hddfileUtf16 = NULL;
vboxIID hdduuid = VBOX_IID_INITIALIZER;
- PRUnichar *hddEmpty = NULL;
+ PRUnichar *hddEmpty = NULL;
/* Current Limitation: Harddisk can't be connected to
* Secondary Master as Secondary Master is always used
* for CD/DVD Drive, so don't connect the harddisk if it
@@ -930,8 +931,8 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
VIR_DEBUG("Not connecting harddisk to hdc as hdc"
" is taken by CD/DVD Drive");
} else {
- PRInt32 channel = 0;
- PRInt32 device = 0;
+ PRInt32 channel = 0;
+ PRInt32 device = 0;
PRUnichar *hddcnameUtf16 = NULL;
char *hddcname;
@@ -941,13 +942,13 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
if (STREQ(def->disks[i]->dst, "hda")) {
channel = 0;
- device = 0;
+ device = 0;
} else if (STREQ(def->disks[i]->dst, "hdb")) {
channel = 0;
- device = 1;
+ device = 1;
} else if (STREQ(def->disks[i]->dst, "hdd")) {
channel = 1;
- device = 1;
+ device = 1;
}
rc = machine->vtbl->AttachHardDisk(machine,
@@ -982,8 +983,8 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
if (floppyDrive) {
rc = floppyDrive->vtbl->SetEnabled(floppyDrive, 1);
if (NS_SUCCEEDED(rc)) {
- IFloppyImage *floppyImage = NULL;
- PRUnichar *fdfileUtf16 = NULL;
+ IFloppyImage *floppyImage = NULL;
+ PRUnichar *fdfileUtf16 = NULL;
vboxIID fduuid = VBOX_IID_INITIALIZER;
vboxIID fdemptyuuid = VBOX_IID_INITIALIZER;
@@ -1038,7 +1039,7 @@ static void
_vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
{
size_t i;
- nsresult rc = 0;
+ nsresult rc;
PRUint32 maxPortPerInst[StorageBus_Floppy + 1] = {};
PRUint32 maxSlotPerPort[StorageBus_Floppy + 1] = {};
@@ -1110,14 +1111,14 @@ _vboxAttachDrivesOld(virDomainDefPtr def, vboxGlobalData *data, IMachine *machin
? "True" : "False"));
if (type == VIR_STORAGE_TYPE_FILE && src) {
- IMedium *medium = NULL;
- PRUnichar *mediumUUID = NULL;
+ IMedium *medium = NULL;
+ PRUnichar *mediumUUID = NULL;
PRUnichar *mediumFileUtf16 = NULL;
- PRUint32 storageBus = StorageBus_Null;
- PRUint32 deviceType = DeviceType_Null;
- PRInt32 deviceInst = 0;
- PRInt32 devicePort = 0;
- PRInt32 deviceSlot = 0;
+ PRUint32 storageBus = StorageBus_Null;
+ PRUint32 deviceType = DeviceType_Null;
+ PRInt32 deviceInst = 0;
+ PRInt32 devicePort = 0;
+ PRInt32 deviceSlot = 0;
VBOX_UTF8_TO_UTF16(src, &mediumFileUtf16);
@@ -1311,7 +1312,9 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
ISnapshot *snapshot)
{
vboxGlobalData *data = dom->conn->privateData;
+# if VBOX_API_VERSION < 5000000
IConsole *console = NULL;
+# endif /*VBOX_API_VERSION < 5000000*/
IProgress *progress = NULL;
PRUint32 state;
nsresult rc;
@@ -1344,16 +1347,22 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
}
rc = VBOX_SESSION_OPEN(domiid.value, machine);
+# if VBOX_API_VERSION < 5000000
if (NS_SUCCEEDED(rc))
rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
+# endif /*VBOX_API_VERSION < 5000000*/
if (NS_FAILED(rc)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not open VirtualBox session with domain %s"),
dom->name);
goto cleanup;
}
-
+# if VBOX_API_VERSION < 5000000
rc = console->vtbl->RestoreSnapshot(console, snapshot, &progress);
+# elif VBOX_API_VERSION >= 5000000 /*VBOX_API_VERSION < 5000000*/
+ rc = machine->vtbl->RestoreSnapshot(machine, snapshot, &progress);
+# endif /*VBOX_API_VERSION >= 5000000*/
+
if (NS_FAILED(rc) || !progress) {
if (rc == VBOX_E_INVALID_VM_STATE) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -1378,7 +1387,9 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
cleanup:
VBOX_RELEASE(progress);
+# if VBOX_API_VERSION < 5000000
VBOX_RELEASE(console);
+# endif /*VBOX_API_VERSION < 5000000*/
VBOX_SESSION_CLOSE();
vboxIIDUnalloc(&domiid);
return ret;
@@ -1406,8 +1417,8 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
PRUnichar *machineId, PRUint32 state)
{
virDomainPtr dom = NULL;
- int event = 0;
- int detail = 0;
+ int event = 0;
+ int detail = 0;
vboxDriverLock(g_pVBoxGlobalData);
@@ -1415,7 +1426,7 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
DEBUGPRUnichar("machineId", machineId);
if (machineId) {
- char *machineIdUtf8 = NULL;
+ char *machineIdUtf8 = NULL;
unsigned char uuid[VIR_UUID_BUFLEN];
g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(machineId, &machineIdUtf8);
@@ -1426,31 +1437,31 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
virObjectEventPtr ev;
if (state == MachineState_Starting) {
- event = VIR_DOMAIN_EVENT_STARTED;
+ event = VIR_DOMAIN_EVENT_STARTED;
detail = VIR_DOMAIN_EVENT_STARTED_BOOTED;
} else if (state == MachineState_Restoring) {
- event = VIR_DOMAIN_EVENT_STARTED;
+ event = VIR_DOMAIN_EVENT_STARTED;
detail = VIR_DOMAIN_EVENT_STARTED_RESTORED;
} else if (state == MachineState_Paused) {
- event = VIR_DOMAIN_EVENT_SUSPENDED;
+ event = VIR_DOMAIN_EVENT_SUSPENDED;
detail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED;
} else if (state == MachineState_Running) {
- event = VIR_DOMAIN_EVENT_RESUMED;
+ event = VIR_DOMAIN_EVENT_RESUMED;
detail = VIR_DOMAIN_EVENT_RESUMED_UNPAUSED;
} else if (state == MachineState_PoweredOff) {
- event = VIR_DOMAIN_EVENT_STOPPED;
+ event = VIR_DOMAIN_EVENT_STOPPED;
detail = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
} else if (state == MachineState_Stopping) {
- event = VIR_DOMAIN_EVENT_STOPPED;
+ event = VIR_DOMAIN_EVENT_STOPPED;
detail = VIR_DOMAIN_EVENT_STOPPED_DESTROYED;
} else if (state == MachineState_Aborted) {
- event = VIR_DOMAIN_EVENT_STOPPED;
+ event = VIR_DOMAIN_EVENT_STOPPED;
detail = VIR_DOMAIN_EVENT_STOPPED_CRASHED;
} else if (state == MachineState_Saving) {
- event = VIR_DOMAIN_EVENT_STOPPED;
+ event = VIR_DOMAIN_EVENT_STOPPED;
detail = VIR_DOMAIN_EVENT_STOPPED_SAVED;
} else {
- event = VIR_DOMAIN_EVENT_STOPPED;
+ event = VIR_DOMAIN_EVENT_STOPPED;
detail = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
}
@@ -1525,8 +1536,8 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
PRUnichar *machineId, PRBool registered)
{
virDomainPtr dom = NULL;
- int event = 0;
- int detail = 0;
+ int event = 0;
+ int detail = 0;
vboxDriverLock(g_pVBoxGlobalData);
@@ -1534,7 +1545,7 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
DEBUGPRUnichar("machineId", machineId);
if (machineId) {
- char *machineIdUtf8 = NULL;
+ char *machineIdUtf8 = NULL;
unsigned char uuid[VIR_UUID_BUFLEN];
g_pVBoxGlobalData->pFuncs->pfnUtf16ToUtf8(machineId, &machineIdUtf8);
@@ -1551,10 +1562,10 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED,
* to show the VIR_DOMAIN_EVENT_UNDEFINED event
*/
if (registered) {
- event = VIR_DOMAIN_EVENT_DEFINED;
+ event = VIR_DOMAIN_EVENT_DEFINED;
detail = VIR_DOMAIN_EVENT_DEFINED_ADDED;
} else {
- event = VIR_DOMAIN_EVENT_UNDEFINED;
+ event = VIR_DOMAIN_EVENT_UNDEFINED;
detail = VIR_DOMAIN_EVENT_UNDEFINED_REMOVED;
}
@@ -1750,7 +1761,7 @@ vboxConnectDomainEventRegister(virConnectPtr conn,
virFreeCallback freecb)
{
vboxGlobalData *data = conn->privateData;
- int vboxRet = -1;
+ int vboxRet = -1;
nsresult rc;
int ret = -1;
@@ -1854,7 +1865,7 @@ static int vboxConnectDomainEventRegisterAny(virConnectPtr conn,
virFreeCallback freecb)
{
vboxGlobalData *data = conn->privateData;
- int vboxRet = -1;
+ int vboxRet = -1;
nsresult rc;
int ret = -1;
@@ -2160,26 +2171,26 @@ _dumpIDEHDDsOld(virDomainDefPtr def,
vboxGlobalData *data,
IMachine *machine)
{
- PRInt32 hddNum = 0;
- IHardDisk *hardDiskPM = NULL;
- IHardDisk *hardDiskPS = NULL;
- IHardDisk *hardDiskSS = NULL;
- const char *hddBus = "IDE";
- PRUnichar *hddBusUtf16 = NULL;
+ PRInt32 hddNum = 0;
+ IHardDisk *hardDiskPM = NULL;
+ IHardDisk *hardDiskPS = NULL;
+ IHardDisk *hardDiskSS = NULL;
+ const char *hddBus = "IDE";
+ PRUnichar *hddBusUtf16 = NULL;
/* dump IDE hdds if present */
VBOX_UTF8_TO_UTF16(hddBus, &hddBusUtf16);
def->ndisks = 0;
- machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 0, &hardDiskPM);
+ machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 0, &hardDiskPM);
if (hardDiskPM)
def->ndisks++;
- machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 1, &hardDiskPS);
+ machine->vtbl->GetHardDisk(machine, hddBusUtf16, 0, 1, &hardDiskPS);
if (hardDiskPS)
def->ndisks++;
- machine->vtbl->GetHardDisk(machine, hddBusUtf16, 1, 1, &hardDiskSS);
+ machine->vtbl->GetHardDisk(machine, hddBusUtf16, 1, 1, &hardDiskSS);
if (hardDiskSS)
def->ndisks++;
@@ -2199,8 +2210,8 @@ _dumpIDEHDDsOld(virDomainDefPtr def,
if (hardDiskPM) {
PRUnichar *hddlocationUtf16 = NULL;
- char *hddlocation = NULL;
- PRUint32 hddType = HardDiskType_Normal;
+ char *hddlocation = NULL;
+ PRUint32 hddType = HardDiskType_Normal;
hardDiskPM->vtbl->imedium.GetLocation((IMedium *)hardDiskPM, &hddlocationUtf16);
VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation);
@@ -2221,8 +2232,8 @@ _dumpIDEHDDsOld(virDomainDefPtr def,
if (hardDiskPS) {
PRUnichar *hddlocationUtf16 = NULL;
- char *hddlocation = NULL;
- PRUint32 hddType = HardDiskType_Normal;
+ char *hddlocation = NULL;
+ PRUint32 hddType = HardDiskType_Normal;
hardDiskPS->vtbl->imedium.GetLocation((IMedium *)hardDiskPS, &hddlocationUtf16);
VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation);
@@ -2243,8 +2254,8 @@ _dumpIDEHDDsOld(virDomainDefPtr def,
if (hardDiskSS) {
PRUnichar *hddlocationUtf16 = NULL;
- char *hddlocation = NULL;
- PRUint32 hddType = HardDiskType_Normal;
+ char *hddlocation = NULL;
+ PRUint32 hddType = HardDiskType_Normal;
hardDiskSS->vtbl->imedium.GetLocation((IMedium *)hardDiskSS, &hddlocationUtf16);
VBOX_UTF16_TO_UTF8(hddlocationUtf16, &hddlocation);
@@ -2269,10 +2280,10 @@ _dumpDVD(virDomainDefPtr def,
vboxGlobalData *data,
IMachine *machine)
{
- IDVDDrive *dvdDrive = NULL;
- IDVDImage *dvdImage = NULL;
+ IDVDDrive *dvdDrive = NULL;
+ IDVDImage *dvdImage = NULL;
PRUnichar *locationUtf16 = NULL;
- char *location = NULL;
+ char *location = NULL;
/* dump CDROM/DVD if the drive is attached and has DVD/CD in it */
@@ -2323,8 +2334,8 @@ _dumpDVD(virDomainDefPtr def,
static int
_attachDVD(vboxGlobalData *data, IMachine *machine, const char *src)
{
- IDVDDrive *dvdDrive = NULL;
- IDVDImage *dvdImage = NULL;
+ IDVDDrive *dvdDrive = NULL;
+ IDVDImage *dvdImage = NULL;
PRUnichar *dvdfileUtf16 = NULL;
vboxIID dvduuid = VBOX_IID_INITIALIZER;
vboxIID dvdemptyuuid = VBOX_IID_INITIALIZER;
@@ -2410,10 +2421,10 @@ _dumpFloppy(virDomainDefPtr def,
{
IFloppyDrive *floppyDrive = NULL;
IFloppyImage *floppyImage = NULL;
- PRUnichar *locationUtf16 = NULL;
- char *location = NULL;
- PRBool enabled = PR_FALSE;
- PRUint32 state = DriveState_Null;
+ PRUnichar *locationUtf16 = NULL;
+ char *location = NULL;
+ PRBool enabled = PR_FALSE;
+ PRUint32 state = DriveState_Null;
/* dump Floppy if the drive is attached and has floppy in it */
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
@@ -2466,8 +2477,8 @@ static int
_attachFloppy(vboxGlobalData *data, IMachine *machine, const char *src)
{
IFloppyDrive *floppyDrive;
- IFloppyImage *floppyImage = NULL;
- PRUnichar *fdfileUtf16 = NULL;
+ IFloppyImage *floppyImage = NULL;
+ PRUnichar *fdfileUtf16 = NULL;
vboxIID fduuid = VBOX_IID_INITIALIZER;
vboxIID fdemptyuuid = VBOX_IID_INITIALIZER;
nsresult rc;
@@ -2812,7 +2823,7 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
{
vboxIID iid = VBOX_IID_INITIALIZER;
PRUnichar *machineNameUtf16 = NULL;
- nsresult rc = -1;
+ nsresult rc;
VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
vboxIIDFromUUID(&iid, def->uuid);
@@ -2825,7 +2836,7 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
iid.value,
machine);
#elif VBOX_API_VERSION < 4000000 /* 3002000 <= VBOX_API_VERSION < 4000000 */
- PRBool override = PR_FALSE;
+ PRBool override = PR_FALSE;
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
machineNameUtf16,
NULL,
@@ -2834,7 +2845,7 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
override,
machine);
#elif VBOX_API_VERSION >= 4000000 && VBOX_API_VERSION < 4002000
- PRBool override = PR_FALSE;
+ PRBool override = PR_FALSE;
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
NULL,
machineNameUtf16,
@@ -2843,12 +2854,18 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
override,
machine);
#else /* VBOX_API_VERSION >= 4002000 */
- char *createFlags = NULL;
+ const char *flagsUUIDPrefix = "UUID=";
+ const char *flagsForceOverwrite = "forceOverwrite=0";
+ const char *flagsSeparator = ",";
+ char createFlags[strlen(flagsUUIDPrefix) + VIR_UUID_STRING_BUFLEN + strlen(flagsSeparator) + strlen(flagsForceOverwrite) + 1];
PRUnichar *createFlagsUtf16 = NULL;
- if (virAsprintf(&createFlags,
- "UUID=%s,forceOverwrite=0", uuidstr) < 0)
- goto cleanup;
+ snprintf(createFlags, sizeof(createFlags), "%s%s%s%s",
+ flagsUUIDPrefix,
+ uuidstr,
+ flagsSeparator,
+ flagsForceOverwrite
+ );
VBOX_UTF8_TO_UTF16(createFlags, &createFlagsUtf16);
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
NULL,
@@ -2858,8 +2875,6 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
nsnull,
createFlagsUtf16,
machine);
- cleanup:
- VIR_FREE(createFlags);
#endif /* VBOX_API_VERSION >= 4002000 */
}
VBOX_UTF16_FREE(machineNameUtf16);
@@ -2874,7 +2889,12 @@ _virtualboxCreateHardDisk(IVirtualBox *vboxObj, PRUnichar *format,
/* In vbox 2.2 and 3.0, this function will create a IHardDisk object.
* In vbox 3.1 and later, this function will create a IMedium object.
*/
+#if VBOX_API_VERSION < 5000000
return vboxObj->vtbl->CreateHardDisk(vboxObj, format, location, hardDisk);
+#elif VBOX_API_VERSION >= 5000000 /*VBOX_API_VERSION >= 5000000*/
+ return vboxObj->vtbl->CreateMedium(vboxObj, format, location, AccessMode_ReadWrite, DeviceType_HardDisk, hardDisk);
+#endif /*VBOX_API_VERSION >= 5000000*/
+
}
static nsresult
@@ -3366,7 +3386,23 @@ _sessionGetMachine(ISession *session, IMachine **machine)
static nsresult
_consoleSaveState(IConsole *console, IProgress **progress)
{
+#if VBOX_API_VERSION < 5000000
return console->vtbl->SaveState(console, progress);
+#else /*VBOX_API_VERSION < 5000000*/
+ IMachine *machine;
+ nsresult rc;
+
+ rc = console->vtbl->GetMachine(console, &machine);
+
+ if (NS_SUCCEEDED(rc))
+ rc = machine->vtbl->SaveState(machine, progress);
+ else
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to get machine from console. (error %d)"), rc);
+
+ return rc;
+
+#endif /*VBOX_API_VERSION >= 5000000*/
}
static nsresult
@@ -3414,7 +3450,25 @@ static nsresult
_consoleTakeSnapshot(IConsole *console, PRUnichar *name,
PRUnichar *description, IProgress **progress)
{
+#if VBOX_API_VERSION < 5000000
return console->vtbl->TakeSnapshot(console, name, description, progress);
+#else
+ IMachine *machine;
+ nsresult rc;
+ PRUnichar *id = NULL;
+ bool bpause = true; /*NO live snapshot*/
+
+ rc = console->vtbl->GetMachine(console, &machine);
+
+ if (NS_SUCCEEDED(rc))
+ rc = machine->vtbl->TakeSnapshot(machine, name, description, bpause, &id, progress);
+ else
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to get machine from console. (error %d)"), rc);
+
+ VBOX_RELEASE(machine);
+ return rc;
+#endif /* VBOX_API_VERSION >= 5000000 */
}
static nsresult
@@ -3422,9 +3476,24 @@ _consoleDeleteSnapshot(IConsole *console, vboxIIDUnion *iidu, IProgress **progre
{
#if VBOX_API_VERSION < 3001000
return console->vtbl->DiscardSnapshot(console, IID_MEMBER(value), progress);
-#else /* VBOX_API_VERSION >= 3001000 */
+#elif VBOX_API_VERSION >= 3001000 && VBOX_API_VERSION < 5000000 /* VBOX_API_VERSION >= 3001000 */
return console->vtbl->DeleteSnapshot(console, IID_MEMBER(value), progress);
-#endif /* VBOX_API_VERSION >= 3001000 */
+#else /* VBOX_API_VERSION >= 5000000 */
+ IMachine *machine;
+ nsresult rc;
+
+ rc = console->vtbl->GetMachine(console, &machine);
+
+ if (NS_SUCCEEDED(rc))
+ rc = machine->vtbl->DeleteSnapshot(machine, IID_MEMBER(value), progress);
+ else
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to get machine from console. (error %d)"), rc);
+
+ VBOX_RELEASE(machine);
+
+ return rc;
+#endif /* VBOX_API_VERSION >= 5000000 */
}
static nsresult
@@ -4342,11 +4411,18 @@ _displayGetScreenResolution(IDisplay *display ATTRIBUTE_UNUSED,
#elif VBOX_API_VERSION < 4003000
return display->vtbl->GetScreenResolution(display, screenId, width,
height, bitsPerPixel);
-#else /* VBOX_API_VERSION >= 4003000 */
+#elif VBOX_API_VERSION < 5000000 /* VBOX_API_VERSION >= 4003000 */
return display->vtbl->GetScreenResolution(display, screenId, width,
height, bitsPerPixel,
xOrigin, yOrigin);
-#endif /* VBOX_API_VERSION >= 4003000 */
+#else /*VBOX_API_VERSION >= 5000000 */
+ PRUint32 gms;
+
+ return display->vtbl->GetScreenResolution(display, screenId, width,
+ height, bitsPerPixel,
+ xOrigin, yOrigin, &gms);
+#endif /* VBOX_API_VERSION >= 5000000 */
+
}
static nsresult
@@ -4357,10 +4433,10 @@ _displayTakeScreenShotPNGToArray(IDisplay *display ATTRIBUTE_UNUSED,
PRUint32 *screenDataSize ATTRIBUTE_UNUSED,
PRUint8** screenData ATTRIBUTE_UNUSED)
{
-#if VBOX_API_VERSION < 4000000
+#if VBOX_API_VERSION < 4000000 || VBOX_API_VERSION >= 5000000
vboxUnsupported();
return 0;
-#else /* VBOX_API_VERSION >= 4000000 */
+#else /* VBOX_API_VERSION >= 4000000 && VBOX_API_VERSION < 5000000 */
return display->vtbl->TakeScreenShotPNGToArray(display, screenId, width,
height, screenDataSize,
screenData);
--
2.7.4
8 years, 5 months
[libvirt] [PATCH] docs: Fix syntax-check
by John Ferlan
Commit id '42ff399a' broke syntax-check by not encasing <dt> elements
in <code>xxx</code>
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed under build breaker rule.
docs/downloads.html.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/downloads.html.in b/docs/downloads.html.in
index 899671a..f213b29 100644
--- a/docs/downloads.html.in
+++ b/docs/downloads.html.in
@@ -55,12 +55,12 @@
</p>
<dl>
- <dt>major</dt>
+ <dt><code>major</code></dt>
<dd>incremented by 1 for the first release of the year (the
Jan 15th release)</dd>
- <dt>minor</dt>
+ <dt><code>minor</code></dt>
<dd>incremented by 1 for each monthly release from git master</dd>
- <dt>micro</dt>
+ <dt><code>micro</code></dt>
<dd>always 0 for releases from git master, incremented by 1
for each stable maintenance release</dd>
</dl>
--
2.5.5
8 years, 5 months
[libvirt] [PATCH v2] Bump release to 2.0.0 and document release schedule & versioning
by Daniel P. Berrange
This bumps the release number of 2.0.0, to reflect the switch to
a new time based release versioning scheme. The downloads page
is updated to describe our policies for release schedules and
release version numbering
The stable release docs are changed to reflect the fact that
the stable version numbers are now just 3 digits long instead
of 4.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
configure.ac | 2 +-
docs/downloads.html.in | 51 +++++++++++++++++++++++++++++++++++++++++++----
docs/formatdomain.html.in | 6 +++---
src/libvirt_lxc.syms | 2 +-
src/libxl/libxl_driver.c | 2 +-
src/vz/vz_driver.c | 2 +-
6 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 827d9db..0114149 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
-AC_INIT([libvirt], [1.3.6], [libvir-list(a)redhat.com], [], [http://libvirt.org])
+AC_INIT([libvirt], [2.0.0], [libvir-list(a)redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
diff --git a/docs/downloads.html.in b/docs/downloads.html.in
index 13a6db1..899671a 100644
--- a/docs/downloads.html.in
+++ b/docs/downloads.html.in
@@ -32,20 +32,63 @@
<li><a href="http://libvirt.org/sources/libvirt-git-snapshot.tar.gz">libvirt.org HTTP server</a></li>
</ul>
+ <h2><a name="schedule">Primary release schedule</a></h2>
+
+ <p>
+ Libvirt follows a time based plan, with releases made once a month
+ on the 1st of each month give or take a few days. The only exception
+ is at the start of the year where there are two 6 weeks gaps (first
+ release in the middle of Jan, then skip the Feb release), giving
+ a total of 11 releases a year.
+ </p>
+
+ <h2><a name="numbering">Release numbering</a></h2>
+
+ <p>
+ Since libvirt 2.0.0, a time based version numbering rule
+ is applied. As such, the changes in version number have
+ do not have any implications with respect to the scope of
+ features or bugfixes included, the stability of the code,
+ or the API / ABI compatibility (libvirt API / ABI is guaranteed
+ stable forever). The rules applied for changing the libvirt
+ version number are:
+ </p>
+
+ <dl>
+ <dt>major</dt>
+ <dd>incremented by 1 for the first release of the year (the
+ Jan 15th release)</dd>
+ <dt>minor</dt>
+ <dd>incremented by 1 for each monthly release from git master</dd>
+ <dt>micro</dt>
+ <dd>always 0 for releases from git master, incremented by 1
+ for each stable maintenance release</dd>
+ </dl>
+
+ <p>
+ Prior to 2.0.0, the major/minor numbers were incremented
+ fairly arbitrarily, and maintenance releases appended a
+ fourth digit.
+ </p>
+
<h2><a name="maintenance">Maintenance releases</a></h2>
<p>
In the git repository are several stable maintenance branches,
matching the
- pattern <code>v<i>major</i>.<i>minor</i>.<i>micro</i>-maint</code>;
+ pattern <code>v<i>major</i>.<i>minor</i>-maint</code>;
these branches are forked off the corresponding
- <code>v<i>major</i>.<i>minor</i>.<i>micro</i></code> formal
+ <code>v<i>major</i>.<i>minor</i>.0</code> formal
release, and may have further releases of the
- form <code>v<i>major</i>.<i>minor</i>.<i>micro</i>.<i>rel</i></code>.
+ form <code>v<i>major</i>.<i>minor</i>.<i>micro</i></code>.
These maintenance branches should only contain bug fixes, and no
new features, backported from the master branch, and are
supported as long as at least one downstream distribution
expresses interest in a given branch. These maintenance
- branches are considered during CVE analysis.
+ branches are considered during CVE analysis. In contrast
+ to the primary releases which are made once a month, there
+ is no formal schedule for the maintenance releases, which
+ are made whenever there is a need to make available key
+ bugfixes to downstream consumers.
</p>
<p>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0ad2bbc..daa0891 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2574,7 +2574,7 @@
if <code>discard</code> is set to "ignore"). NB enabling the
detection is a compute intensive operation, but can save file
space and/or time on slow media.
- <span class='since'>Since 1.3.6</span>
+ <span class='since'>Since 2.0.0</span>
</li>
<li>
The optional <code>iothread</code> attribute assigns the
@@ -5372,7 +5372,7 @@ qemu-kvm -net nic,model=? /dev/null
of the first forward dev will be used.
</p>
</dd>
- <dt><code>socket</code> <span class="since">since 1.3.6 (QEMU only)</span></dt>
+ <dt><code>socket</code> <span class="since">since 2.0.0 (QEMU only)</span></dt>
<dd>
<p>
This listen type tells a graphics server to listen on unix socket.
@@ -5388,7 +5388,7 @@ qemu-kvm -net nic,model=? /dev/null
attribute all <code>listen</code> elements are ignored.
</p>
</dd>
- <dt><code>none</code> <span class="since">since 1.3.6 (QEMU only)</span></dt>
+ <dt><code>none</code> <span class="since">since 2.0.0 (QEMU only)</span></dt>
<dd>
<p>
This listen type doesn't have any other attribute. Libvirt supports
diff --git a/src/libvirt_lxc.syms b/src/libvirt_lxc.syms
index 56c24c0..9b418ee 100644
--- a/src/libvirt_lxc.syms
+++ b/src/libvirt_lxc.syms
@@ -21,7 +21,7 @@ LIBVIRT_LXC_1.0.4 {
virDomainLxcEnterSecurityLabel;
} LIBVIRT_LXC_1.0.2;
-LIBVIRT_LXC_1.3.6 {
+LIBVIRT_LXC_2.0.0 {
global:
virDomainLxcEnterCGroup;
} LIBVIRT_LXC_1.0.4;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 9e9957e..0644f60 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5700,7 +5700,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
.domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
.nodeGetSecurityModel = libxlNodeGetSecurityModel, /* 1.2.16 */
.domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */
- .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 1.3.6 */
+ .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 2.0.0 */
};
static virConnectDriver libxlConnectDriver = {
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index bb0d1b9..bb96fa0 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -2756,7 +2756,7 @@ static virHypervisorDriver vzHypervisorDriver = {
.domainIsUpdated = vzDomainIsUpdated, /* 1.2.21 */
.domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
.domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
- .domainSetUserPassword = vzDomainSetUserPassword, /* 1.3.6 */
+ .domainSetUserPassword = vzDomainSetUserPassword, /* 2.0.0 */
.connectDomainEventRegisterAny = vzConnectDomainEventRegisterAny, /* 1.2.10 */
.connectDomainEventDeregisterAny = vzConnectDomainEventDeregisterAny, /* 1.2.10 */
.nodeGetCPUMap = vzNodeGetCPUMap, /* 1.2.8 */
--
2.5.5
8 years, 5 months
[libvirt] [PATCH] Change 1.3.6 occurrences to 2.0.0 to follow version bump
by Martin Kletzander
Version was bumped but documentation (and comments) didn't follow the
numbering.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed as trivial.
docs/formatdomain.html.in | 6 +++---
src/libxl/libxl_driver.c | 2 +-
src/vz/vz_driver.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0ad2bbcc90a2..daa089117d38 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2574,7 +2574,7 @@
if <code>discard</code> is set to "ignore"). NB enabling the
detection is a compute intensive operation, but can save file
space and/or time on slow media.
- <span class='since'>Since 1.3.6</span>
+ <span class='since'>Since 2.0.0</span>
</li>
<li>
The optional <code>iothread</code> attribute assigns the
@@ -5372,7 +5372,7 @@ qemu-kvm -net nic,model=? /dev/null
of the first forward dev will be used.
</p>
</dd>
- <dt><code>socket</code> <span class="since">since 1.3.6 (QEMU only)</span></dt>
+ <dt><code>socket</code> <span class="since">since 2.0.0 (QEMU only)</span></dt>
<dd>
<p>
This listen type tells a graphics server to listen on unix socket.
@@ -5388,7 +5388,7 @@ qemu-kvm -net nic,model=? /dev/null
attribute all <code>listen</code> elements are ignored.
</p>
</dd>
- <dt><code>none</code> <span class="since">since 1.3.6 (QEMU only)</span></dt>
+ <dt><code>none</code> <span class="since">since 2.0.0 (QEMU only)</span></dt>
<dd>
<p>
This listen type doesn't have any other attribute. Libvirt supports
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 9e9957e739e0..0644f6046742 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -5700,7 +5700,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
.domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
.nodeGetSecurityModel = libxlNodeGetSecurityModel, /* 1.2.16 */
.domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */
- .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 1.3.6 */
+ .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 2.0.0 */
};
static virConnectDriver libxlConnectDriver = {
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index bb0d1b99b67c..bb96fa07da10 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -2756,7 +2756,7 @@ static virHypervisorDriver vzHypervisorDriver = {
.domainIsUpdated = vzDomainIsUpdated, /* 1.2.21 */
.domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
.domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
- .domainSetUserPassword = vzDomainSetUserPassword, /* 1.3.6 */
+ .domainSetUserPassword = vzDomainSetUserPassword, /* 2.0.0 */
.connectDomainEventRegisterAny = vzConnectDomainEventRegisterAny, /* 1.2.10 */
.connectDomainEventDeregisterAny = vzConnectDomainEventDeregisterAny, /* 1.2.10 */
.nodeGetCPUMap = vzNodeGetCPUMap, /* 1.2.8 */
--
2.8.4
8 years, 5 months
[libvirt] [PATCH v2] vz: get additional error information from job correctly
by Maxim Nestratov
Function logPrlEventErrorHelper is made void and now it only prints
an information (if any) from event.
If there is no addition information (i.e. an error returned when
asked), we don't rewrite original error code with secondary one.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 99c5d4a..54c56e9 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -99,19 +99,13 @@ logPrlErrorHelper(PRL_RESULT err, const char *filename,
} \
} while (0)
-static PRL_RESULT
+static void
logPrlEventErrorHelper(PRL_HANDLE event, const char *filename,
const char *funcname, size_t linenr)
{
- PRL_RESULT ret, retCode;
char *msg1 = NULL, *msg2 = NULL;
PRL_UINT32 len = 0;
- int err = -1;
- if ((ret = PrlEvent_GetErrCode(event, &retCode))) {
- logPrlError(ret);
- return ret;
- }
PrlEvent_GetErrString(event, PRL_TRUE, PRL_FALSE, NULL, &len);
@@ -130,13 +124,9 @@ logPrlEventErrorHelper(PRL_HANDLE event, const char *filename,
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INTERNAL_ERROR,
filename, funcname, linenr,
_("%s %s"), msg1, msg2);
- err = 0;
-
cleanup:
VIR_FREE(msg1);
VIR_FREE(msg2);
-
- return err;
}
static PRL_RESULT
@@ -146,12 +136,12 @@ getJobResultHelper(PRL_HANDLE job, unsigned int timeout, PRL_HANDLE *result,
{
PRL_RESULT ret, retCode;
- if ((ret = PrlJob_Wait(job, timeout))) {
+ if (PRL_FAILED(ret = PrlJob_Wait(job, timeout))) {
logPrlErrorHelper(ret, filename, funcname, linenr);
goto cleanup;
}
- if ((ret = PrlJob_GetRetCode(job, &retCode))) {
+ if (PRL_FAILED(ret = PrlJob_GetRetCode(job, &retCode))) {
logPrlErrorHelper(ret, filename, funcname, linenr);
goto cleanup;
}
@@ -159,17 +149,26 @@ getJobResultHelper(PRL_HANDLE job, unsigned int timeout, PRL_HANDLE *result,
if (retCode) {
PRL_HANDLE err_handle;
+ ret = retCode;
+
/* Sometimes it's possible to get additional error info. */
- if ((ret = PrlJob_GetError(job, &err_handle))) {
+ if (PRL_FAILED(retCode = PrlJob_GetError(job, &err_handle))) {
logPrlErrorHelper(ret, filename, funcname, linenr);
+ if (PRL_ERR_NO_DATA != retCode)
+ logPrlError(retCode);
goto cleanup;
}
- if (logPrlEventErrorHelper(err_handle, filename, funcname, linenr))
- logPrlErrorHelper(retCode, filename, funcname, linenr);
+ if (PRL_FAILED(retCode = PrlEvent_GetErrCode(err_handle, &retCode))) {
+ logPrlErrorHelper(ret, filename, funcname, linenr);
+ if (PRL_ERR_NO_DATA != retCode)
+ logPrlError(retCode);
+ goto cleanup;
+ }
+
+ logPrlEventErrorHelper(err_handle, filename, funcname, linenr);
PrlHandle_Free(err_handle);
- ret = retCode;
} else {
ret = PrlJob_GetResult(job, result);
if (PRL_FAILED(ret)) {
--
2.4.3
8 years, 5 months
[libvirt] [PATCH] qemu: Obtain job before checking if domain is live
by Martin Kletzander
Since obtaining a job can wait for another job to finish, the state
might change in the meantime. And checking it more than once is
pointless.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_driver.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index efb3f854fb10..e677440c20b2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5388,16 +5388,16 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
goto cleanup;
if (flags & VIR_DOMAIN_VCPU_GUEST) {
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("vCPU count provided by the guest agent can only be "
"requested for live domains"));
- goto cleanup;
+ goto endjob;
}
- if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
- goto cleanup;
-
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
@@ -17796,10 +17796,13 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
- goto cleanup;
+ goto endjob;
}
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) &&
@@ -17808,7 +17811,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("Unable to suspend domain due to "
"missing system_wakeup monitor command"));
- goto cleanup;
+ goto endjob;
}
if (vm->def->pm.s3 || vm->def->pm.s4) {
@@ -17817,29 +17820,20 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
target == VIR_NODE_SUSPEND_TARGET_HYBRID)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("S3 state is disabled for this domain"));
- goto cleanup;
+ goto endjob;
}
if (vm->def->pm.s4 == VIR_TRISTATE_BOOL_NO &&
target == VIR_NODE_SUSPEND_TARGET_DISK) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("S4 state is disabled for this domain"));
- goto cleanup;
+ goto endjob;
}
}
- if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
- goto cleanup;
-
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
- goto endjob;
- }
-
qemuDomainObjEnterAgent(vm);
ret = qemuAgentSuspend(priv->agent, target);
qemuDomainObjExitAgent(vm);
@@ -17942,15 +17936,15 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
if (virDomainQemuAgentCommandEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
- goto cleanup;
+ goto endjob;
}
- if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
- goto cleanup;
-
if (!qemuDomainAgentAvailable(vm, true))
goto endjob;
--
2.8.4
8 years, 5 months
[libvirt] Switch to a time based version number rule
by Daniel P. Berrange
Currently libvirt uses a 3 digit version number, except when it uses
a 4 digit version number. We have the following rules
- major - no one has any clue about when we should bump this
- minor - bump this when some "significant"[*] features appear
- micro - bump this on each new release
- extra - bump this for stable branch releases
[*] for a definition of "significant" that no one knows
Now consider our actual requirements
- A number that increments on each monthly release
- A number that can be incremented for stable branch releases
Ok, the micro + extra digits deal with our two actual requirements, so
one may ask what is the point of the major + minor digits ?
In 11 years of libvirt development we've only bumped the major digit
once, and we didn't have any real reason why we chose to the bump the
major digit, instead of continuing to bump the minor digit. It just
felt like we ought to have a 1.0 release after 7+ years. Our decisions
about when to bump the minor digit have not been that much less arbitray.
We just look at what features are around and randomly decide if any feel
"big enough" to justify a minor digit bump.
Way back in the early days of libvirt, we had exactly this kind of
mess when deciding /when/ to actually make releases. Sometimes we'd
release after a month, sometimes after 3 months, completely arbitrarily
based on whether the chances felt "big enough" to justify a release.
Feature based release schedules are insanity and so we wised up and
adopted the time base release schedule where we release monthly (except
over xmas/new year period).
I venture to suggest that the reasons for switching from feature to
time based release schedules, also apply to version numbers. IOW we
should switch to a time based version number change rule, instead of
a feature based version number change rule.
So what I'm suggesting is that we adopt the following rule
- major: bumped for the first release of each year
- minor: bumped for every major release
- micro: bumped for stable branch releases
Rather than wait until next January to adopt this rule, I'd suggest we
pretend that it is January now, and thus switch our next version number
to be 2.0.0, and jump to 3.0.0 in January 2017.
IOW, over the next 2 years we'll do the following releases off master:
- Jul 1, 2016 - 2.0.0
- Aug 1, 2016 - 2.1.0
- Sep 1, 2016 - 2.2.0
- Oct 1, 2016 - 2.3.0
- Nov 1, 2016 - 2.4.0
- Dec 1, 2016 - 2.5.0
- Jan 15, 2017 - 3.0.0
- Mar 1, 2017 - 3.1.0
- Apr 1, 2017 - 3.2.0
- May 1, 2017 - 3.3.0
- Jun 1, 2017 - 3.4.0
- Jul 1, 2017 - 3.5.0
- Aug 1, 2017 - 3.6.0
- Sep 1, 2017 - 3.7.0
- Oct 1, 2017 - 3.8.0
- Nov 1, 2017 - 3.9.0
- Dec 1, 2017 - 3.10.0
- Jan 15, 2018 - 4.0.0
- Mar 1, 2018 - 4.1.0
- Apr 1, 2018 - 4.2.0
- ....
The stable release branch naming would just use the first major + minor
digit in its name.. eg the stable branch for 2.3.0 would use v2.3-maint
and do stable releases 2.3.1, 2.3.2, 2.3.3, etc.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
8 years, 5 months
[libvirt] [PATCH] qemu: Allow ACPI shutdown only for running domains
by Martin Kletzander
If the domain is not running, but for example the CPUs are stopped, the
ACPI event gets queued and resume of the domain will just shut it off.
https://bugzilla.redhat.com/show_bug.cgi?id=1216281
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index efb3f854fb10..eb38843c62d8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2042,7 +2042,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
+ if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
--
2.8.4
8 years, 5 months